Thanks Chris,
and what about a NIO WritableRaster (ok, it’s almost the same as the NIO BufferedImage, bul a bit more low-level).
It would be nice to have a simple NIODataBufferInt (i.e. a DataBuffer that wraps a native array)
// the RGBA color masks
int[] bm = new int[]{0x00FF0000,0x0000FF00,0x000000FF,0xFF000000};
// the colormodel
ColorModel cm = new DirectColorModel(32,bm[0],bm[1],bm[2],bm[3]);
// allocate bitmap data
NIODataBufferInt db = new NIODataBufferInt(pixels,pixels.length,pixoffset);
WritableRaster wr = WritableRaster.createPackedRaster(db,width,height,rowints,bm,null);
// the image
return new BufferedImage(cm,wr,false,null);
that would help true sharing of image data between native and java.