Since java do not have void* and jni do not have ByteArray, it's not clear what's your execution environment.
Since the source of problem is the void* pixel map, I would assume you want to create a java Bitmap object with the pixels, with a mix of JNI and Java code.
First look at the Bitmap class, there is a convenient function named copyPixelsFromBuffer, looks like useful, it takes a Buffer.
Second, look at JNI function NewDirectByteBuffer, it takes a C pointer and create a ByteBuffer, which is also a Buffer needed by Bitmap.
Now it becomes clear, you just need to:
- Create
ByteBuffer with the pixel buffer with JNI code
- Pass/return that
ByteBuffer to Java land
- Fill a
Bitmap with such ByteBuffer.
- Display it with
ImageView or your paint routine.
P.S. It's left to OP's excise to handle object referencing to be GC friendly.
reinterpret_castis the natural cast to use when going back fromvoid*, because it expresses the intent. and high level language is used primarily to communicate to humans, not to the compiler. still opinions differ and it's not technically wrong to usestatic_cast(it does exactly the same here), just very sub-optimal in terms of human communication, which is the main point of the named casts.