Solved

Slick Slide

Posted on 2001-07-09
6
364 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 100 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
Industry Leaders: 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

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!

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

717 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