Jump to content
  • Advertisement
Sign in to follow this  

Separating bitmap color channels?

This topic is 2220 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Using OpenGL ES 1.x, I have some bitmapped graphics that really only need one 8-bit color channel (256 levels) and I want to be able to draw them to the display in any color I want. For example, right now they're RGB images colored white, and I draw them with a color mask to get them on ths display in the appropriate color -- mostly I use this for text.

Having these loaded into 3-channel (RGB) 24-bit bitmaps is very wasteful -- it uses 3x the memory it really needs to. Is there a way to load these in as single-channel bitmaps (1 byte per pixel) and then when they're drawn, have them use the desired color?

Alternatively, is there a way to use, say, just the red channel out of a source bitmap and then draw it to the screen in any desired color? My thought here is that I could get triple-duty out of a loaded bitmap, with separate 8-bit images loaded into each of the R, G and B channels -- and then when I want to use those bitmaps, I'd just use one of the channels as a source then draw it in the desired color. Again, this would save memory because three of these 8-bit bitmaps would fit into a 24-bit loaded bitmap. Is there a way to pull this off? Some of these bitmaps are pretty large and use a lot of memory and I'd like to reduce the memory footprint.

I hope this makes sense to you, and I'd appreciate some tips or suggestions. Thanks!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!