android - getPixels is crashing, am i using it right? -


i wrote jni run on android, works great except crashing on last line. wondering if can please see if using getpixels correct. documentation getpixels: http://developer.android.com/reference/android/graphics/bitmap.html#getpixels%28int%5b%5d,%20int,%20int,%20int,%20int,%20int,%20int%29

this full code: https://gist.github.com/noitidart/cb6e7c3a102784d04262

this relavent parts:

var bmp = bitmap.createbitmap(width, height, bitmap_config.argb_8888);  var rgba = jni.jint.array(4 * width * height)();  bmp.getpixels(     rgba,     0,     width * 4, // stride     0,     0,     width,     height ); 

i'm unsure if setting right size rgba array, , if set stride right. did width * 4 stride because rgba 4 numbers per pixel. , thats why did width * 4 * height size of rgba array.

please advise


Comments