35#ifndef _CHOMP_BITMAPS_COLORPAL_H_
36#define _CHOMP_BITMAPS_COLORPAL_H_
56 ColorPalette (
int _n,
bool grays =
false,
bool pycolors =
false);
90 while (mask && bitMask)
97 return (result - 1) & 0xFF;
109 for (
int i = 0; i <
n; ++ i)
111 int shade = i * 255 /
n;
112 colors [i] = shade | (shade << 8) | (shade << 16);
118 const int niceCountPrevious = 14;
119 const int niceColorsPrevious [niceCountPrevious] = {
120 0x000000, 0x0000FF, 0xFF0000, 0x00FF00,
121 0x00FFFF, 0xFF00FF, 0x7F007F, 0xFF7F00,
122 0x007F00, 0x7F7F7F, 0xAFAFAF, 0x00007F,
128 const int niceCountPython = 44;
129 const int niceColorsPython [niceCountPython] = {
130 0x1F77B4, 0x2CA02C, 0x9467BD, 0x8C564B,
131 0xE377C2, 0x7F7F7F, 0x17BECF, 0xBCBD22,
132 0xFF7F0E, 0xD62728, 0x1B9E77, 0xFFD92F,
133 0x5254A3, 0x637939, 0x8C6D31, 0xBD9E39,
134 0xE7BA52, 0xE7CB94, 0x9C9ED3, 0x8CA252,
135 0x6B6ECF, 0xB5CF8B, 0xCEDB9C, 0xD6616B,
136 0xE7969C, 0xA55194, 0xDE9ED6, 0x6BAED6,
137 0x9ECAE1, 0xE65503, 0xFDAE6B, 0x74C476,
138 0xA1D99B, 0x756BB1, 0x9E9AC8, 0xBCBDDC,
139 0x636363, 0x909090, 0xC7C7C7, 0x843C39,
140 0x7B4173, 0xCE6DBD, 0xAD494A, 0x393B79,
143 int niceCount = pycolors ? niceCountPython : niceCountPrevious;
152 colors [pos] = (pycolors ? niceColorsPython :
153 niceColorsPrevious) [pos];
162 int color = (red << 16) | (green << 8) | blue;
165 bool repeated =
false;
166 for (
int i = 0; i < pos; ++ i)
176 if (!repeated && (color != 0xFFFFFF) && (color != 0xFFFF7F))
203 if ((i < 0) || (i >=
n))
Provides a palette of distinct RGB colors.
static int generateComponent(int bitMask)
Generates a color component based on the bit mask.
int * colors
The RBG colors in the palette.
ColorPalette(int _n, bool grays=false, bool pycolors=false)
The constructor of a palette of a prescribed size.
int operator[](int i) const
Returns the color with the given number.
~ColorPalette()
The destructor.
ColorPalette & operator=(const ColorPalette &src)
The assignment operator is not allowed.
int n
The number of colors in the palette.
This file contains some precompiler definitions which indicate the operating system and/or compiler u...
This namespace contains the entire CHomP library interface.