24bool HexCharToInt(
char symbol,
unsigned &val)
26 if (symbol >=
'0' && symbol <=
'9') {
61 if (!HexCharToInt(rgb[
first], val)) {
62 ::Error(
"ROOT::MacOSX::X11::GetGex",
63 "Bad symbol in color component, hex digit expected, got %c", rgb[
first]);
66 component = (component << 4) | val;
78 if (colorName[0] ==
'#')
92 if (len < 4 || len > 13 || (len - 1) % 3) {
94 ::Error(
"ROOT::MacOSX::X11::ParseRGBTriplet",
95 "Bad color name or rgb triplet %s", rgb.
Data());
102 const Ssiz_t compLen = (len - 1) / 3;
103 unsigned r = 0,
g = 0,
b = 0;
104 if (GetHex(rgb, 1, compLen,
r) && GetHex(rgb, 1 + compLen, compLen,
g) &&
105 GetHex(rgb, 1 + compLen * 2, compLen,
b))
111 const unsigned bitPad = 16 - compLen * 4;
112 color.
fRed =
r << bitPad;
114 color.
fBlue =
b << bitPad;
125 TString lowerCaseName(colorName);
132 color.
fRed = it->second.fRed * 0xFFFF / 0xFF;
133 color.
fGreen = it->second.fGreen * 0xFFFF / 0xFF;
134 color.
fBlue = it->second.fBlue * 0xFFFF / 0xFF;
138 ::Error(
"ROOT::MacOSX::X11::ColorParser::LookupColorByName",
139 "Could not find color with name %s", colorName.
Data());
590 fX11RGB[
"light goldenrod yellow"] =
RGB_t(250, 250, 210);
913 tmpMap.insert(std::make_pair(key, iter->second));
922 rgb[0] = (pixelColor >> 16 & 0xff) / 255.;
923 rgb[1] = (pixelColor >> 8 & 0xff) / 255.;
924 rgb[2] = (pixelColor & 0xff) / 255.;
931 rgb[0] = pixelColor >> 16 & 0xff;
932 rgb[1] = pixelColor >> 8 & 0xff;
933 rgb[2] = pixelColor & 0xff;
ULong_t Pixel_t
Pixel value.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
bool ParseRGBTriplet(const TString &rgb, ColorStruct_t &color) const
std::map< TString, RGB_t > fX11RGB
rgb_map::const_iterator const_rgb_iterator
bool LookupColorByName(const TString &colorName, ColorStruct_t &color) const
std::map< TString, RGB_t > rgb_map
bool ParseColor(const TString &colorString, ColorStruct_t &color) const
void ToLower()
Change string to lower-case.
const char * Data() const
void PixelToRGB(Pixel_t pixelColor, CGFloat *rgb)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
ULong_t fPixel
color pixel value (index in color table)
UShort_t fRed
red component (0..65535)
UShort_t fGreen
green component (0..65535)
UShort_t fBlue
blue component (0..65535)