Thread View: borland.public.cppbuilder.multimedia
4 messages
4 total messages
Started by Nicholas Gessler
Tue, 07 Aug 2001 15:18
image component flickers during move
Author: Nicholas Gessler
Date: Tue, 07 Aug 2001 15:18
Date: Tue, 07 Aug 2001 15:18
19 lines
1658 bytes
1658 bytes
Using the image component, I was trying to make the image glide (float)
across the screen. So I set up a timer that incrementally moves the top and
left properties of the image. The timer quits when the image reaches the
screen center (it is disabled). This all works, but the image flickers as
it passes over other stationary images. The image is a .bmp and is
transparent. Can anyone tell me how to program flicker-free movement? I am
trying, to some extent, to emulate some of the emulation in Flash.
void __fastcall TForm1::TimerGlideTimer(TObject *Sender)
{
if (x>280) TimerGlide->Enabled=false;
x=x+5;
y=y+4;
Form1->ImageModel->Left=x;
Form1->ImageModel->Top=y;
}
Thanks for your help,
Nick
Re: image component flickers during move
Author: Corey Murtagh
Date: Tue, 07 Aug 2001 19:57
Date: Tue, 07 Aug 2001 19:57
35 lines
2545 bytes
2545 bytes
Nicholas Gessler <gessler@ucla.edu> wrote in message news:3b70065b_1@dnews... > Using the image component, I was trying to make the image glide (float) > across the screen. So I set up a timer that incrementally moves the top and > left properties of the image. The timer quits when the image reaches the > screen center (it is disabled). This all works, but the image flickers as > it passes over other stationary images. The image is a .bmp and is > transparent. Can anyone tell me how to program flicker-free movement? I am > trying, to some extent, to emulate some of the emulation in Flash. I spent a while trying way back, but eventually gave up on using multiple TImage objects. These days I use TBitmap objects to hold images and draw my screen into, then CopyRect to move the data to a TPaintBox on-screen. It's a bit more work, but since all of the image compositing is done off-screen there's little or no flicker - none if it's done right. Here's what I'd suggest... Create a Graphics::TBitmap for each image you're using, one for your composite image, and a final one for the screen image. When the on-screen image needs to change, clear the composite bitmap and draw all of the images onto it. When that's done copy the composite to the screen bitmap, then update the TPaintBox. Don't forget to handle the TPaintBox's OnPaint event - that's the reason for seperate composite and screen bitmaps. If that doesn't eliminate 99% of your screen flicker immediately then there's something strange happening :> -- Corey Murtagh The Electric Monk "Quidquid latine dictum sit, altum viditur."
Re: image component flickers during move
Author: Van Tumour
Date: Wed, 08 Aug 2001 18:52
Date: Wed, 08 Aug 2001 18:52
17 lines
1422 bytes
1422 bytes
If you decide to do it the way Corey suggests, then I recommend making use of the following free VCL component package 'VTI Super-Graphics package' http://members.tripod.co.uk/vantumour/products.htm It contains an enhanced TBitmap and TPaintBox for exactly this sort of stuff. HTH -- Van Tumour ---------------------------------- vt@vantumour.com http://www.vantumour.com ----------------------------------
Re: image component flickers during move
Author: Nicholas Gessler
Date: Fri, 10 Aug 2001 05:11
Date: Fri, 10 Aug 2001 05:11
5 lines
1110 bytes
1110 bytes
Thanks Corey and Van, I'm trying to build a small collection of sample applications for my students in Geography. Your help has been invaluable. Best, Nick
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads