?
Solved

Slick Slide

Posted on 2001-07-09
6
Medium Priority
?
370 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

649 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