Crazy Eddie's GUI System
0.8.4
|
00001 /*********************************************************************** 00002 created: 8/3/2004 00003 author: Paul D Turner 00004 00005 purpose: Defines class representing colours for four corners of a 00006 rectangle 00007 *************************************************************************/ 00008 /*************************************************************************** 00009 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00010 * 00011 * Permission is hereby granted, free of charge, to any person obtaining 00012 * a copy of this software and associated documentation files (the 00013 * "Software"), to deal in the Software without restriction, including 00014 * without limitation the rights to use, copy, modify, merge, publish, 00015 * distribute, sublicense, and/or sell copies of the Software, and to 00016 * permit persons to whom the Software is furnished to do so, subject to 00017 * the following conditions: 00018 * 00019 * The above copyright notice and this permission notice shall be 00020 * included in all copies or substantial portions of the Software. 00021 * 00022 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00023 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00024 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00025 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00026 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00027 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00028 * OTHER DEALINGS IN THE SOFTWARE. 00029 ***************************************************************************/ 00030 #ifndef _CEGUIColourRect_h_ 00031 #define _CEGUIColourRect_h_ 00032 00033 #include "CEGUI/Base.h" 00034 #include "CEGUI/Colour.h" 00035 00036 // Start of CEGUI namespace section 00037 namespace CEGUI 00038 { 00043 class CEGUIEXPORT ColourRect : 00044 public AllocatedObject<ColourRect> 00045 { 00046 public: 00051 ColourRect(void); 00052 00053 00058 ColourRect(const Colour& col); 00059 00060 00065 ColourRect(const Colour& top_left, const Colour& top_right, const Colour& bottom_left, const Colour& bottom_right); 00066 00067 00078 void setAlpha(float alpha); 00079 00080 00091 void setTopAlpha(float alpha); 00092 00093 00104 void setBottomAlpha(float alpha); 00105 00106 00117 void setLeftAlpha(float alpha); 00118 00119 00130 void setRightAlpha(float alpha); 00131 00132 00140 bool isMonochromatic() const; 00141 00142 00159 ColourRect getSubRectangle( float left, float right, float top, float bottom ) const; 00160 00173 Colour getColourAtPoint( float x, float y ) const; 00174 00175 00183 void setColours(const Colour& col); 00184 00185 00193 void modulateAlpha(float alpha); 00194 00199 ColourRect& operator*=(const ColourRect& other); 00200 00201 inline ColourRect operator*(const float val) const 00202 { 00203 return ColourRect( 00204 d_top_left * val, 00205 d_top_right * val, 00206 d_bottom_left * val, 00207 d_bottom_right * val 00208 ); 00209 } 00210 00211 inline ColourRect operator+(const ColourRect& val) const 00212 { 00213 return ColourRect( 00214 d_top_left + val.d_top_left, 00215 d_top_right + val.d_top_right, 00216 d_bottom_left + val.d_bottom_left, 00217 d_bottom_right + val.d_bottom_right 00218 ); 00219 } 00220 00221 00222 Colour d_top_left, d_top_right, d_bottom_left, d_bottom_right; 00223 }; 00224 00225 } // End of CEGUI namespace section 00226 00227 00228 #endif // end of guard _CEGUIColourRect_h_