Solved

Slick Slide

Posted on 2001-07-09
6
355 Views
Last Modified: 2010-04-06
I need to make an animation involving 4 big pictures.
One is background, it is painted once static since then.
Two and three are right and left part of a drawing which slide towards each other(painted transparently while they do)
Four is a frame. It is drawn transparently over the sliding images.

Now to the problem. I do not know DirectX or ASM or stuff like that. So I implemented the drawing the way I knew(if you want I will put the procedure here). I succeeded to get rid of the flickering but the animation is still rather slow and ugly.

Please help me make it more presentable(If you saw the game starcraft you might know what I mean to do).
0
Comment
Question by:duke_n
  • 3
  • 2
6 Comments
 
LVL 13

Expert Comment

by:Epsylon
Comment Utility
If you are moving TImages then put them on a TPanel...
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 100 total points
Comment Utility
0
 
LVL 1

Author Comment

by:duke_n
Comment Utility
no I am not moving images.
Here is my procedure roughly:

Procedure TMainForm.Animate;
var
i:integer;
bmp1,bmp2,Bmp3:Tbitmap;
J:TJPegImage;
Get:TResourceStream;
begin
Randomize;
...
//Slide Animation
bmp1:=TBitmap.Create;
bmp2:=TBitmap.Create;
bmp3:=TBitmap.Create;
J:=TJPEGImage.Create;

Get:=TResourceStream.Create(hInstance,'LEFT',RT_RCDATA);
bmp1.LoadFromStream(Get);
Get.Free;

Get:=TResourceStream.Create(hInstance,'RIGHT',RT_RCDATA);
bmp2.LoadFromStream(Get);
Get.Free;

Get:=TResourceStream.Create(hInstance,'FRAME',RT_RCDATA);
J.LoadFromStream(Get);
Get.Free;

bmp1.TransparentColor:=clWhite;
bmp1.TransparentMode:=tmFixed;
bmp1.Transparent:=True;
bmp2.TransparentColor:=clWhite;
bmp2.TransparentMode:=tmFixed;
bmp2.Transparent:=True;

FrameIMG.Canvas.Brush.Color:=clBlack;
FrameIMG.Canvas.CopyMode:=cmSrcCopy;
FrameIMG.Canvas.FillRect(Rect(0,0,FrameIMG.Width,FrameIMG.Height));
bmp3.TransparentColor:=clBlack;
bmp3.TransparentMode:=tmFixed;
bmp3.Transparent:=True;
bmp3.Height:=J.Height;
Bmp3.Width:=J.Width;

Bmp3.Canvas.Draw(0,0,J);
Get:=TResourceStream.Create(hInstance,'P'+IntTostr(Random(3)),RT_RCDATA);
J.LoadFromStream(Get);
Get.Free;
FrameImg.Canvas.Draw(28,28,J);
For i:=0 to 43 do
  begin
    // FrameIMG.Picture.Bitmap.Canvas.CopyRect(Rect(Width-i*16,28,Width-i*16+BMP2.Width,28+bmp2.Height),
      //                     BMP2.Canvas,Rect(0,0,BMP2.Width,bmp2.Height));
     FrameIMG.Picture.Bitmap.Canvas.Draw(Width-(i-4)*16,28,bmp2);
     FrameIMG.Picture.Bitmap.Canvas.Draw(-120+(i-4)*4,28,bmp1);
     FrameIMG.Picture.Bitmap.Canvas.Draw(0,0,bmp3);
     FrameIMG.Refresh;
  end;
bmp1.Free;
bmp2.Free;
bmp3.Free;
J.Free;
ShowCursor(True);
end;
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 1

Author Comment

by:duke_n
Comment Utility
and as I said I don't know how to handle DirectX
0
 
LVL 5

Expert Comment

by:TheNeil
Comment Utility
You should be able to speed things up a bit by drawing onto a temporary bitmap (in memory) and then just throw that image at the screen once

i.e. Instead of drawing all four bitmaps to the screen each time in your loop, draw them to a temporary bitmap and then output THAT to the screen

The Neil =:)
0
 
LVL 1

Author Comment

by:duke_n
Comment Utility
Oh, dude DelphiX has a ton of very good samples.
Wow it is pretty whack!
:)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now