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( const float _r= 0.f, const float _g= 0.f, const float _b= 0.f, const float _a= 1.f ) : r(_r), g(_g), b(_b), a(_a) {}
18  Color( const Color& color, const float alpha ) : r(color.r), g(color.g), b(color.b), a(alpha) {} // remplace alpha.
19 
20  float r, g, b, a;
21 };
22 
24 Color Black( );
26 Color White( );
28 Color Red( );
30 Color Green( );
32 Color Blue( );
33 
34 Color operator+ ( const Color& a, const Color& b );
35 Color operator- ( const Color& a, const Color& b );
36 Color operator- ( const Color& c );
37 Color operator* ( const Color& a, const Color& b );
38 Color operator* ( const Color& c, const float k );
39 Color operator* ( const float k, const Color& c );
40 Color operator/ ( const Color& a, const Color& b );
41 Color operator/ ( const float k, const Color& c );
42 Color operator/ ( const Color& c, const float k );
43 
45 #endif
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:18
Color Black()
utilitaire. renvoie une couleur noire.
Definition: color.cpp:5
representation d'une couleur (rgba) transparente ou opaque.
Definition: color.h:13
Color White()
utilitaire. renvoie une couleur blanche.
Definition: color.cpp:10
Color Red()
utilitaire. renvoie une couleur rouge.
Definition: color.cpp:15
Color Green()
utilitaire. renvoie une couleur verte.
Definition: color.cpp:20
Color(const float _r=0.f, const float _g=0.f, const float _b=0.f, const float _a=1.f)
constructeur par defaut.
Definition: color.h:16
Color Blue()
utilitaire. renvoie une couleur bleue.
Definition: color.cpp:25