How can I convert an image from raw data in Android without any munging?

Posted by stephelton on Game Development See other posts from Game Development or by stephelton
Published on 2011-06-23T06:34:14Z Indexed on 2014/06/06 21:57 UTC
Read the original article Hit count: 235

Filed under:
|
|

I have raw image data (may be .png, .jpg, ...) and I want it converted in Android without changing its pixel depth (bpp). In particular, when I load a grayscale (8 bpp) image that I want to use as alpha (glTexImage() with GL_ALPHA), it converts it to 16 bpp (presumably 5_6_5).

While I do have a plan B (actually, I'm probably on plan 'E' by now, this is really becoming annoying) I would really like to discover an easy way to do this using what is readily available in the API.

So far, I'm using BitmapFactory.decodeByteArray().

While I'm at it. I'm doing this from a native environment via JNI (passing the buffer in from C, and a new buffer back to C from Java). Any portable solution in C/C++ would be preferable, but I don't want to introduce anything that might break in future versions of Android, etc.

© Game Development or respective owner

Related posts about android

Related posts about opengl-es