Creating Java Images from native code
I have a need to get image data from native code to a Java Image, e.g. a BufferedImage, in the most efficient manner possible.
Ideally I would like to write to the BufferedImage's raster directly in my native code, or get an image from a DirectByteBuffer of RGB pixel data. If I can reuse the same Image object multiple times to avoid excessive garbage creation that would be best.
I'm looking for options and pointers on how I should implement such a thing while avoiding as much as possible any data copying. It is likely that my data will need to be converted from YUV color space to RGB color space and I would like for that to be the only time the data is copied. So I would convert directly into the BufferedImage with my native color conversion (and in some cases scaler) loop which is already optimized with SIMD assembler.
Thanks in advance.