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 2011/06/23 8:30 UTC
Read the original article Hit count: 318

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