Created
May 18, 2010 10:26
-
-
Save pkrumins/404855 to your computer and use it in GitHub Desktop.
This file contains 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
unsigned char * | |
rgba_to_rgb(unsigned char *rgba, int rgba_size) | |
{ | |
int rgb_size = rgba_size/4*3; | |
unsigned char *rgb = malloc(sizeof(unsigned char)*rgb_size); | |
if (!rgb) return NULL; | |
int i, j; | |
for (i=0,j=0;i<rgba_size;i+=4,j+=3) { | |
rgb[j] = *(rgba+i); | |
rgb[j+1] = *(rgba+i+1); | |
rgb[j+2] = *(rgba+i+2); | |
} | |
return rgb; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment