Separating bitmap color channels?

Started by
-1 comments, last by Klankster 11 years, 5 months ago
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!

This topic is closed to new replies.

Advertisement