]> git.sesse.net Git - casparcg/blob - dependencies64/sfml/include/SFML/Graphics/Color.hpp
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
[casparcg] / dependencies64 / sfml / include / SFML / Graphics / Color.hpp
1 ////////////////////////////////////////////////////////////\r
2 //\r
3 // SFML - Simple and Fast Multimedia Library\r
4 // Copyright (C) 2007-2009 Laurent Gomila (laurent.gom@gmail.com)\r
5 //\r
6 // This software is provided 'as-is', without any express or implied warranty.\r
7 // In no event will the authors be held liable for any damages arising from the use of this software.\r
8 //\r
9 // Permission is granted to anyone to use this software for any purpose,\r
10 // including commercial applications, and to alter it and redistribute it freely,\r
11 // subject to the following restrictions:\r
12 //\r
13 // 1. The origin of this software must not be misrepresented;\r
14 //    you must not claim that you wrote the original software.\r
15 //    If you use this software in a product, an acknowledgment\r
16 //    in the product documentation would be appreciated but is not required.\r
17 //\r
18 // 2. Altered source versions must be plainly marked as such,\r
19 //    and must not be misrepresented as being the original software.\r
20 //\r
21 // 3. This notice may not be removed or altered from any source distribution.\r
22 //\r
23 ////////////////////////////////////////////////////////////\r
24 \r
25 #ifndef SFML_COLOR_HPP\r
26 #define SFML_COLOR_HPP\r
27 \r
28 ////////////////////////////////////////////////////////////\r
29 // Headers\r
30 ////////////////////////////////////////////////////////////\r
31 #include <SFML/Config.hpp>\r
32 \r
33 \r
34 namespace sf\r
35 {\r
36 ////////////////////////////////////////////////////////////\r
37 /// Color is an utility class for manipulating\r
38 /// 32-bits RGBA colors\r
39 ////////////////////////////////////////////////////////////\r
40 class SFML_API Color\r
41 {\r
42 public :\r
43 \r
44     ////////////////////////////////////////////////////////////\r
45     /// Default constructor\r
46     ///\r
47     ////////////////////////////////////////////////////////////\r
48     Color();\r
49 \r
50     ////////////////////////////////////////////////////////////\r
51     /// Construct the color from its 4 RGBA components\r
52     ///\r
53     /// \param R : Red component   (0 .. 255)\r
54     /// \param G : Green component (0 .. 255)\r
55     /// \param B : Blue component  (0 .. 255)\r
56     /// \param A : Alpha component (0 .. 255) (255 by default)\r
57     ///\r
58     ////////////////////////////////////////////////////////////\r
59     Color(Uint8 R, Uint8 G, Uint8 B, Uint8 A = 255);\r
60 \r
61     ////////////////////////////////////////////////////////////\r
62     /// Operator += overload to add a color\r
63     ///\r
64     /// \param Other : Color to add\r
65     ///\r
66     /// \return Component-wise saturated addition of the two colors\r
67     ///\r
68     ////////////////////////////////////////////////////////////\r
69     Color& operator +=(const Color& Other);\r
70 \r
71     ////////////////////////////////////////////////////////////\r
72     /// Operator *= overload to modulate a color\r
73     ///\r
74     /// \param Other : Color to modulate\r
75     ///\r
76     /// \return Component-wise multiplication of the two colors\r
77     ///\r
78     ////////////////////////////////////////////////////////////\r
79     Color& operator *=(const Color& Other);\r
80 \r
81     ////////////////////////////////////////////////////////////\r
82     /// Compare two colors (for equality)\r
83     ///\r
84     /// \param Other : Color to compare\r
85     ///\r
86     /// \return True if colors are equal\r
87     ///\r
88     ////////////////////////////////////////////////////////////\r
89     bool operator ==(const Color& Other) const;\r
90 \r
91     ////////////////////////////////////////////////////////////\r
92     /// Compare two colors (for difference)\r
93     ///\r
94     /// \param Other : Color to compare\r
95     ///\r
96     /// \return True if colors are different\r
97     ///\r
98     ////////////////////////////////////////////////////////////\r
99     bool operator !=(const Color& Other) const;\r
100 \r
101     ////////////////////////////////////////////////////////////\r
102     // Static member data\r
103     ////////////////////////////////////////////////////////////\r
104     static const Color Black;   ///< Black predefined color\r
105     static const Color White;   ///< White predefined color\r
106     static const Color Red;     ///< Red predefined color\r
107     static const Color Green;   ///< Green predefined color\r
108     static const Color Blue;    ///< Blue predefined color\r
109     static const Color Yellow;  ///< Yellow predefined color\r
110     static const Color Magenta; ///< Magenta predefined color\r
111     static const Color Cyan;    ///< Cyan predefined color\r
112 \r
113     ////////////////////////////////////////////////////////////\r
114     // Member data\r
115     ////////////////////////////////////////////////////////////\r
116     Uint8 r; ///< Red component\r
117     Uint8 g; ///< Green component\r
118     Uint8 b; ///< Blue component\r
119     Uint8 a; ///< Alpha (transparency) component\r
120 };\r
121 \r
122 ////////////////////////////////////////////////////////////\r
123 /// Operator + overload to add two colors\r
124 ///\r
125 /// \param Color1 : First color\r
126 /// \param Color2 : Second color\r
127 ///\r
128 /// \return Component-wise saturated addition of the two colors\r
129 ///\r
130 ////////////////////////////////////////////////////////////\r
131 SFML_API Color operator +(const Color& Color1, const Color& Color2);\r
132 \r
133 ////////////////////////////////////////////////////////////\r
134 /// Operator * overload to modulate two colors\r
135 ///\r
136 /// \param Color1 : First color\r
137 /// \param Color2 : Second color\r
138 ///\r
139 /// \return Component-wise multiplication of the two colors\r
140 ///\r
141 ////////////////////////////////////////////////////////////\r
142 SFML_API Color operator *(const Color& Color1, const Color& Color2);\r
143 \r
144 } // namespace sf\r
145 \r
146 \r
147 #endif // SFML_COLOR_HPP\r