Color class reference
Specifies the colors in RGBA space. All graphics rendering widgets rely on the data contained in the "Color" objects. The data are stored in floats. A component value of 1.0f means full saturation.
Functions
Functions documentation
Color
(int r, int g, int b, int a);
Constructor that set all components (including transparency) using the int type. A conversion from 'int' in the range of 0-255 is made, which is reflected in 0.0f - 1.0f float.
Color
(float r, float g, float b, float a);
Constructor that set all components (including transparency) using the float type.
Color
(int hexValue = 0xFFFFFF);
Default constructor that set all components (EXCLUDING transparency) using the single 24-bit HEX value. The transparency is set to 0. With default value all color components are fully saturated which translates into a white color.
virtual ~
Color
();
Destructor. In principle, does nothing.
bool operator== (const
Color
& rhs) const;
Comparison operator. Checks whether the objects are identical.
bool operator!= (const
Color
& rhs) const;
Comparison operator. Checks whether the objects are different.
void operator+= (const
Color
& rhs);
Allows to easily add colors. If any component exceed the range (0.0f - 1.0f) it is clamped.
void operator-= (const
Color
& rhs);
Allows to easily subtract colors. If any component exceed the range (0.0f - 1.0f) it is clamped.
void SetOpacity(int a);
Sets the transparency component using the int type. A conversion from 'int' in the range of 0-255 is made, which is reflected in 0.0f - 1.0f float.
void SetOpacity(float a);
Sets the transparency component using the float type.
void SetColor(int r, int g, int b, int a);
Sets all components (including transparency) using the int type. A conversion from 'int' in the range of 0-255 is made, which is reflected in 0.0f - 1.0f float.
void SetColor(float r, float g, float b, float a);
Set all components (including transparency) using the float type.
int GetBrightness();
Returns stored color brightness. The value is in 0-255 range.
void Clamp();
Helper function to clamp components to 0.0f - 1.0f.
glm::vec3 GetVec3();
Returns a glm vector consisting of three (RGB) components corresponding to the stored color.
glm::vec4 GetVec4();
Returns a glm vector consisting of four (RGBA) components corresponding to the stored color.
Variables documentation
float r, g, b, a;
Color component.