?
Solved

Slick Slide

Posted on 2001-07-09
6
Medium Priority
?
372 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
ID: 6265293
If you are moving TImages then put them on a TPanel...
0
 
LVL 13

Accepted Solution

by:
Epsylon earned 400 total points
ID: 6265317
0
 
LVL 1

Author Comment

by:duke_n
ID: 6265712
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

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

Expert Comment

by:TheNeil
ID: 6265738
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
ID: 6266137
Oh, dude DelphiX has a ton of very good samples.
Wow it is pretty whack!
:)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Integration Management Part 2
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

839 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