I’m developing a Java application that uses JNI (bridge to C dynamic/shared library). In the Java side of the application, I am generating a series of images, and in the C code, I am encoding them into a video.
I know I could just save the images in a temporary file of some sort and pass the file path into C, but that seems hackish and slow.
Is it possible for me to get the BufferedImage RGB24 array data and pass that into C?
I am fairly new at Java and JNI.
Yeah, it is.
jintArrayorjbyteArrayis the structure you should use.And if I remember correctly, there’s
getRGB(...)method ofBufferedImagethat returns an array of ints representing RGB values.So, put those two together and you’ll be on your way.
Refer to this document for method signatures, etc.