gKit2 light
color.h
Go to the documentation of this file.
1 
2 #ifndef _COLOR_H
3 #define _COLOR_H
4 
5 
8 
11 
13 struct Color
14 {
16  Color( ) : r(0.f), g(0.f), b(0.f), a(1.f) {}
17  explicit Color( const float _r, const float _g, const float _b, const float _a= 1.f ) : r(_r), g(_g), b(_b), a(_a) {}
18  explicit Color( const float _value ) : r(_value), g(_value), b(_value), a(1.f) {}
19 
21  Color( const Color& color, const float alpha ) : r(color.r), g(color.g), b(color.b), a(alpha) {} // remplace alpha.
22 
23  float power( ) const;
24  float max( ) const;
25 
26  float r, g, b, a;
27 };
28 
30 Color Black( );
32 Color White( );
34 Color Red( );
36 Color Green( );
38 Color Blue( );
40 Color Yellow( );
41 
42 Color operator+ ( const Color& a, const Color& b );
43 Color operator- ( const Color& a, const Color& b );
44 Color operator- ( const Color& c );
45 Color operator* ( const Color& a, const Color& b );
46 Color operator* ( const Color& c, const float k );
47 Color operator* ( const float k, const Color& c );
48 Color operator/ ( const Color& a, const Color& b );
49 Color operator/ ( const float k, const Color& c );
50 Color operator/ ( const Color& c, const float k );
51 
53 Color linear( const Color& color );
54 
56 Color gamma( const Color& color );
57 
59 #endif
Color Red()
utilitaire. renvoie une couleur rouge.
Definition: color.cpp:41
Color Yellow()
utilitaire. renvoie une couleur jaune.
Definition: color.cpp:56
Color Blue()
utilitaire. renvoie une couleur bleue.
Definition: color.cpp:51
Color Black()
utilitaire. renvoie une couleur noire.
Definition: color.cpp:31
Color Green()
utilitaire. renvoie une couleur verte.
Definition: color.cpp:46
Color linear(const Color &color)
correction gamma : srgb vers rgb
Definition: color.cpp:18
Color gamma(const Color &color)
correction gamma : rgb vers srgb
Definition: color.cpp:24
Color White()
utilitaire. renvoie une couleur blanche.
Definition: color.cpp:36
representation d'une couleur (rgba) transparente ou opaque.
Definition: color.h:14
Color(const Color &color, const float alpha)
cree une couleur avec les memes composantes que color, mais remplace sa composante alpha (color....
Definition: color.h:21
Color()
constructeur par defaut.
Definition: color.h:16