Crazy Eddie's GUI System  0.8.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
ColourRect.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 "CEGUI/Base.h"
35 #include "CEGUI/Colour.h"
36 
37 // Start of CEGUI namespace section
38 namespace CEGUI
39 {
44 class CEGUIEXPORT ColourRect :
45  public AllocatedObject<ColourRect>
46 {
47 public:
52  ColourRect(void);
53 
54 
59  ColourRect(const Colour& col);
60 
61 
66  ColourRect(const Colour& top_left, const Colour& top_right, const Colour& bottom_left, const Colour& bottom_right);
67 
68 
79  void setAlpha(float alpha);
80 
81 
92  void setTopAlpha(float alpha);
93 
94 
105  void setBottomAlpha(float alpha);
106 
107 
118  void setLeftAlpha(float alpha);
119 
120 
131  void setRightAlpha(float alpha);
132 
133 
141  bool isMonochromatic() const;
142 
143 
160  ColourRect getSubRectangle( float left, float right, float top, float bottom ) const;
161 
174  Colour getColourAtPoint( float x, float y ) const;
175 
176 
184  void setColours(const Colour& col);
185 
186 
194  void modulateAlpha(float alpha);
195 
200  ColourRect& operator*=(const ColourRect& other);
201 
202  inline ColourRect operator*(const float val) const
203  {
204  return ColourRect(
205  d_top_left * val,
206  d_top_right * val,
207  d_bottom_left * val,
208  d_bottom_right * val
209  );
210  }
211 
212  inline ColourRect operator+(const ColourRect& val) const
213  {
214  return ColourRect(
215  d_top_left + val.d_top_left,
216  d_top_right + val.d_top_right,
217  d_bottom_left + val.d_bottom_left,
218  d_bottom_right + val.d_bottom_right
219  );
220  }
221 
222 
223  Colour d_top_left, d_top_right, d_bottom_left, d_bottom_right; //<! ColourRect component colours
224 };
225 
226 } // End of CEGUI namespace section
227 
228 
229 #endif // end of guard _CEGUIColourRect_h_