Crazy Eddies GUI System  0.7.2
CEGUIColourRect.h
1 /***********************************************************************
2  filename: CEGUIColourRect.h
3  created: 8/3/2004
4  author: Paul D Turner
5 
6  purpose: Defines class representing colours for four corners of a
7  rectangle
8 *************************************************************************/
9 /***************************************************************************
10  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining
13  * a copy of this software and associated documentation files (the
14  * "Software"), to deal in the Software without restriction, including
15  * without limitation the rights to use, copy, modify, merge, publish,
16  * distribute, sublicense, and/or sell copies of the Software, and to
17  * permit persons to whom the Software is furnished to do so, subject to
18  * the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be
21  * included in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29  * OTHER DEALINGS IN THE SOFTWARE.
30  ***************************************************************************/
31 #ifndef _CEGUIColourRect_h_
32 #define _CEGUIColourRect_h_
33 
34 #include "CEGUIBase.h"
35 #include "CEGUIcolour.h"
36 
37 // Start of CEGUI namespace section
38 namespace CEGUI
39 {
44 class CEGUIEXPORT ColourRect
45 {
46 public:
51  ColourRect(void);
52 
53 
58  ColourRect(const colour& col);
59 
60 
65  ColourRect(const colour& top_left, const colour& top_right, const colour& bottom_left, const colour& bottom_right);
66 
67 
78  void setAlpha(float alpha);
79 
80 
91  void setTopAlpha(float alpha);
92 
93 
104  void setBottomAlpha(float alpha);
105 
106 
117  void setLeftAlpha(float alpha);
118 
119 
130  void setRightAlpha(float alpha);
131 
132 
140  bool isMonochromatic() const;
141 
142 
159  ColourRect getSubRectangle( float left, float right, float top, float bottom ) const;
160 
173  colour getColourAtPoint( float x, float y ) const;
174 
175 
183  void setColours(const colour& col);
184 
185 
193  void modulateAlpha(float alpha);
194 
199  ColourRect& operator*=(const ColourRect& other);
200 
201  inline ColourRect operator*(const float val) const
202  {
203  return ColourRect(
204  d_top_left * val,
205  d_top_right * val,
206  d_bottom_left * val,
207  d_bottom_right * val
208  );
209  }
210 
211  inline ColourRect operator+(const ColourRect& val) const
212  {
213  return ColourRect(
214  d_top_left + val.d_top_left,
215  d_top_right + val.d_top_right,
216  d_bottom_left + val.d_bottom_left,
217  d_bottom_right + val.d_bottom_right
218  );
219  }
220 
221 
222  colour d_top_left, d_top_right, d_bottom_left, d_bottom_right; //<! ColourRect component colours
223 };
224 
225 } // End of CEGUI namespace section
226 
227 
228 #endif // end of guard _CEGUIColourRect_h_