mousetrap v0.2.0
Loading...
Searching...
No Matches
mousetrap::RGBA Struct Reference

color representation in RGBA More...

#include <color.hpp>

Public Member Functions

 RGBA ()=default
 default ctor, initialized as RGBA(0, 0, 0, 0)
 
 RGBA (float r, float g, float b, float a)
 construct
 
 RGBA (glm::vec4)
 construct from mousetrap::Vector4f
 
 operator glm::vec4 () const
 return as mousetrap::Vector4f
 
 RGBA (HSVA)
 convert hsva to rgba
 
 operator HSVA () const
 convert rbga to hsva
 
 operator std::string () const
 serialize
 
bool operator== (const RGBA &other)
 comparison operator
 
bool operator!= (const RGBA &other)
 comparison operator
 

Public Attributes

float r = 0
 red, in [0, 1]
 
float g = 0
 green, in [0, 1]
 
float b = 0
 blue, in [0, 1]
 
float a = 0
 transparency, in [0, 1]
 

Detailed Description

color representation in RGBA

Constructor & Destructor Documentation

◆ RGBA() [1/2]

mousetrap::RGBA::RGBA ( float  r,
float  g,
float  b,
float  a 
)

construct

Parameters
rred value, in [0, 1]
ggreen value, in [0, 1]
bblue value, in [0, 1]
aalpha value, in [0, 1]

◆ RGBA() [2/2]

mousetrap::RGBA::RGBA ( HSVA  hsva)
explicit

convert hsva to rgba

Parameters
hsva

References a, b, g, and r.

Member Function Documentation

◆ operator!=()

bool mousetrap::RGBA::operator!= ( const RGBA other)

comparison operator

Parameters
other
Returns
true if all components do not exaclty equal eachother, false otherwise. This is subject to issues stemming from float precision, consider quantizing the colors before comparison

◆ operator==()

bool mousetrap::RGBA::operator== ( const RGBA other)

comparison operator

Parameters
other
Returns
true if all components exactly equal eachother, false otherwise. This is subject to issues stemming from float precision, consider quantizing the colors before comparison

References a, b, g, and r.


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