The white alpha blit would just adjust brightness of the image. My apologies. Brain fart.
"Gamma correction is a technique to change the brightness of bitmap pictures in a harmonic way. This is being done by multiplying the image's rgb components (r: red, g: green, b: blue) by a factor that depends on their actual values. For the Gamma correction we use this formula:
value_new = pow (value, 1.0 / factor)
This formula works, if rgb had been normalized. By normalization we mean dividing the values by their maximal possible value."
Some ideas to speed up the gamma filter (Since you NEVER want to be doing floating point divides on the PocketPC in time important areas) would be to create a gamma correction table that stores the processed value based on the original un-normalized original color. With 16 bit graphics you may want to create 2 tables, 1 for green, 1 for red and blue. You could even hard-code this tables values to further speed things up (removes the need to generate the table programmatically).
Here's some code to generate the lookup table
- Code:
for(i = 0; i< 256; i++)
LUT[i] = (unsigned char) (255.0f * pow((i/255.0), gamma));
Edit:
I should note that this table is currently meant for 24 bit RGB colors where each color component has 256 color shades. With 16-bit you'd want to change the 255.0 and 256, etc. Additionally you could speed up the generation of the gamma table through fixed point arithmetic, though I'd test the time this takes before spending time doing so.
How fast this would be I don't know. A lot of PC cards actually have built in Gamma correction... you could always do like Halflife does. When adjusting gamma they run the filter in realtime on an image to the right of the gamma control.