<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p>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!</p>
<p> </p>
<p>Image.Transparent is also set to false btw, which is default. Otherwise the drawing on the canvas is even messed up.</p>
<p> </p>
<p>Regards, Darius</p>
<p> </p>
<p>procedure TForm1.Button1Click(Sender: TObject);<br />var<br /> s: TDateTime;<br /> i: Integer;<br />begin<br /> s := now;<br /> for i := 1 to 24 do<br /> begin<br /> if filecache_get_from_cache(i, png) then<br /> begin<br /> Image1.Picture.Bitmap.LoadFromRawImage(png.RawImage, False);<br /> Application.ProcessMessages;<br /> end;<br /> end;</p>
<p> ShowMessage(FloatToStr(24 / ((now - s) * 24 * 3600)))<br />end;</p>
<p> </p>
<p> </p>
<p>On 8 feb '12, Flávio Etrusco wrote:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<pre>On Wed, Feb 8, 2012 at 7:39 AM, Sven Barth <<a href="mailto:pascaldragon@googlemail.com">pascaldragon@googlemail.com</a>> wrote:</pre>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%">Am 08.02.2012 01:07, schrieb <a href="mailto:dhkblaszyk@zeelandnet.nl:">dhkblaszyk@zeelandnet.nl:</a>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%">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;</blockquote>
Why are you calling "Application.ProcessMessages" here? Regards, Sven</blockquote>
<pre>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
<a href="mailto:Lazarus@lists.lazarus.freepascal.org">Lazarus@lists.lazarus.freepascal.org</a>
<a href="http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus">http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus</a>
</pre>
</blockquote>
<p> </p>
<p> </p>
<div> </div>
</body></html>