Serious problem with Delphi 6

Started by
2 comments, last by mBlack 21 years, 4 months ago
I don''t know if anyone noticed this, but delphi 6 has a little problem, that in my case is the biggest problem ever. No matter what animation tehnique you use, the TImage component allways flickers. I''ve tried setting the pen to pmXOR, i''ve tried clearing the whole canvas, I''ve tried drawing to an auxiliary surface(TBitmap in this case) and after all is drawn, put it on the canvas, but i allways get the same result. Get anyone please help me out ?!
Advertisement
Have you tried checking the vertical retrace? I did the same thing and it worked. Go to the old DOS game programming archives and look for a short assembler procedure that holds until a vertical retrace (its only about 8 lines of code). Call it just before you blit to screen.
There is a bug in Delphi 6 with TImage. Set the Stretch property to True if you plan on drawing on its canvas. You might also think about handling the WM_ERASEBKGND message and returning 1, so that the form background is not erased (which depends on your app''s requirements, of course...).

Alternatively, use a graphics library that most definitely does not suck: Graphics32. It''s damned good. Check out the compiled examples if you''re still not convinced (especially Gradlines_ex.exe). It has support for alpha blending, transformations (rotation, scaling, etc.), filtering for images, layers. It''s faster, flicker-free and ten squillion times more advanced than the VCL graphics components.
Use double-buffering...

example:

var
Buffer: TBitmap;


// initialization (e.g. Form.Create)
Buffer := TBitmap.Create;
Buffer.Width := 640;
Buffer.Height := 480;

// draw stuff onto the bitmap's canvas here
BitBlt(Form1.Canvas.Handle, 0, 0, Buffer.Width, Buffer.Height, Buffer.Canvas.Handle, 0, 0, SRCCOPY);

this will eliminate the flicker...




[edited by - Harry Hunt on December 11, 2002 12:50:45 PM]

This topic is closed to new replies.

Advertisement