27 #include <libvisual/lv_types.h>
49 : r (0), g (0), b (0), a (0)
60 Color (uint8_t r_, uint8_t g_, uint8_t b_, uint8_t a_ = 255)
61 : r (r_), g(g_), b(b_), a(a_)
74 friend bool operator== (
Color const& c1,
Color const& c2)
76 return ( c1.
r == c2.
r && c1.
g == c2.
g && c1.
b == c2.
b);
87 void set (uint8_t r_, uint8_t g_, uint8_t b_, uint8_t a_ = 255)
89 r = r_; g = g_; b = b_; a = a_;
99 void set_hsv (
float h,
float s,
float v);
113 void get_hsv (
float& h,
float& s,
float& v)
const;
115 void set_from_uint16 (uint16_t rgb);
116 void set_from_uint32 (uint32_t rgba);
118 uint32_t to_uint32 ()
const;
119 uint16_t to_uint16 ()
const;
121 static Color const& white()
123 static Color color(255, 255, 255);
127 static Color
const& black()
129 static Color color(0, 0, 0);
136 #endif // __cplusplus
150 LV_API
VisColor *visual_color_new (
void);
152 LV_API
void visual_color_free (
VisColor *color);
157 LV_API
void visual_color_set (
VisColor *color, uint8_t r, uint8_t g, uint8_t b);
158 LV_API
void visual_color_set_rgba (
VisColor *color, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
159 LV_API
void visual_color_set_hsv (
VisColor *color,
float h,
float s,
float v);
160 LV_API
void visual_color_get_hsv (
VisColor *color,
float *h,
float *s,
float *v);
162 LV_API
void visual_color_set_from_uint32 (
VisColor *color, uint32_t rgb);
163 LV_API
void visual_color_set_from_uint16 (
VisColor *color, uint16_t rgb);
165 LV_API uint32_t visual_color_to_uint32 (
VisColor *color);
166 LV_API uint16_t visual_color_to_uint16 (
VisColor *color);
168 LV_API
VisColor *visual_color_black (
void);
169 LV_API
VisColor *visual_color_white (
void);