libvisual  0.5.0
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
LV::Color Struct Reference

Public Member Functions

 Color ()
 Creates a new Color object. More...
 
 Color (uint8_t r_, uint8_t g_, uint8_t b_, uint8_t a_=255)
 Creates a new Color object with the given channel values. More...
 
void set (uint8_t r_, uint8_t g_, uint8_t b_, uint8_t a_=255)
 Assigns a color from a set of RGBA values. More...
 
void set_hsv (float h, float s, float v)
 Assigns a color given in HSV colorspace. More...
 
void get_hsv (float &h, float &s, float &v) const
 Converts the current color to the HSV colorspace. More...
 
void set_from_uint16 (uint16_t rgb)
 
void set_from_uint32 (uint32_t rgba)
 
uint32_t to_uint32 () const
 
uint16_t to_uint16 () const
 

Static Public Member Functions

static Color const & white ()
 
static Color const & black ()
 

Public Attributes

uint8_t r
 Red channel.
 
uint8_t g
 Green channel.
 
uint8_t b
 Blue channel.
 
uint8_t a
 Alpha channel.
 

Friends

bool operator== (Color const &c1, Color const &c2)
 Equality operator for comparing two Color objects. More...
 

Detailed Description

Definition at line 38 of file lv_color.h.

Constructor & Destructor Documentation

LV::Color::Color ( )
inline

Creates a new Color object.

All channels are set to 0.

Definition at line 48 of file lv_color.h.

LV::Color::Color ( uint8_t  r_,
uint8_t  g_,
uint8_t  b_,
uint8_t  a_ = 255 
)
inline

Creates a new Color object with the given channel values.

Parameters
rred
ggreen
bblue
aalpha

Definition at line 60 of file lv_color.h.

Member Function Documentation

void LV::Color::get_hsv ( float &  h,
float &  s,
float &  v 
) const

Converts the current color to the HSV colorspace.

Parameters
hVariable to store the Hue value in (values will be in [0, 360]
sVariable to store the Saturation value in (values will be in [0, 1]
vVariable to store the Value value in (values will be in [0, 1]

Definition at line 75 of file lv_color.cpp.

void LV::Color::set ( uint8_t  r_,
uint8_t  g_,
uint8_t  b_,
uint8_t  a_ = 255 
)
inline

Assigns a color from a set of RGBA values.

Parameters
rThe red value.
gThe green value.
bThe blue value.
aThe alpha value.

Definition at line 87 of file lv_color.h.

void LV::Color::set_hsv ( float  h,
float  s,
float  v 
)

Assigns a color given in HSV colorspace.

Parameters
hHue value in [0, 360]
sSaturation value in [0, 1]
vValue value in [0, 1]

Definition at line 42 of file lv_color.cpp.

Friends And Related Function Documentation

bool operator== ( Color const &  c1,
Color const &  c2 
)
friend

Equality operator for comparing two Color objects.

Note
RGB channels are compared.
Parameters
c1a Color object
c2another Color object
Returns
true if colors are equal, false otherwise

Definition at line 74 of file lv_color.h.


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