Article

From:
To:
Alex Belo
Subject:
Re: How threadsafe is TBitmap
Newsgroup:
embarcadero.public.delphi.graphics

Re: How threadsafe is TBitmap

Hi Alex, Erik, Remy,

Thanks very much for your answers.
Alex Belo wrote:
> See
> 
> Report #:  43020   	Status: Reported
> TBitmap.Canvas.Lock is a MUST in multithreading applications
> http://qc.embarcadero.com/wc/qcmain.aspx?d=43020

Thanks for the pointer.

> Jan Derk:
> Contrary to what the Delphi documentation says: one must lock all 
> canvasses, both source and targets, in threads even if you do not share 
> them with other threads, because the GDI object caching mechanism that 
> runs in the main thread may just release your DC when your thread is 
> not expecting it.

When I understand Alex and Erik correctly I must be careful not to 
assign the bitmap to a VCL component because that may resize, update or 
otherwise do something to the bitmap you dont't wish. Especially one 
should lock the canvas.

But when I have a standalone bitmap, use only scanline to process the thing, be careful that no two threads access the same scanline, there should be no problem, according to Remy.
Do i understand that correctly?
I got errors when assigning a bitmap to a TImage displayed on a TForm. That is probably caused by the problems mentioned above.
What is the best way to write an OnProgress event handler to draw the the bitmap? Draw it on the canvas of a new bitmap and assign that to a TImage??
Regards,
Arnold
FYI: Click here to see how many newsgroups are indexed
 
 
Originally created by
Tamarack Associates
Fri, 15 Nov 2024 16:41:55 UTC
Copyright © 2009-2024
HREF Tools Corp.