Logo ROOT   6.18/05
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::RColor Class Reference

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

Definition at line 28 of file RColor.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 RPad's (or rather its RFrame's) current RPalette. More...
 

Public Types

enum class  EKind { kRGBA , kPalettePos , kAuto }
 
using RGBA = std::array< float, 4 >
 

Public Member Functions

constexpr RColor ()=default
 
constexpr RColor (AutoTag)
 Constructs an automatically assigned color. Call as RColor col(RColor::kAuto). More...
 
constexpr RColor (const RGBA &rgba)
 Initialize a RColor with red, green, blue and alpha component as an array. More...
 
constexpr RColor (float paletteOrdinal)
 Initialize a RColor with a RPalette ordinal. More...
 
constexpr RColor (float r, float g, float b, Alpha alpha=kOpaque)
 Initialize a RColor with red, green, blue and alpha component. More...
 
constexpr RColor (float r, float g, float b, float alpha)
 Initialize a RColor with red, green, blue and alpha component. 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...
 
void GetHLS (float &hue, float &light, float &satur)
 Return the Hue, Light, Saturation (HLS) definition of this RColor. 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 RColor will be assigned a actual color upon drawing. More...
 
bool IsPaletteOrdinal () const
 Determine whether this RColor is storing an ordinal of a RPalette (in contrast to RGBA). More...
 
bool IsRGBA () const
 Determine whether this RColor is storing RGBA (in contrast to an ordinal of a RPalette). More...
 
void SetAlpha (Alpha a)
 For RGBA or auto colors, set the alpha component. More...
 
void SetAlpha (float 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...
 
void SetRGBFromHLS (float hue, float light, float satur)
 Set the Red Green and Blue (RGB) values from the Hue, Light, Saturation (HLS). 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 RGBA kRed {{1., 0., 0., 1.}}
 
static constexpr RGBA kGreen {{0., 1., 0., 1.}}
 
static constexpr RGBA kBlue {{0., 0, 1., 1.}}
 
static constexpr RGBA kWhite {{1., 1, 1., 1.}}
 
static constexpr RGBA kBlack {{0., 0., 0., 1.}}
 
static constexpr RGBA kInvisible {{0., 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 RColor &lhs, const RColor &rhs)
 

#include <ROOT/RColor.hxx>

Member Typedef Documentation

◆ RGBA

using ROOT::Experimental::RColor::RGBA = std::array<float, 4>

Definition at line 71 of file RColor.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 RFrame's RPalette.

kAuto 

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

Definition at line 42 of file RColor.hxx.

Constructor & Destructor Documentation

◆ RColor() [1/6]

constexpr ROOT::Experimental::RColor::RColor ( )
constexprdefault

◆ RColor() [2/6]

constexpr ROOT::Experimental::RColor::RColor ( float  r,
float  g,
float  b,
float  alpha 
)
inlineconstexpr

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

Definition at line 77 of file RColor.hxx.

◆ RColor() [3/6]

constexpr ROOT::Experimental::RColor::RColor ( float  r,
float  g,
float  b,
Alpha  alpha = kOpaque 
)
inlineconstexpr

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

Definition at line 80 of file RColor.hxx.

◆ RColor() [4/6]

constexpr ROOT::Experimental::RColor::RColor ( const RGBA rgba)
inlineconstexpr

Initialize a RColor with red, green, blue and alpha component as an array.

Definition at line 83 of file RColor.hxx.

◆ RColor() [5/6]

constexpr ROOT::Experimental::RColor::RColor ( float  paletteOrdinal)
inlineconstexpr

Initialize a RColor with a RPalette ordinal.

The actual color is determined from the pad's (or rather its RFrame's) RPalette

Definition at line 87 of file RColor.hxx.

◆ RColor() [6/6]

constexpr ROOT::Experimental::RColor::RColor ( AutoTag  )
inlineconstexpr

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

Definition at line 96 of file RColor.hxx.

Member Function Documentation

◆ AssertNotPalettePos()

bool RColor::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 49 of file RColor.cxx.

◆ GetAlpha()

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

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

Definition at line 148 of file RColor.hxx.

◆ GetBlue()

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

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

Definition at line 141 of file RColor.hxx.

◆ GetGreen()

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

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

Definition at line 134 of file RColor.hxx.

◆ GetHLS()

void ROOT::Experimental::RColor::GetHLS ( float &  hue,
float &  light,
float &  satur 
)
inline

Return the Hue, Light, Saturation (HLS) definition of this RColor.

Definition at line 185 of file RColor.hxx.

◆ GetPaletteOrdinal()

float RColor::GetPaletteOrdinal ( ) const

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

Definition at line 42 of file RColor.cxx.

◆ GetRed()

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

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

Definition at line 127 of file RColor.hxx.

◆ IsAuto()

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

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

Definition at line 105 of file RColor.hxx.

◆ IsPaletteOrdinal()

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

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

Definition at line 102 of file RColor.hxx.

◆ IsRGBA()

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

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

Definition at line 99 of file RColor.hxx.

◆ SetAlpha() [1/2]

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

For RGBA or auto colors, set the alpha component.

Definition at line 179 of file RColor.hxx.

◆ SetAlpha() [2/2]

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

For RGBA or auto colors, set the alpha component.

Definition at line 173 of file RColor.hxx.

◆ SetBlue()

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

For RGBA or auto colors, set the blue component.

Definition at line 167 of file RColor.hxx.

◆ SetGreen()

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

For RGBA or auto colors, set the green component.

Definition at line 161 of file RColor.hxx.

◆ SetRed()

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

For RGBA or auto colors, set the red component.

Definition at line 155 of file RColor.hxx.

◆ SetRGBFromHLS()

void ROOT::Experimental::RColor::SetRGBFromHLS ( float  hue,
float  light,
float  satur 
)
inline

Set the Red Green and Blue (RGB) values from the Hue, Light, Saturation (HLS).

Definition at line 223 of file RColor.hxx.

Friends And Related Function Documentation

◆ operator==

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

Definition at line 110 of file RColor.hxx.

Member Data Documentation

◆ fAlpha

float ROOT::Experimental::RColor::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 61 of file RColor.hxx.

◆ fBlue

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

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

Definition at line 57 of file RColor.hxx.

◆ fGreen

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

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

Definition at line 54 of file RColor.hxx.

◆ fKind

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

How the color is defined.

Definition at line 64 of file RColor.hxx.

◆ fRedOrPalettePos

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

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

Definition at line 51 of file RColor.hxx.

◆ kAuto

constexpr RColor::AutoTag RColor::kAuto {}
staticconstexpr

Definition at line 260 of file RColor.hxx.

◆ kBlack

constexpr RColor::RGBA RColor::kBlack {{0., 0., 0., 1.}}
staticconstexpr

Definition at line 258 of file RColor.hxx.

◆ kBlue

constexpr RColor::RGBA RColor::kBlue {{0., 0, 1., 1.}}
staticconstexpr

Definition at line 256 of file RColor.hxx.

◆ kGreen

constexpr RColor::RGBA RColor::kGreen {{0., 1., 0., 1.}}
staticconstexpr

Definition at line 255 of file RColor.hxx.

◆ kInvisible

constexpr RColor::RGBA RColor::kInvisible {{0., 0., 0., 0.}}
staticconstexpr

Definition at line 259 of file RColor.hxx.

◆ kOpaque

constexpr RColor::Alpha RColor::kOpaque {1.}
staticconstexpr

An opaque color.

Definition at line 38 of file RColor.hxx.

◆ kRed

constexpr RColor::RGBA RColor::kRed {{1., 0., 0., 1.}}
staticconstexpr

Definition at line 254 of file RColor.hxx.

◆ kTransparent

constexpr RColor::Alpha RColor::kTransparent {0.}
staticconstexpr

A completely transparent color.

Definition at line 40 of file RColor.hxx.

◆ kWhite

constexpr RColor::RGBA RColor::kWhite {{1., 1, 1., 1.}}
staticconstexpr

Definition at line 257 of file RColor.hxx.

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

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