I have a collection of instances BufferedImage, one main image and some subimages created by a call getSubImageon the main image. Subjects do not overlap. I also make changes to the subimage, and I want to split it into several threads, one for each prototype.
From my understanding of how they work BufferedImage, Rasterand DataBuffer, this should be safe, because:
- Each instance
BufferedImage(and its corresponding WritableRasterand SampleModel) is available from only one thread. - General
ColorModelis unchanged DataBuffer It has no fields that can be changed (the only thing that can change is the elements of the support array).- Changing disjoint array segments in separate threads is safe.
However, I cannot find anything in the documentation that says it is definitely safe. Can I take it safe? I know that you can work with copies of a child Raster, but I would prefer to avoid this because of memory limitations.
Otherwise, is it possible to make the operation thread safe without copying areas of the parent image?
finnw source
share