[Lazarus] Fast drawing to canvas

dhkblaszyk at zeelandnet.nl dhkblaszyk at zeelandnet.nl
Wed Feb 8 01:07:38 CET 2012


  

Hi, 

I'm drawing a bitmap to the canvas by using LoadFromRawImage
in combination with a TImage. The OnPaint code below works just fine.
When I move the scrollbar, the images are drawn to the canvas, however
there is still a bit of flicker. 

procedure TForm1.Image1Paint(Sender:
TObject);
begin

Image1.Picture.Bitmap.LoadFromRawImage(bitmaplist[ScrollBar1.Position].RawImage,
False); 

 Application.ProcessMessages;
end; 

When I setup a timer,
for automatic looping of the images, the flicker gets so bad, that the
canvas turns blank and nothing is shown anymore. 

procedure
TForm1.Timer1Timer(Sender: TObject);
var
 p: integer;
begin
 p :=
ScrollBar1.Position + 1;
 if p > ScrollBar1.Max then

ScrollBar1.Position := 0
 else
 ScrollBar1.Position := p;
end; 

I
understand I must be doing something wrong here. So my question remains,
Given a list of bitmaps, what would be the fastest way to draw them to
the screen consequtively? 

Regards, Darius 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120208/e710c9f5/attachment-0002.html>


More information about the Lazarus mailing list