Moving Timage over another Timage causes flickering ??

Moving Timage over another Timage causes flickering ??

Post by Bryan Ra » Sat, 19 May 2001 12:14:23


Hello NG,

I have a TImage that contains a bitmap (~1024X768).
I have another Timage (150X150) no bitmap loaded, that has transparent set
to true.

I draw an ellipse on the 150X150 Timage and then move 5 times per second by
setting its Top and Left Property.

Problem.... Every time I reposition (move) the 150X150 image over the larger
image, I get a flicker.

I've tried with and without calling Image.Update..... no luck.

How do I get rid of the flicker?

Thanks
Bryan

 
 
 

Moving Timage over another Timage causes flickering ??

Post by Sue D. No » Sat, 19 May 2001 23:44:46


You will probably be better off by creating an off screen bitmap, then using
CopyRect to put the offscreen bitmap onto the TImage.  You will also want to
save the underlying area of the TImage before doing the copy so you can put it
back.

var
  SaveBmp, MyBmp : TBitmap;
  PosR : TRect; // set for position in output image
  xpos, ypos : integer;
begin
  // set up the image you are going to output
  MyBmp := TBitmap.Create;
  MyBmp.Picture.LoadFromFile(<mybmpfile>);
  // set the position in output and create the copyrect
  xpos := xxx;
  ypos := yyy;
  PosR := Rect(xpos, ypos, xpos + MyBmp.Width, ypos + MyBmp.Height);
  // copy Timage area to save it from output image
  SaveBmp := TBitmap.Create;
  SaveBmp.Width := MyBmp.Width;
  SaveBmp.Height := MyBmp.Height;
  SaveBmp.Canvas.CopyRect(Rect(0,0,SaveBmp.Width,SaveBmp.Height),
    Image1.Picture.Bitmap.Canvas, PosR)
  // write out your bmp
  Image1.Picture.Bitmap.Canvas.CopyRect(PosR, MyBmp.Canvas,
    Rect(0,0,MyBmp.Width, MyBmp.Height));

// whenever you get ready to move the image, you put back the original image

  Image1.Picture.Bitmap.Canvas.CopyRect(PosR, SaveBmp.Canvas,
    Rect(0,0,SaveBmp.Width, SaveBmp.Height));


> Hello NG,

> I have a TImage that contains a bitmap (~1024X768).
> I have another Timage (150X150) no bitmap loaded, that has transparent set
> to true.

> I draw an ellipse on the 150X150 Timage and then move 5 times per second by
> setting its Top and Left Property.

> Problem.... Every time I reposition (move) the 150X150 image over the larger
> image, I get a flicker.

> I've tried with and without calling Image.Update..... no luck.

> How do I get rid of the flicker?

> Thanks
> Bryan


 
 
 

Moving Timage over another Timage causes flickering ??

Post by David J Taylo » Sun, 20 May 2001 00:24:21


Bryan,

You could try putting the TImages on a TPanel, and setting the TPanel's
DoubleBuffered property True in the form's OnCreate event.  Even setting
the Form's DoubleBuffered property True may be enough...

Worth a try, at least

David

 
 
 

Moving Timage over another Timage causes flickering ??

Post by Jeff Siebe » Sun, 20 May 2001 01:05:46


You might try trapping the WM_ERASEBKGND.  You can do what you need and then
process the messages in the queue once you're done.  You shouldn't get the
flickering that way.

J


> Hello NG,

> I have a TImage that contains a bitmap (~1024X768).
> I have another Timage (150X150) no bitmap loaded, that has transparent set
> to true.

> I draw an ellipse on the 150X150 Timage and then move 5 times per second
by
> setting its Top and Left Property.

> Problem.... Every time I reposition (move) the 150X150 image over the
larger
> image, I get a flicker.

> I've tried with and without calling Image.Update..... no luck.

> How do I get rid of the flicker?

> Thanks
> Bryan

 
 
 

Moving Timage over another Timage causes flickering ??

Post by Bryan Ra » Sun, 20 May 2001 02:46:30


Thanks for all of the suggestions.  I'll give them a try.

Thanks again
Bryan


> Hello NG,

> I have a TImage that contains a bitmap (~1024X768).
> I have another Timage (150X150) no bitmap loaded, that has transparent set
> to true.

> I draw an ellipse on the 150X150 Timage and then move 5 times per second
by
> setting its Top and Left Property.

> Problem.... Every time I reposition (move) the 150X150 image over the
larger
> image, I get a flicker.

> I've tried with and without calling Image.Update..... no luck.

> How do I get rid of the flicker?

> Thanks
> Bryan

 
 
 

1. Help Moving a TImage over a TImage

Marco,

That's the route I suggest.  To resize the images, use the CopyImage()
Win32 function.  See the following post for a code example...

http://groups.google.com/groups?selm=3B33B78F.4200BDB6%40cornell.edu

Best of luck,
--
Damon (TeamB)
BCBCAQ--http://bcbcaq.bytamin-c.com

2. Tutorials

3. How to avoid flickering while moving TImage

4. Vector Based Format

5. TImage.Stretch causes Image to disappear

6. 3D Rotations

7. TImage Mousemoves cause Canvas does not allow drawing error -- Help me, I'll pay you

8. Text Wrapping

9. TImage causing Taskbar problem?

10. Crop part of a TImage into another TImage

11. pasting multiple TImages into one TImage (FASTEST WAY)

12. Thumbnail blank when dynamically creating TImage but OK with TImage on form

13. Timage, how can i create severals timage?