Word of advice to anyone wanting to meddle with the internal buffer on a BufferedImage:
//This works (for <type> being int, byte or short, and <Type> being Int, Byte or Ushort)
<type>[] bufferData = ((java.awt.image.DataBuffer<Type>)BufferedImage.getRaster().getDataBuffer()).getData();
//This, on the other hand, does not (The BufferImage.getData() method creates a copy of the buffer, that is not backed up by the actual image.
<type>[] bufferData = ((java.awt.image.DataBuffer<Type>)BufferedImage.getData().getDataBuffer()).getData();
Yes, I spent all day today wondering why my filters where not working. :clue:
Edit: Corrected typo on data buffer types. It’s java.awt.image.DataBufferUshort, not DataBufferShort