gKit3
Loading...
Searching...
No Matches
color.h
Go to the documentation of this file.
1
2#ifndef _COLOR_H
3#define _COLOR_H
4
5
8
11
13struct 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
30Color Black( );
32Color White( );
34Color Red( );
36Color Green( );
38Color Blue( );
40Color Yellow( );
41
42Color operator+ ( const Color& a, const Color& b );
43Color operator- ( const Color& a, const Color& b );
44Color operator- ( const Color& c );
45Color operator* ( const Color& a, const Color& b );
46Color operator* ( const Color& c, const float k );
47Color operator* ( const float k, const Color& c );
48Color operator/ ( const Color& a, const Color& b );
49Color operator/ ( const float k, const Color& c );
50Color operator/ ( const Color& c, const float k );
51Color operator+ ( const float k, const Color& c );
52Color operator+ ( const Color& c, const float k );
53
54
56Color srgb( const Color& color, const float g= float(2.2) );
58Color linear( const Color& color, const float g= float(2.2) );
59
60Color abs( const Color& color );
61
63#endif
Color Red()
utilitaire. renvoie une couleur rouge.
Definition color.cpp:28
Color Yellow()
utilitaire. renvoie une couleur jaune.
Definition color.cpp:43
Color Blue()
utilitaire. renvoie une couleur bleue.
Definition color.cpp:38
Color Black()
utilitaire. renvoie une couleur noire.
Definition color.cpp:18
Color srgb(const Color &color, const float g=float(2.2))
transformation couleur : rgb lineaire vers srgb
Definition color.cpp:61
Color Green()
utilitaire. renvoie une couleur verte.
Definition color.cpp:33
Color White()
utilitaire. renvoie une couleur blanche.
Definition color.cpp:23
Color linear(const Color &color, const float g=float(2.2))
transformation couleur : srgb vers rgb lineaire
Definition color.cpp:67
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