Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Animate Palette
Message
From
08/08/2000 08:16:33
 
 
To
08/08/2000 07:12:57
General information
Forum:
Visual C++
Category:
Other
Title:
Miscellaneous
Thread ID:
00402135
Message ID:
00402148
Views:
14
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
Map
View

Click here to load this message in the networking platform