Logo ROOT   6.12/07
Reference Guide
List of all members | Classes | Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
ROOT::Experimental::TColor Class Reference

A color: Red|Green|Blue|Alpha, or a position in a TPalette.

Definition at line 27 of file TColor.hxx.

Classes

struct  Alpha
 
class  AutoTag
 Used to signal that this color shall be automatically chosen by the drawing routines, by picking a color from the TPad's (or rather its TFrame's) current TPalette. More...
 
class  TAlpha
 The alpha value of a color: 0 is completely transparent, 1 is completely opaque. More...
 

Public Types

enum  EKind { EKind::kRGBA, EKind::kPalettePos, EKind::kAuto }
 
using PredefinedRGB = std::array< float, 3 >
 

Public Member Functions

constexpr TColor ()=default
 
constexpr TColor (float r, float g, float b, float alpha)
 Initialize a TColor with red, green, blue and alpha component. More...
 
constexpr TColor (float r, float g, float b, Alpha alpha=kOpaque)
 Initialize a TColor with red, green, blue and alpha component. More...
 
constexpr TColor (const PredefinedRGB &predef)
 Initialize a TColor with red, green, blue and alpha component. More...
 
constexpr TColor (float paletteOrdinal)
 Initialize a TColor with a TPalette ordinal. More...
 
constexpr TColor (AutoTag)
 Constructs an automatically assigned color. Call as TColor col(TColor::kAuto). More...
 
float GetAlpha () const
 For RGBA or auto colors, get the alpha component (0..1). More...
 
float GetBlue () const
 For RGBA or auto colors, get the blue component (0..1). More...
 
float GetGreen () const
 For RGBA or auto colors, get the green component (0..1). More...
 
float GetPaletteOrdinal () const
 If this is an ordinal in a palette, resolve the. More...
 
float GetRed () const
 For RGBA or auto colors, get the red component (0..1). More...
 
bool IsAuto () const
 Determine whether this TColor will be assigned a actual color upon drawing. More...
 
bool IsPaletteOrdinal () const
 Determine whether this TColor is storing an ordinal of a TPalette (in contrast to RGBA). More...
 
bool IsRGBA () const
 Determine whether this TColor is storing RGBA (in contrast to an ordinal of a TPalette). More...
 
void SetAlpha (float a)
 For RGBA or auto colors, set the alpha component. More...
 
void SetAlpha (Alpha a)
 For RGBA or auto colors, set the alpha component. More...
 
void SetBlue (float b)
 For RGBA or auto colors, set the blue component. More...
 
void SetGreen (float g)
 For RGBA or auto colors, set the green component. More...
 
void SetRed (float r)
 For RGBA or auto colors, set the red component. More...
 

Static Public Attributes

static constexpr Alpha kOpaque {1.}
 An opaque color. More...
 
static constexpr Alpha kTransparent {0.}
 A completely transparent color. More...
 
Default colors
static constexpr PredefinedRGB kRed {{1., 0., 0.}}
 
static constexpr PredefinedRGB kGreen {{0., 1., 0.}}
 
static constexpr PredefinedRGB kBlue {{0., 0, 1.}}
 
static constexpr PredefinedRGB kWhite {{1., 1, 1.}}
 
static constexpr PredefinedRGB kBlack {{0., 0., 0.}}
 
static constexpr AutoTag kAuto {}
 

Private Member Functions

bool AssertNotPalettePos () const
 throw an exception if the color isn't specified as kRGBA or kAuto, the two cases where asking for RBGA members makes sense. More...
 

Private Attributes

float fAlpha = 1.
 The "A" in RGBA (0 <= A <= 1). More...
 
float fBlue = 0.
 The "B" in RGBA (0 <= B <= 1). Unused if fKind != kRGBA. More...
 
float fGreen = 0.
 The "G" in RGBA (0 <= G <= 1). Unused if fKind != kRGBA. More...
 
EKind fKind = EKind::kRGBA
 How the color is defined. More...
 
float fRedOrPalettePos = 0.
 The "R" in RGBA (0 <= R <= 1), or the palette pos if fKind is kPalettePos. More...
 

Friends

bool operator== (const TColor &lhs, const TColor &rhs)
 

#include <ROOT/TColor.hxx>

Member Typedef Documentation

◆ PredefinedRGB

using ROOT::Experimental::TColor::PredefinedRGB = std::array<float, 3>

Definition at line 70 of file TColor.hxx.

Member Enumeration Documentation

◆ EKind

Enumerator
kRGBA 

The color is defined as specific RGBA values.

kPalettePos 

The color is defined as a value in the TFrame's TPalette.

kAuto 

The color will be set upon drawing the canvas choosing a TPalatte color, see TColor(Auto_t)

Definition at line 41 of file TColor.hxx.

Constructor & Destructor Documentation

◆ TColor() [1/6]

constexpr ROOT::Experimental::TColor::TColor ( )
default

◆ TColor() [2/6]

constexpr ROOT::Experimental::TColor::TColor ( float  r,
float  g,
float  b,
float  alpha 
)
inline

Initialize a TColor with red, green, blue and alpha component.

Definition at line 76 of file TColor.hxx.

◆ TColor() [3/6]

constexpr ROOT::Experimental::TColor::TColor ( float  r,
float  g,
float  b,
Alpha  alpha = kOpaque 
)
inline

Initialize a TColor with red, green, blue and alpha component.

Definition at line 79 of file TColor.hxx.

◆ TColor() [4/6]

constexpr ROOT::Experimental::TColor::TColor ( const PredefinedRGB predef)
inline

Initialize a TColor with red, green, blue and alpha component.

Definition at line 82 of file TColor.hxx.

◆ TColor() [5/6]

constexpr ROOT::Experimental::TColor::TColor ( float  paletteOrdinal)
inline

Initialize a TColor with a TPalette ordinal.

The actual color is determined from the pad's (or rather its TFrame's) TPalette

Definition at line 86 of file TColor.hxx.

◆ TColor() [6/6]

constexpr ROOT::Experimental::TColor::TColor ( AutoTag  )
inline

Constructs an automatically assigned color. Call as TColor col(TColor::kAuto).

Definition at line 95 of file TColor.hxx.

Member Function Documentation

◆ AssertNotPalettePos()

bool TColor::AssertNotPalettePos ( ) const
private

throw an exception if the color isn't specified as kRGBA or kAuto, the two cases where asking for RBGA members makes sense.

Definition at line 40 of file TColor.cxx.

◆ GetAlpha()

float ROOT::Experimental::TColor::GetAlpha ( ) const
inline

For RGBA or auto colors, get the alpha component (0..1).

Definition at line 147 of file TColor.hxx.

◆ GetBlue()

float ROOT::Experimental::TColor::GetBlue ( ) const
inline

For RGBA or auto colors, get the blue component (0..1).

Definition at line 140 of file TColor.hxx.

◆ GetGreen()

float ROOT::Experimental::TColor::GetGreen ( ) const
inline

For RGBA or auto colors, get the green component (0..1).

Definition at line 133 of file TColor.hxx.

◆ GetPaletteOrdinal()

float TColor::GetPaletteOrdinal ( ) const

If this is an ordinal in a palette, resolve the.

Definition at line 33 of file TColor.cxx.

◆ GetRed()

float ROOT::Experimental::TColor::GetRed ( ) const
inline

For RGBA or auto colors, get the red component (0..1).

Definition at line 126 of file TColor.hxx.

◆ IsAuto()

bool ROOT::Experimental::TColor::IsAuto ( ) const
inline

Determine whether this TColor will be assigned a actual color upon drawing.

Definition at line 104 of file TColor.hxx.

◆ IsPaletteOrdinal()

bool ROOT::Experimental::TColor::IsPaletteOrdinal ( ) const
inline

Determine whether this TColor is storing an ordinal of a TPalette (in contrast to RGBA).

Definition at line 101 of file TColor.hxx.

◆ IsRGBA()

bool ROOT::Experimental::TColor::IsRGBA ( ) const
inline

Determine whether this TColor is storing RGBA (in contrast to an ordinal of a TPalette).

Definition at line 98 of file TColor.hxx.

◆ SetAlpha() [1/2]

void ROOT::Experimental::TColor::SetAlpha ( float  a)
inline

For RGBA or auto colors, set the alpha component.

Definition at line 172 of file TColor.hxx.

◆ SetAlpha() [2/2]

void ROOT::Experimental::TColor::SetAlpha ( Alpha  a)
inline

For RGBA or auto colors, set the alpha component.

Definition at line 178 of file TColor.hxx.

◆ SetBlue()

void ROOT::Experimental::TColor::SetBlue ( float  b)
inline

For RGBA or auto colors, set the blue component.

Definition at line 166 of file TColor.hxx.

◆ SetGreen()

void ROOT::Experimental::TColor::SetGreen ( float  g)
inline

For RGBA or auto colors, set the green component.

Definition at line 160 of file TColor.hxx.

◆ SetRed()

void ROOT::Experimental::TColor::SetRed ( float  r)
inline

For RGBA or auto colors, set the red component.

Definition at line 154 of file TColor.hxx.

Friends And Related Function Documentation

◆ operator==

bool operator== ( const TColor lhs,
const TColor rhs 
)
friend

Definition at line 109 of file TColor.hxx.

Member Data Documentation

◆ fAlpha

float ROOT::Experimental::TColor::fAlpha = 1.
private

The "A" in RGBA (0 <= A <= 1).

Unused if fKind != kRGBA. fAlpha == 0 means so transparent it's invisible, fAlpha == 1 means completely opaque.

Definition at line 60 of file TColor.hxx.

◆ fBlue

float ROOT::Experimental::TColor::fBlue = 0.
private

The "B" in RGBA (0 <= B <= 1). Unused if fKind != kRGBA.

Definition at line 56 of file TColor.hxx.

◆ fGreen

float ROOT::Experimental::TColor::fGreen = 0.
private

The "G" in RGBA (0 <= G <= 1). Unused if fKind != kRGBA.

Definition at line 53 of file TColor.hxx.

◆ fKind

EKind ROOT::Experimental::TColor::fKind = EKind::kRGBA
private

How the color is defined.

Definition at line 63 of file TColor.hxx.

◆ fRedOrPalettePos

float ROOT::Experimental::TColor::fRedOrPalettePos = 0.
private

The "R" in RGBA (0 <= R <= 1), or the palette pos if fKind is kPalettePos.

Definition at line 50 of file TColor.hxx.

◆ kAuto

constexpr TColor::AutoTag TColor::kAuto {}
static

Definition at line 190 of file TColor.hxx.

◆ kBlack

constexpr TColor::PredefinedRGB TColor::kBlack {{0., 0., 0.}}
static

Definition at line 189 of file TColor.hxx.

◆ kBlue

constexpr TColor::PredefinedRGB TColor::kBlue {{0., 0, 1.}}
static

Definition at line 187 of file TColor.hxx.

◆ kGreen

constexpr TColor::PredefinedRGB TColor::kGreen {{0., 1., 0.}}
static

Definition at line 186 of file TColor.hxx.

◆ kOpaque

constexpr TColor::Alpha TColor::kOpaque {1.}
static

An opaque color.

Definition at line 37 of file TColor.hxx.

◆ kRed

constexpr TColor::PredefinedRGB TColor::kRed {{1., 0., 0.}}
static

Definition at line 185 of file TColor.hxx.

◆ kTransparent

constexpr TColor::Alpha TColor::kTransparent {0.}
static

A completely transparent color.

Definition at line 39 of file TColor.hxx.

◆ kWhite

constexpr TColor::PredefinedRGB TColor::kWhite {{1., 1, 1.}}
static

Definition at line 188 of file TColor.hxx.

Libraries for ROOT::Experimental::TColor:
[legend]

The documentation for this class was generated from the following files: