Created
September 17, 2014 18:20
-
-
Save mlabbe/fecb713316a006735d2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ImgPremultiply( void ) | |
{ | |
Assert( surface[0].GetNumChannels() == 4 ); | |
Uint8 *channels = surface[0].GetChannels(); | |
for ( Uint32 i = 0; i < surface[0].GetPixelCount(); ++i ) | |
{ | |
Uint8 *p = &(channels[i*4]); | |
p[0] = Uint8(p[0] * (p[3] / 255.0f)); | |
p[1] = Uint8(p[1] * (p[3] / 255.0f)); | |
p[2] = Uint8(p[2] * (p[3] / 255.0f)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment