Convert 8 bit values to 32 bit
Author |
Message |
crossley7
|
Posted: Mon May 02, 2011 8:17 pm Post subject: Convert 8 bit values to 32 bit |
|
|
I'm using Dev C++ with the G++ compiler. I am trying to create a program that reads in a bmp and converts the pixel colours to the opposite ie black becomes white.
code: |
Uint8 r,g,b,a;
Uint32 pixel = get_pixel32( surface, x, y );
SDL_GetRGBA (pixel, surface->format, &r, &g, &b, &a);
r = (Uint8)255 - r;
g = (Uint8)255 - g;
b = (Uint8)255 - b;
a = (Uint8)255 - a;
pixel =(Uint8)r*1000000+(Uint8)b*10000+(Uint8)g*100+(Uint8)a;
|
I know that the last line is horribly wrong, but I have no idea as to what it should actually be. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
|
|
|
|
Raknarg
|
|
|
|
|
crossley7
|
Posted: Mon May 02, 2011 8:36 pm Post subject: RE:Convert 8 bit values to 32 bit |
|
|
Thanks, that is a lot of help, but I'm not sure how to implement it, but will keep working on it to see if i can figure it out |
|
|
|
|
|
|
|