Logo ROOT  
Reference Guide
X11Colors.h
Go to the documentation of this file.
1 // @(#)root/graf2d:$Id$
2 // Author: Timur Pocheptsov 28/11/2011
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2012, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_X11Colors
13 #define ROOT_X11Colors
14 
15 /////////////////////////////////////////////////////////////////
16 // //
17 // ROOT's GUI depends and relies on X11 XParseColors. //
18 // Color can be specified by name (found in X11 rgb.txt) //
19 // or as RGB triplet: #rgb #rrggbb #rrrgggbbb #rrrrggggbbbb. //
20 // //
21 /////////////////////////////////////////////////////////////////
22 
23 #include <map>
24 
25 #include <ApplicationServices/ApplicationServices.h>
26 
27 #include "GuiTypes.h"
28 #include "TString.h"
29 
30 namespace ROOT {
31 namespace MacOSX {
32 namespace X11 {
33 
34 class ColorParser {
35 public:
36  ColorParser();
37 
38  bool ParseColor(const TString &colorString, ColorStruct_t &color)const;
39 
40 private:
41  bool ParseRGBTriplet(const TString &rgb, ColorStruct_t &color)const;
42  bool LookupColorByName(const TString &colorName, ColorStruct_t &color)const;
43 
44  struct RGB_t {
46  : fRed(0), fGreen(0), fBlue(0)
47  {
48  }
49  RGB_t(unsigned r, unsigned g, unsigned b)
50  : fRed(r), fGreen(g), fBlue(b)
51  {
52  }
53  unsigned fRed;
54  unsigned fGreen;
55  unsigned fBlue;
56  };
57 
58  std::map<TString, RGB_t> fX11RGB;//X11's rgb.txt
59  typedef std::map<TString, RGB_t> rgb_map;
60  typedef rgb_map::const_iterator const_rgb_iterator;
61 };
62 
63 void PixelToRGB(Pixel_t pixelColor, CGFloat *rgb);
64 void PixelToRGB(Pixel_t pixelColor, unsigned char *rgb);
65 
66 }//X11
67 }//MacOSX
68 }//ROOT
69 
70 #endif
ROOT::MacOSX::X11::ColorParser::RGB_t::RGB_t
RGB_t()
Definition: X11Colors.h:45
ROOT::MacOSX::X11::ColorParser::fX11RGB
std::map< TString, RGB_t > fX11RGB
Definition: X11Colors.h:58
ROOT::MacOSX::X11::ColorParser::RGB_t::fBlue
unsigned fBlue
Definition: X11Colors.h:55
ROOT::MacOSX::X11::ColorParser::LookupColorByName
bool LookupColorByName(const TString &colorName, ColorStruct_t &color) const
Definition: X11Colors.mm:123
ROOT::MacOSX::X11::ColorParser::RGB_t
Definition: X11Colors.h:44
ColorStruct_t
Definition: GuiTypes.h:310
Pixel_t
ULong_t Pixel_t
Pixel value.
Definition: GuiTypes.h:40
r
ROOT::R::TRInterface & r
Definition: Object.C:4
ROOT::MacOSX::X11::ColorParser::RGB_t::RGB_t
RGB_t(unsigned r, unsigned g, unsigned b)
Definition: X11Colors.h:49
ROOT::MacOSX::X11::ColorParser::ParseRGBTriplet
bool ParseRGBTriplet(const TString &rgb, ColorStruct_t &color) const
Definition: X11Colors.mm:88
TString
Basic string class.
Definition: TString.h:136
b
#define b(i)
Definition: RSha256.hxx:100
TString.h
ROOT::MacOSX::X11::ColorParser::ColorParser
ColorParser()
Definition: X11Colors.mm:145
ROOT::MacOSX::X11::ColorParser::ParseColor
bool ParseColor(const TString &colorString, ColorStruct_t &color) const
Definition: X11Colors.mm:75
GuiTypes.h
ROOT::MacOSX::X11::ColorParser::RGB_t::fRed
unsigned fRed
Definition: X11Colors.h:53
ROOT::MacOSX::X11::ColorParser::const_rgb_iterator
rgb_map::const_iterator const_rgb_iterator
Definition: X11Colors.h:60
ROOT::MacOSX::X11::ColorParser::rgb_map
std::map< TString, RGB_t > rgb_map
Definition: X11Colors.h:59
ROOT::MacOSX::X11::ColorParser
Definition: X11Colors.h:34
ROOT::MacOSX::X11::PixelToRGB
void PixelToRGB(Pixel_t pixelColor, CGFloat *rgb)
Definition: X11Colors.mm:920
ROOT::MacOSX::X11::ColorParser::RGB_t::fGreen
unsigned fGreen
Definition: X11Colors.h:54
ROOT
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: EExecutionPolicy.hxx:4
ROOT::MacOSX::X11
Definition: CocoaGuiTypes.h:10
g
#define g(i)
Definition: RSha256.hxx:105