library: libCore #include "TColor.h" |
TColor
class description - header file - source file - inheritance tree (.pdf)
private:
void Allocate()
static Float_t HLStoRGB1(Float_t rn1, Float_t rn2, Float_t huei)
public:
TColor()
TColor(Int_t color, Float_t r, Float_t g, Float_t b, const char* name = "", Float_t a = 1)
TColor(const TColor& color)
virtual ~TColor()
const char* AsHexString() const
static TClass* Class()
virtual void Copy(TObject& color) const
Float_t GetAlpha() const
Float_t GetBlue() const
static Int_t GetColor(const char* hexcolor)
static Int_t GetColor(Float_t r, Float_t g, Float_t b)
static Int_t GetColor(Int_t r, Int_t g, Int_t b)
static Int_t GetColor(ULong_t pixel)
virtual Float_t GetGrayscale() const
Float_t GetGreen() const
virtual void GetHLS(Float_t& h, Float_t& l, Float_t& s) const
Float_t GetHue() const
Float_t GetLight() const
Int_t GetNumber() const
ULong_t GetPixel() const
Float_t GetRed() const
virtual void GetRGB(Float_t& r, Float_t& g, Float_t& b) const
Float_t GetSaturation() const
static void HLS2RGB(Float_t h, Float_t l, Float_t s, Float_t& r, Float_t& g, Float_t& b)
static void HLS2RGB(Int_t h, Int_t l, Int_t s, Int_t& r, Int_t& g, Int_t& b)
static void HLStoRGB(Float_t h, Float_t l, Float_t s, Float_t& r, Float_t& g, Float_t& b)
virtual TClass* IsA() const
static Bool_t IsGrayscale()
virtual void ls(Option_t* option = "") const
static ULong_t Number2Pixel(Int_t ci)
TColor& operator=(const TColor&)
static void Pixel2RGB(ULong_t pixel, Int_t& r, Int_t& g, Int_t& b)
static void Pixel2RGB(ULong_t pixel, Float_t& r, Float_t& g, Float_t& b)
static const char* PixelAsHexString(ULong_t pixel)
virtual void Print(Option_t* option = "") const
static void RGB2HLS(Float_t r, Float_t g, Float_t b, Float_t& h, Float_t& l, Float_t& s)
static void RGB2HLS(Int_t r, Int_t g, Int_t b, Int_t& h, Int_t& l, Int_t& s)
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
static ULong_t RGB2Pixel(Float_t r, Float_t g, Float_t b)
static void RGBtoHLS(Float_t r, Float_t g, Float_t b, Float_t& h, Float_t& l, Float_t& s)
static void SaveColor(ostream& out, Int_t ci)
static void SetGrayscale(Bool_t set = kTRUE)
virtual void SetRGB(Float_t r, Float_t g, Float_t b)
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
private:
Int_t fNumber Color number identifier
Float_t fRed Fraction of Red
Float_t fGreen Fraction of Green
Float_t fBlue Fraction of Blue
Float_t fHue Hue
Float_t fLight Light
Float_t fSaturation Saturation
Float_t fAlpha Alpha (transparency)
static Bool_t fgGrayscaleMode if set, GetColor will return grayscale
TColor
Color defined by RGB or HLS.
At initialization time, a table of colors is generated. This linked
list can be accessed from the ROOT object
(see TROOT::GetListOfColors()). When a color is defined in the range
of [1,50], two "companion" colors are also defined:
- the dark version (color_index + 100)
- the bright version (color_index + 150)
The dark and bright color are used to give 3-D effects when drawing
various boxes (see TWbox, TPave, TPaveText, TPaveLabel,etc).
This is the list of currently supported basic colors (here dark and
bright colors are not shown).
One can toggle between a grayscale preview and the regular
colored mode using SetGrayscale(). Note that in grayscale mode,
access via RGB will return grayscale values according to ITU
standards (and close to b&w printer grayscales), while access via
HLS returns de-saturated grayscales.
const char * AsHexString()
Return color as hexidecimal string. This string can be directly passed
to, for example, TGClient::GetColorByName(). String will be reused so
copy immediately if needed.
ULong_t GetPixel()
Return pixel value corresponding to this color. This pixel value can
be used in the GUI classes. This call does not work in batch mode since
it needs to communicate with the graphics system.
void HLS2RGB(Float_t hue, Float_t light, Float_t satur, Float_t &r, Float_t &g, Float_t &b)
Static method to compute RGB from HLS. The l and s are between [0,1]
and h is between [0,360]. The returned r,g,b triplet is between [0,1].
void HLS2RGB(Int_t h, Int_t l, Int_t s, Int_t &r, Int_t &g, Int_t &b)
Static method to compute RGB from HLS. The h,l,s are between [0,255].
The returned r,g,b triplet is between [0,255].
void ls(Option_t *)
List this color with its attributes.
void RGB2HLS(Float_t rr, Float_t gg, Float_t bb, Float_t &hue, Float_t &light, Float_t &satur)
Static method to compute HLS from RGB. The r,g,b triplet is between
[0,1], hue is between [0,360], light and satur are [0,1].
void RGB2HLS(Int_t r, Int_t g, Int_t b, Int_t &h, Int_t &l, Int_t &s)
Static method to compute HLS from RGB. The r,g,b triplet is between
[0,255], hue, light and satur are between [0,255].
void Allocate()
Make this color known to the graphics system.
Int_t GetColor(const char *hexcolor)
Static method returning color number for color specified by
hex color string of form: #rrggbb, where rr, gg and bb are in
hex between [0,FF], e.g. "#c0c0c0".
If specified color does not exist it will be created with as
name "#rrggbb" with rr, gg and bb in hex between [0,FF].
Int_t GetColor(Float_t r, Float_t g, Float_t b)
Static method returning color number for color specified by
r, g and b. The r,g,b should be in the range [0,1].
If specified color does not exist it will be created
with as name "#rrggbb" with rr, gg and bb in hex between
[0,FF].
Int_t GetColor(ULong_t pixel)
Static method returning color number for color specified by
system dependent pixel value. Pixel values can be obtained, e.g.,
from the GUI color picker.
Int_t GetColor(Int_t r, Int_t g, Int_t b)
Static method returning color number for color specified by
r, g and b. The r,g,b should be in the range [0,255].
If the specified color does not exist it will be created
with as name "#rrggbb" with rr, gg and bb in hex between
[0,FF].
ULong_t Number2Pixel(Int_t ci)
Static method that given a color index number, returns the corresponding
pixel value. This pixel value can be used in the GUI classes. This call
does not work in batch mode since it needs to communicate with the
graphics system.
void SaveColor(ostream &out, Int_t ci)
Save a color with index > 228 as a C++ statement(s) on output stream out.
Author: Rene Brun 12/12/94
Last update: root/base:$Name: $:$Id: TColor.cxx,v 1.24 2006/07/03 16:10:43 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.