When working with BufferedImage using the setRGB and getRGB methods, I noticed two things:
The setRGB and getRGB methods can be incredibly slow on some systems (two orders of magnitude slower than the modifiyng int [] array).
there is no guarantee that getRGB after setRGB will return the same pixel that you passed
This last paragraph is basically pretty clear from the JavaDoc setRGB, which states:
... For images with IndexColorModel, the index with the closest color is selected.
It can be seen that I can work directly in BufferedImage int [] pixels, which I can access, for example:
int[] a = ((DataBufferInt) tmp.getRaster().getDataBuffer()).getData();
I was wondering: are there any known / gotchas flaws when directly manipulating pixels in int[] ?
SyntaxT3rr0r
source share