I'm working with a 16bit grayscale image:
BufferedImage bufferedImage = new BufferedImage(320, 240, BufferedImage.TYPE_USHORT_GRAY);
I'm able to edit that image by grabbing a reference to its underlying storage. The data is stored in a linear array, in row major order:
short[] data = ((DataBufferUShort)bufferedImage.getRaster().getDataBuffer()).getData();
However, if bufferedImage
has been rendered to any screen, editing data
no longer has any effect.; I can edit the data before its displayed on the screen, but after displaying it I can no longer change it.
I've of course tried repainting the AWT control -- it didn't update with the new pixel data. I've even tried getDataElements & setDataElements. Nothing seems to work, after the image has been displayed.