The color class.
Definition at line 32 of file RColor.hxx.
Public Member Functions | |
RColor (const RGB_t &rgb) | |
Construct color with provided RGB_t value. More... | |
RColor (int r, int g, int b) | |
Construct color with provided r,g,b values. More... | |
RColor (int r, int g, int b, float alpha) | |
Construct color with provided r,g,b and alpha values. More... | |
std::string | AsSVG () const |
Returns color value as it will be used in SVG drawing It either include hex format #66FF66 or just plain SVG name. More... | |
void | Clear () |
void | ClearAlpha () |
Clear alpha value of the color. More... | |
void | ClearAuto () |
Clear auto flag of the RColor. More... | |
void | ClearName () |
Clear color plain SVG name (if any) More... | |
void | ClearRGB () |
Clear RGB color value (if any) More... | |
float | GetAlpha () const |
Returns color alpha (opacity) as float from 0. More... | |
std::string | GetAlphaHex () const |
Returns color alpha (opacity) as hex string like FF. More... | |
int | GetBlue () const |
Returns blue color component 0..255. More... | |
int | GetGreen () const |
Returns green color component 0..255. More... | |
std::string | GetHex () const |
Return color as hex string like 00FF00. More... | |
bool | GetHLS (float &hue, float &light, float &satur) const |
Return the Hue, Light, Saturation (HLS) definition of this RColor. More... | |
std::string | GetName () const |
Returns color as plain SVG name like "white" or "lightblue". More... | |
int | GetRed () const |
Returns red color component 0..255. More... | |
bool | GetRGB (int &r, int &g, int &b) const |
Decodes hex color value into RGB - each color component as integer from 0 to 255 If color was not specified as hex, method returns false. More... | |
bool | HasAlpha () const |
Returns true if color alpha (opacity) was specified. More... | |
bool | IsAuto () const |
Returns true if color should get auto value when primitive drawing is performed. More... | |
RColor & | SetAlpha (float _alpha) |
Set color alpha (opacity) value - from 0 to 1. More... | |
RColor & | SetAlphaHex (const std::string &_alfa) |
Set color alpha (opacity) value as hex string. More... | |
RColor & | SetAuto (bool on=true) |
Set automatic mode for RColor, will be assigned before primitive painted on the canvas. More... | |
RColor & | SetHex (const std::string &_hex) |
Set color as hex string like 00FF00. More... | |
RColor & | SetHLS (float hue, float light, float satur) |
Set the Red Green and Blue (RGB) values from the Hue, Light, Saturation (HLS). More... | |
RColor & | SetName (const std::string &_name) |
Set color as plain SVG name like "white" or "lightblue". More... | |
RColor & | SetRGB (const RGB_t &rgb) |
Set r/g/b/ components of color as hex code, default for the color. More... | |
RColor & | SetRGB (int r, int g, int b) |
Set r/g/b/ components of color as hex code, default for the color. More... | |
![]() | |
RAttrBase ()=default | |
virtual | ~RAttrBase ()=default |
Static Public Attributes | |
static constexpr RGB_t | kBlack {{0, 0, 0}} |
static constexpr RGB_t | kBlue {{0, 0, 255}} |
static constexpr RGB_t | kGreen {{0, 255, 0}} |
static constexpr double | kOpaque {1.} |
static constexpr RGB_t | kRed {{255, 0, 0}} |
static constexpr double | kTransparent {0.} |
static constexpr RGB_t | kWhite {{255, 255, 255}} |
Private Types | |
using | RGB_t = std::array< int, 3 > |
Private Member Functions | |
int | GetColorComponent (int indx) const |
Decodes color component and returns integer from 0 to 255 Values of indx 0: Red, 1: Green, 2: Blue If color was not specified as hex, method returns 0. More... | |
bool | GetRGBFloat (float &r, float &g, float &b) const |
Decodes hex color value into RGB - each color component as float from 0. More... | |
R__ATTR_CLASS (RColor, "color_", AddString("rgb", "").AddString("a", "").AddString("name", "").AddBool("auto", false)) | |
RColor & | SetRGBFloat (float r, float g, float b) |
Set RGB values as floats, each from 0..1. More... | |
Static Private Member Functions | |
static std::string | toHex (int v) |
Converts integer from 0 to 255 into hex format with two digits like 00. More... | |
Friends | |
bool | operator== (const RColor &lhs, const RColor &rhs) |
Additional Inherited Members | |
![]() | |
RAttrBase (const RAttrBase &src) | |
RAttrBase (RAttrBase *parent, const std::string &prefix) | |
RAttrBase (RDrawable *drawable, const std::string &prefix) | |
const Rec_t | AccessAttr (const std::string &name) const |
Find attributes container and full-qualified name for value. More... | |
const Val_t | AccessValue (const std::string &name, bool use_style=true) const |
void | AssignDrawable (RDrawable *drawable, const std::string &prefix) |
Return value from attributes container - no style or defaults are used. More... | |
void | AssignParent (RAttrBase *parent, const std::string &prefix) |
void | Clear () |
Clear all respective values from drawable. More... | |
void | ClearValue (const std::string &name) |
void | CopyTo (RAttrBase &tgt, bool use_style=true) const |
Copy attributes into target object. More... | |
bool | CopyValue (const std::string &name, const RAttrMap::Value_t &value, bool check_type=true) |
Copy attributes from other object. More... | |
Rec_t | EnsureAttr (const std::string &name) |
Ensure attribute with give name exists - creates container for attributes if required. More... | |
template<typename RET_TYPE , typename MATCH_TYPE = void> | |
auto | Eval (const std::string &name, bool use_dflts=true) const |
Evaluate attribute value. More... | |
virtual const RAttrMap & | GetDefaults () const |
Return default values for attributes, empty for base class. More... | |
const std::string & | GetPrefix () const |
template<typename T > | |
T | GetValue (const std::string &name) const |
template<typename T = void> | |
bool | HasValue (const std::string &name, bool check_defaults=false) const |
bool | IsSame (const RAttrBase &src, bool use_style=true) const |
Check if all values which are evaluated in this object are exactly the same as in tgt object. More... | |
bool | IsValueEqual (const std::string &name, const RAttrMap::Value_t &value, bool use_style=false) const |
Copy attributes into target object. More... | |
RAttrBase & | operator= (const RAttrBase &src) |
void | SetValue (const std::string &name, bool value) |
void | SetValue (const std::string &name, const std::string &value) |
void | SetValue (const std::string &name, double value) |
void | SetValue (const std::string &name, int value) |
#include <ROOT/RColor.hxx>
|
private |
Definition at line 36 of file RColor.hxx.
|
inline |
Construct color with provided r,g,b values.
Definition at line 55 of file RColor.hxx.
|
inline |
Construct color with provided r,g,b and alpha values.
Definition at line 58 of file RColor.hxx.
|
inline |
Construct color with provided RGB_t value.
Definition at line 65 of file RColor.hxx.
|
inline |
Returns color value as it will be used in SVG drawing It either include hex format #66FF66 or just plain SVG name.
Definition at line 163 of file RColor.hxx.
|
inline |
Definition at line 174 of file RColor.hxx.
|
inline |
Clear alpha value of the color.
Definition at line 140 of file RColor.hxx.
|
inline |
Clear auto flag of the RColor.
Definition at line 153 of file RColor.hxx.
|
inline |
Clear color plain SVG name (if any)
Definition at line 112 of file RColor.hxx.
|
inline |
Clear RGB color value (if any)
Definition at line 95 of file RColor.hxx.
|
inline |
|
inline |
Returns color alpha (opacity) as hex string like FF.
Default is empty
Definition at line 124 of file RColor.hxx.
|
inline |
Returns blue color component 0..255.
Definition at line 92 of file RColor.hxx.
|
private |
Decodes color component and returns integer from 0 to 255 Values of indx 0: Red, 1: Green, 2: Blue If color was not specified as hex, method returns 0.
Definition at line 59 of file RColor.cxx.
|
inline |
Returns green color component 0..255.
Definition at line 89 of file RColor.hxx.
|
inline |
Return color as hex string like 00FF00.
Definition at line 81 of file RColor.hxx.
bool RColor::GetHLS | ( | float & | hue, |
float & | light, | ||
float & | satur | ||
) | const |
Return the Hue, Light, Saturation (HLS) definition of this RColor.
Returns the Hue, Light, Saturation (HLS) definition of this RColor If color was not specified as hex, method returns false.
Definition at line 85 of file RColor.cxx.
|
inline |
Returns color as plain SVG name like "white" or "lightblue".
Definition at line 109 of file RColor.hxx.
|
inline |
Returns red color component 0..255.
Definition at line 86 of file RColor.hxx.
bool RColor::GetRGB | ( | int & | r, |
int & | g, | ||
int & | b | ||
) | const |
Decodes hex color value into RGB - each color component as integer from 0 to 255 If color was not specified as hex, method returns false.
Definition at line 42 of file RColor.cxx.
|
private |
Decodes hex color value into RGB - each color component as float from 0.
to 1. If color was not specified as hex, method returns false
Definition at line 70 of file RColor.cxx.
|
inline |
Returns true if color alpha (opacity) was specified.
Definition at line 127 of file RColor.hxx.
|
inline |
Returns true if color should get auto value when primitive drawing is performed.
Definition at line 143 of file RColor.hxx.
|
private |
|
inline |
Set color alpha (opacity) value - from 0 to 1.
Definition at line 130 of file RColor.hxx.
|
inline |
Set color alpha (opacity) value as hex string.
Definition at line 133 of file RColor.hxx.
|
inline |
Set automatic mode for RColor, will be assigned before primitive painted on the canvas.
Definition at line 146 of file RColor.hxx.
|
inline |
Set color as hex string like 00FF00.
Definition at line 74 of file RColor.hxx.
RColor & RColor::SetHLS | ( | float | hue, |
float | light, | ||
float | satur | ||
) |
Set the Red Green and Blue (RGB) values from the Hue, Light, Saturation (HLS).
Set the color value from the Hue, Light, Saturation (HLS).
Definition at line 130 of file RColor.cxx.
|
inline |
Set color as plain SVG name like "white" or "lightblue".
Clears RGB component before
Definition at line 101 of file RColor.hxx.
Set r/g/b/ components of color as hex code, default for the color.
Definition at line 68 of file RColor.hxx.
|
inline |
Set r/g/b/ components of color as hex code, default for the color.
Definition at line 71 of file RColor.hxx.
|
inlineprivate |
Set RGB values as floats, each from 0..1.
Real color values will be stored in hex format
Definition at line 43 of file RColor.hxx.
|
staticprivate |
Converts integer from 0 to 255 into hex format with two digits like 00.
Definition at line 24 of file RColor.cxx.
Definition at line 190 of file RColor.hxx.
|
staticconstexpr |
Definition at line 186 of file RColor.hxx.
|
staticconstexpr |
Definition at line 184 of file RColor.hxx.
|
staticconstexpr |
Definition at line 183 of file RColor.hxx.
|
staticconstexpr |
Definition at line 188 of file RColor.hxx.
|
staticconstexpr |
Definition at line 182 of file RColor.hxx.
|
staticconstexpr |
Definition at line 187 of file RColor.hxx.
|
staticconstexpr |
Definition at line 185 of file RColor.hxx.