Logo ROOT   6.08/07
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 #ifndef ROOT_GuiTypes
28 #include "GuiTypes.h"
29 #endif
30 #ifndef ROOT_TString
31 #include "TString.h"
32 #endif
33 
34 namespace ROOT {
35 namespace MacOSX {
36 namespace X11 {
37 
38 class ColorParser {
39 public:
40  ColorParser();
41 
42  bool ParseColor(const TString &colorString, ColorStruct_t &color)const;
43 
44 private:
45  bool ParseRGBTriplet(const TString &rgb, ColorStruct_t &color)const;
46  bool LookupColorByName(const TString &colorName, ColorStruct_t &color)const;
47 
48  struct RGB_t {
50  : fRed(0), fGreen(0), fBlue(0)
51  {
52  }
53  RGB_t(unsigned r, unsigned g, unsigned b)
54  : fRed(r), fGreen(g), fBlue(b)
55  {
56  }
57  unsigned fRed;
58  unsigned fGreen;
59  unsigned fBlue;
60  };
61 
62  std::map<TString, RGB_t> fX11RGB;//X11's rgb.txt
63  typedef std::map<TString, RGB_t> rgb_map;
64  typedef rgb_map::const_iterator const_rgb_iterator;
65 };
66 
67 void PixelToRGB(Pixel_t pixelColor, CGFloat *rgb);
68 void PixelToRGB(Pixel_t pixelColor, unsigned char *rgb);
69 
70 }//X11
71 }//MacOSX
72 }//ROOT
73 
74 #endif
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
Basic string class.
Definition: TString.h:137
RGB_t(unsigned r, unsigned g, unsigned b)
Definition: X11Colors.h:53
ULong_t Pixel_t
Definition: GuiTypes.h:41
rgb_map::const_iterator const_rgb_iterator
Definition: X11Colors.h:64
bool ParseColor(const TString &colorString, ColorStruct_t &color) const
Definition: X11Colors.mm:75
bool ParseRGBTriplet(const TString &rgb, ColorStruct_t &color) const
Definition: X11Colors.mm:88
TRandom2 r(17)
std::map< TString, RGB_t > fX11RGB
Definition: X11Colors.h:62
void PixelToRGB(Pixel_t pixelColor, CGFloat *rgb)
Definition: X11Colors.mm:920
std::map< TString, RGB_t > rgb_map
Definition: X11Colors.h:63
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
Definition: TRolke.cxx:630
bool LookupColorByName(const TString &colorName, ColorStruct_t &color) const
Definition: X11Colors.mm:123