to speed up painting a bitmap in Delphi XE2, I decided to go the following way
a) Create a eg. 10 x Thread and paint only one layer of the bitmap inside the thread class
a) How to detect once all 10 painting threads are finished and b) How to access the thread[i] and get the bitmap to the main program (VCL) for merging?
Add an OnTerminate
event handler for each thread. This will execute on the main thread. Merge the bitmaps in this event handler. Because it executes on the main thread, synchronization is taken care of.
If the event handler is a method of the thread class then it can gain access to the thread's private bitmap object.
Alternatively, if you don't want to use the event handler, override DoTerminate
and synchronize the merge method from there.