Only color depths 256 or below have a palette. To do what you want to do you would need to use CLUT's (colour lookup tables) to alter the appearance of each pixel.
unsigned int EncodeRGB(int r, int g, int b, int BPP)
{
unsigned int pixel;
switch(BPP)
{
case 8:
// You could do a palette lookup here.
break;
case 16:
// This is for 5-6-5 format.
pixel = ((r / 8) << 11) | ((g / 4) << 5) | (b / 8);
break;
case 24:
case 32:
pixel = (r << 16) | (g << 8) | (b);
break;
default:
pixel = 0;
}
return pixel;
}
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only