Converts an RGB value into a display dependent pixel format.


int makecol32(int r, int g, int b);
These functions convert colors from a hardware independent form (red, green, and blue values ranging 0-255) into various display dependent pixel formats. Converting to 15, 16, 24, or 32-bit formats only takes a few shifts, so it is fairly efficient. Converting to an 8-bit color involves searching the palette to find the closest match, which is quite slow unless you have set up an RGB mapping table (see below). Example:
      /* 16 bit color version of green. */
      int green_color = makecol16(0, 255, 0);
Returns the requested RGB triplet in the specified color depth.
Examples using this:

Related Discussions

The following threads each have code containing this keyword: Note: You can click on the numbers to jump directly to the posts that reference this page.

Related Projects

The following projects include source code containing this keyword: