Article

From:
To:
All
Subject:
How threadsafe is TBitmap
Newsgroup:
embarcadero.public.delphi.graphics

How threadsafe is TBitmap

I am trying to parallellize bitmap operations. This appears to be well 
possible for scanlines. Typical code reads like this:

// inside a tthread derived class do the following in execute // where index points at the scanline to be prcoessed
s := source_bitmap.Scanline [index]; t := target_bitmap.Scanline [index]; for x := 0 to source_bitmap.Width - 1 do begin     pixel := s [x];     // do something with pixel     t [x] := pixel; end;
It appears to be threadsafe, each thread processing his own index. I have tested this code very often. However, very rarely I get a illegal memory read/write. Are there things I overlook? Should I read some articles (i couldn't find them)?
Greetings,
Arnold
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Fri, 15 Nov 2024 16:18:58 UTC
Copyright © 2009-2024
HREF Tools Corp.