Hi,
I need to know how to extract the red, green, and blue values from a short (16-bit color). Can anybody tell me?
You do that with those binary operators.
Well, no one can tell you how to do that exactly, because you omit the format details. There are alot of 16bit kinds like: 5-6-5, 5-5-5, 5-5-5-1, 4-4-4-4…
edit:
eg a RGBA int is ripped appart like this:
int pixel = gpixels[x+y*w];
int alpha = pixel & 0xff000000;
int red = pixel & 0x00ff0000;
int green = pixel & 0x0000ff00;
int blue = pixel & 0x000000ff;
Thanks. I’m using RGB 5-6-5.
Ha, in good old software-renderer, assembly times there have been a lot of ticks to deal with 16bit color values.
I’m afraid that black art is lost for all times meanwhile…