I have played with Image.Update, .Invalidate and .Repaint, but none of them seem to work for me. Only when I put Application.ProcessMessages the painted images show on screen. See below for the testloop code. The images are streamed from a file cache. For 24 frames this seems overkill, but running at 24fps the memeory requirements quickly get very large!
Image.Transparent is also set to false btw, which is default. Otherwise the drawing on the canvas is even messed up. Regards, Darius procedure TForm1.Button1Click(Sender: TObject); var s: TDateTime; i: Integer; begin s := now; for i := 1 to 24 do begin if filecache_get_from_cache(i, png) then begin Image1.Picture.Bitmap.LoadFromRawImage(png.RawImage, False); Application.ProcessMessages; end; end; ShowMessage(FloatToStr(24 / ((now - s) * 24 * 3600))) end; On 8 feb '12, Flávio Etrusco wrote: > On Wed, Feb 8, 2012 at 7:39 AM, Sven Barth wrote: > >> Am 08.02.2012 01:07, schrieb [email protected]: [1] >> >>> 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; >> Why are you calling "Application.ProcessMessages" here? Regards, Sven > > Good catch. I guess the OP has used this previously to repaint > controls/images during a long-running procedure... (and even there > it's often not the best solution) > @dhlblaszyk: when you want to force the repaint of the whole control, > call Image1.Repaint. If you want to just repaint some invalidated part > of it, call Image1.Update (not sure TGraphicControl has Update, so you > may need to use Parent.Update instead). Of course you should do this > *outside* the OnPaint. Also, is Image1.Transparent set to false? > BTW what do you mean by "The images are streamed continuously from disk"? > > Regards, > Flávio > > -- > _______________________________________________ > Lazarus mailing list > [email protected] [3] > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus [4] Links: ------ [1] mailto:[email protected]: [2] mailto:[email protected] [3] mailto:[email protected] [4] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
