Welcome!

Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Contributor
billybaloop
Posts: 20
Registered: ‎11-15-2010

Image formats on BB

In the OpenGL example provided with the BB kit, I noticed it assumes a Bitmap object, when loaded from a PNG file is in RGB 565 format.  This is 2 bytes per pixel, and by default it seems no ALPHA channel is stored:

 

GLUtils.glTexImage2D(gl, 0, GL10.GL_RGB, GL10.GL_UNSIGNED_SHORT_5_6_5, bitmapObject, null);

 

I'm wondering what is the native format for images on BB?  Can I use ARGB 8888 format instead of RGB 565?

Please use plain text.
Developer
rcmaniac25
Posts: 1,789
Registered: ‎04-28-2009
My Carrier: Verizon

Re: Image formats on BB

You can use whatever format you want, I don't know what native format OpenGL for BlackBerry is running but I know BlackBerry is mainly PNG and the screen format is RGB565. The easiest thing to do is to try ARGB8888 and see if any errors occur. If non-do then it's fine.

------------------------------------------------------------
Three simple rules:
1. Please use the search bar before making new posts.
2. Kudo posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
Contributor
billybaloop
Posts: 20
Registered: ‎11-15-2010

Re: Image formats on BB

Does net.rim.device.api.system.Bitmap even support RGBA 8888?

The more I work with it, the less I think so. You can't even construct a net.rim.device.api.system.Bitmap using RGBA 8888, you only have the option to use RGB 565. You can configure OpenGL to use RGBA 8888, but I do not think net.rim.device.api.system.Bitmap supports RGBA 8888.

What can I use to load the alpha channel, then?

Please use plain text.
Developer
rcmaniac25
Posts: 1,789
Registered: ‎04-28-2009
My Carrier: Verizon

Re: Image formats on BB

No, Bitmap does not support RGBA8888. It supports RGB565 but if you want alpha you add a seperete "layer" that is 8 bits so basically RGBA5658.

------------------------------------------------------------
Three simple rules:
1. Please use the search bar before making new posts.
2. Kudo posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.