Discussion:
Canvas drawing in my multithreaded app.
(too old to reply)
Chethan
2009-05-27 12:35:35 UTC
Permalink
Hi All,

I am writing a multithreaded application to draw a set of lines on to
the TImage.Canvas sequentially.

I have the image component in my main form and I spawn a new thread
to write on to the TImage.Canvas.
This results in a unperdictable output... Not all lines are drawn on
the Canvas and it varies every time i execute the app.

So then i decided to draw it in the main thread itself using the
thread synchronization... The output is perfect... But its really
slow..

Any suggestions to improve the speed?
Is there any VCL component similar to TImage out there which is thread
safe?

Best Regards
Chethan
m***@gmail.com
2009-06-03 10:16:31 UTC
Permalink
Hi, you should ascertain whether the slowness is due to
the Synchronize() call or to slow functions like the
notorious Canvas->Pixels[x][y].
In the first case you may have to abandon the multi
threaded structure, in the latter case you should draw
on Canvas->Handle by calling the windows API directly.

Loading...