How to paint by multi threading into a TBitmap

前端 未结 1 886
广开言路
广开言路 2021-01-27 03:39

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

相关标签:
1条回答
  • 2021-01-27 03:52

    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.

    0 讨论(0)
提交回复
热议问题