As Peter Lowry has already pointed out, using an object other than Java is not possible, but it may be possible to directly draw raw data from a simple array of Java bytes (which can be directly accessed on the C ++ side).
In the end, you could even call Canvas.drawBitmap (..) , using this byte array to draw your created image. Of course, to store the image on the C ++ side, you need to save the required format inside the byte array.
Java:
byte[] pixelBuf = new byte[bufSize];
Then pass the link byte[]to the C ++ inline implementation. On the C ++ side, you can call
C ++:
jbyte* pixelBufPtr = env->GetByteArrayElements(pixelBuf, JNI_FALSE);
jsize pixelBufLen = env->GetArrayLength(env, pixelBuf);
env->ReleaseByteArrayElements(pixelBuf, pixelBufPtr, 0);
source
share