So, I have one stream that will constantly capture a screenshot and put the bitmap returned from Graphics.CopyFromScreeninto the public object of the bitmap. The idea is to use several other streams in this bitmap, but only for reading, without writing to the bitmap. Initially, I tried to just read it, but quickly found that it was blocking the entire bitmap so that it could not be used elsewhere. My second option was to simply create a new temporary bitmap in each stream that should use a public bitmap, and justtempBitMap = publicBitMap. This seems like a few exceptions, and I feel that is probably the best way anyway. I saw that you can block certain bits / pixels that need to be used in several streams, and then release them as soon as you finish with them, but does recording prevent the entire raster image from being locked for a while? Or it just writes to the entire bitmap, with the exception of the locked bits / pixels. Methods using a publicly available bitmap use only one pixel at a time, so this can probably work, provided that the public bitmap can be written while some of its bits / pixels are locked.
Just look for the most effective solution, if anyone can give advice on the most effective solution, I would be very grateful, thanks.
EDIT: I use the BitMap.GetPixel () method, which blocks the bitmap.
source
share