library: libCore
#include "TColor.h"

TColor


class description - header file - source file
viewCVS header - viewCVS source

class TColor: public TNamed

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
public:
TColor()
TColor(const TColor& color)
TColor(Int_t color, Float_t r, Float_t g, Float_t b, const char* name = "", Float_t a = 1)
virtual~TColor()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
const char*AsHexString() const
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidCopy(TObject& color) const
virtual voidTObject::Delete(Option_t* option = "")
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTObject::Dump() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
Float_tGetAlpha() const
Float_tGetBlue() const
static Int_tGetColor(const char* hexcolor)
static Int_tGetColor(ULong_t pixel)
static Int_tGetColor(Float_t r, Float_t g, Float_t b)
static Int_tGetColor(Int_t r, Int_t g, Int_t b)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual Float_tGetGrayscale() const
Float_tGetGreen() const
virtual voidGetHLS(Float_t& h, Float_t& l, Float_t& s) const
Float_tGetHue() const
virtual const char*TObject::GetIconName() const
Float_tGetLight() const
virtual const char*TNamed::GetName() const
Int_tGetNumber() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
ULong_tGetPixel() const
Float_tGetRed() const
virtual voidGetRGB(Float_t& r, Float_t& g, Float_t& b) const
Float_tGetSaturation() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
static voidHLS2RGB(Float_t h, Float_t l, Float_t s, Float_t& r, Float_t& g, Float_t& b)
static voidHLS2RGB(Int_t h, Int_t l, Int_t s, Int_t& r, Int_t& g, Int_t& b)
static voidHLStoRGB(Float_t h, Float_t l, Float_t s, Float_t& r, Float_t& g, Float_t& b)
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
static Bool_tIsGrayscale()
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static ULong_tNumber2Pixel(Int_t ci)
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TColor&operator=(const TColor&)
virtual voidTObject::Paint(Option_t* option = "")
static voidPixel2RGB(ULong_t pixel, Int_t& r, Int_t& g, Int_t& b)
static voidPixel2RGB(ULong_t pixel, Float_t& r, Float_t& g, Float_t& b)
static const char*PixelAsHexString(ULong_t pixel)
virtual voidTObject::Pop()
virtual voidPrint(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
static voidRGB2HLS(Float_t r, Float_t g, Float_t b, Float_t& h, Float_t& l, Float_t& s)
static voidRGB2HLS(Int_t r, Int_t g, Int_t b, Int_t& h, Int_t& l, Int_t& s)
static ULong_tRGB2Pixel(Int_t r, Int_t g, Int_t b)
static ULong_tRGB2Pixel(Float_t r, Float_t g, Float_t b)
static voidRGBtoHLS(Float_t r, Float_t g, Float_t b, Float_t& h, Float_t& l, Float_t& s)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
static voidSaveColor(ostream& out, Int_t ci)
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
static voidSetGrayscale(Bool_t set = kTRUE)
virtual voidTNamed::SetName(const char* name)
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetRGB(Float_t r, Float_t g, Float_t b)
virtual voidTNamed::SetTitle(const char* title = "")
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()
private:
voidAllocate()
static Float_tHLStoRGB1(Float_t rn1, Float_t rn2, Float_t huei)

Data Members

public:
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title
private:
Int_tfNumberColor number identifier
Float_tfRedFraction of Red
Float_tfGreenFraction of Green
Float_tfBlueFraction of Blue
Float_tfHueHue
Float_tfLightLight
Float_tfSaturationSaturation
Float_tfAlphaAlpha (transparency)
static Bool_tfgGrayscaleModeif set, GetColor will return grayscale

Class Description

                                                                      
 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.                                 
                                                                      

TColor()
 Default ctor.
TColor(Int_t color, Float_t r, Float_t g, Float_t b, const char *name, Float_t a)
 Normal color constructor. Initialize a color structure.
 Compute the RGB and HLS parameters
~TColor()
 Color destructor.
TColor(const TColor &color)
 Color copy ctor.
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.
void Copy(TObject &obj)
 Copy this color to obj.
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].
Float_t HLStoRGB1(Float_t rn1, Float_t rn2, Float_t huei)
 Static method. Auxiliary to HLS2RGB().
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 Print(Option_t *)
 Dump 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 SetRGB(Float_t r, Float_t g, Float_t b)
 Initialize this color and its associated colors.
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.
ULong_t RGB2Pixel(Float_t r, Float_t g, Float_t b)
 Convert r,g,b to graphics system dependent pixel value.
 The r,g,b triplet must be [0,1].
ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
 Convert r,g,b to graphics system dependent pixel value.
 The r,g,b triplet must be [0,255].
void Pixel2RGB(ULong_t pixel, Float_t &r, Float_t &g, Float_t &b)
 Convert machine dependent pixel value (obtained via RGB2Pixel or
 via Number2Pixel() or via TColor::GetPixel()) to r,g,b triplet.
 The r,g,b triplet will be [0,1].
void Pixel2RGB(ULong_t pixel, Int_t &r, Int_t &g, Int_t &b)
 Convert machine dependent pixel value (obtained via RGB2Pixel or
 via Number2Pixel() or via TColor::GetPixel()) to r,g,b triplet.
 The r,g,b triplet will be [0,255].
const char * PixelAsHexString(ULong_t pixel)
 Convert machine dependent pixel value (obtained via RGB2Pixel or
 via Number2Pixel() or via TColor::GetPixel()) to a hexidecimal string.
 This string can be directly passed to, for example,
 TGClient::GetColorByName(). String will be reused so copy immediately
 if needed.
void SaveColor(ostream &out, Int_t ci)
 Save a color with index > 228 as a C++ statement(s) on output stream out.
Bool_t IsGrayscale()
 Return whether all colors return grayscale values
void SetGrayscale(Bool_t set /*= kTRUE*/)
 Set whether all colors should return grayscale values
void GetRGB(Float_t &r, Float_t &g, Float_t &b)
{ r=GetRed(); g=GetGreen(); b=GetBlue(); }
void GetHLS(Float_t &h, Float_t &l, Float_t &s)
{ h=GetHue(); l=GetLight(); s=GetSaturation(); }
Int_t GetNumber()
{ return fNumber; }
Float_t GetRed()
{ return IsGrayscale() ? GetGrayscale() : fRed; }
Float_t GetGreen()
{ return IsGrayscale() ? GetGrayscale() : fGreen; }
Float_t GetBlue()
{ return IsGrayscale() ? GetGrayscale() : fBlue; }
Float_t GetHue()
{ return fHue; }
Float_t GetLight()
{ return fLight; }
Float_t GetSaturation()
{ return IsGrayscale() ? 0 : fSaturation; }
Float_t GetAlpha()
{ return fAlpha; }
Float_t GetGrayscale()
{ /*ITU*/ return 0.299*fRed + 0.587*fGreen + 0.114*fBlue; }
void HLStoRGB(Float_t h, Float_t l, Float_t s, Float_t &r, Float_t &g, Float_t &b)
{ TColor::HLS2RGB(h, l, s, r, g, b); }
void RGBtoHLS(Float_t r, Float_t g, Float_t b, Float_t &h, Float_t &l, Float_t &s)
{ TColor::RGB2HLS(r, g, b, h, l, s); }

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.