Comments inline.
"Arnold Reinders" <✉somewhere.com> wrote in message news:✉forums.codegear.com...
> Hi Alex, Erik, Remy, > > > 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?
As another poster mentioned, you MAY be able to get this to work if you call ScanLine in the main/GUI thread and pass the scan line addresses to the worker threads. That way the threads are not dependent on the memory DC created by the TBitmap in any way.
The problem I kept running into was caused by "asynchronous freeing" of the Windows memory DC underlying the TBitmap. The most frustrating thing was that there was no way to tell whether a TBitmap had a valid memory DC or not; the TBitmap was getting it's memory DC trashed without notification of any kind.
For clues as to where the problem is, read the procedure header comments for FreeMemoryContexts and DeselectBitmap in Graphics.pas (not sure I can post them here so I will play it safe).
Erik Turner Melbourne, FL
> > Regards, > > Arnold