[1812] | 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 | Crazy Eddie's GUI System (http://www.cegui.org.uk)
|
---|
| 11 | Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
|
---|
| 12 |
|
---|
| 13 | This library is free software; you can redistribute it and/or
|
---|
| 14 | modify it under the terms of the GNU Lesser General Public
|
---|
| 15 | License as published by the Free Software Foundation; either
|
---|
| 16 | version 2.1 of the License, or (at your option) any later version.
|
---|
| 17 |
|
---|
| 18 | This library is distributed in the hope that it will be useful,
|
---|
| 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
| 21 | Lesser General Public License for more details.
|
---|
| 22 |
|
---|
| 23 | You should have received a copy of the GNU Lesser General Public
|
---|
| 24 | License along with this library; if not, write to the Free Software
|
---|
| 25 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
| 26 | *************************************************************************/
|
---|
| 27 | #ifndef _CEGUIColourRect_h_
|
---|
| 28 | #define _CEGUIColourRect_h_
|
---|
| 29 |
|
---|
| 30 | #include "CEGUIBase.h"
|
---|
| 31 | #include "CEGUIcolour.h"
|
---|
| 32 |
|
---|
| 33 | // Start of CEGUI namespace section
|
---|
| 34 | namespace CEGUI
|
---|
| 35 | {
|
---|
| 36 | /*!
|
---|
| 37 | \brief
|
---|
| 38 | Class that holds details of colours for the four corners of a rectangle.
|
---|
| 39 | */
|
---|
| 40 | class CEGUIEXPORT ColourRect
|
---|
| 41 | {
|
---|
| 42 | public:
|
---|
| 43 | /*!
|
---|
| 44 | \brief
|
---|
| 45 | Default constructor
|
---|
| 46 | */
|
---|
| 47 | ColourRect(void);
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | /*!
|
---|
| 51 | \brief
|
---|
| 52 | Constructor for ColourRect objects (via single colour). Also handles default construction.
|
---|
| 53 | */
|
---|
| 54 | ColourRect(const colour& col);
|
---|
| 55 |
|
---|
| 56 |
|
---|
| 57 | /*!
|
---|
| 58 | \brief
|
---|
| 59 | Constructor for ColourRect objects
|
---|
| 60 | */
|
---|
| 61 | ColourRect(const colour& top_left, const colour& top_right, const colour& bottom_left, const colour& bottom_right);
|
---|
| 62 |
|
---|
| 63 |
|
---|
| 64 | /*!
|
---|
| 65 | \brief
|
---|
| 66 | Set the alpha value to use for all four corners of the ColourRect.
|
---|
| 67 |
|
---|
| 68 | \param alpha
|
---|
| 69 | Alpha value to use.
|
---|
| 70 |
|
---|
| 71 | \return
|
---|
| 72 | Nothing.
|
---|
| 73 | */
|
---|
| 74 | void setAlpha(float alpha);
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | /*!
|
---|
| 78 | \brief
|
---|
| 79 | Set the alpha value to use for the top edge of the ColourRect.
|
---|
| 80 |
|
---|
| 81 | \param alpha
|
---|
| 82 | Alpha value to use.
|
---|
| 83 |
|
---|
| 84 | \return
|
---|
| 85 | Nothing.
|
---|
| 86 | */
|
---|
| 87 | void setTopAlpha(float alpha);
|
---|
| 88 |
|
---|
| 89 |
|
---|
| 90 | /*!
|
---|
| 91 | \brief
|
---|
| 92 | Set the alpha value to use for the bottom edge of the ColourRect.
|
---|
| 93 |
|
---|
| 94 | \param alpha
|
---|
| 95 | Alpha value to use.
|
---|
| 96 |
|
---|
| 97 | \return
|
---|
| 98 | Nothing.
|
---|
| 99 | */
|
---|
| 100 | void setBottomAlpha(float alpha);
|
---|
| 101 |
|
---|
| 102 |
|
---|
| 103 | /*!
|
---|
| 104 | \brief
|
---|
| 105 | Set the alpha value to use for the left edge of the ColourRect.
|
---|
| 106 |
|
---|
| 107 | \param alpha
|
---|
| 108 | Alpha value to use.
|
---|
| 109 |
|
---|
| 110 | \return
|
---|
| 111 | Nothing.
|
---|
| 112 | */
|
---|
| 113 | void setLeftAlpha(float alpha);
|
---|
| 114 |
|
---|
| 115 |
|
---|
| 116 | /*!
|
---|
| 117 | \brief
|
---|
| 118 | Set the alpha value to use for the right edge of the ColourRect.
|
---|
| 119 |
|
---|
| 120 | \param alpha
|
---|
| 121 | Alpha value to use.
|
---|
| 122 |
|
---|
| 123 | \return
|
---|
| 124 | Nothing.
|
---|
| 125 | */
|
---|
| 126 | void setRightAlpha(float alpha);
|
---|
| 127 |
|
---|
| 128 |
|
---|
| 129 | /*!
|
---|
| 130 | \brief
|
---|
| 131 | Determinate the ColourRect is monochromatic or variegated.
|
---|
| 132 |
|
---|
| 133 | \return
|
---|
| 134 | True if all four corners of the ColourRect has same colour, false otherwise.
|
---|
| 135 | */
|
---|
| 136 | bool isMonochromatic() const;
|
---|
| 137 |
|
---|
| 138 |
|
---|
| 139 | /*!
|
---|
| 140 | \brief
|
---|
| 141 | Gets a portion of this ColourRect as a subset ColourRect
|
---|
| 142 |
|
---|
| 143 | \param left
|
---|
| 144 | The left side of this subrectangle (in the range of 0-1 float)
|
---|
| 145 | \param right
|
---|
| 146 | The right side of this subrectangle (in the range of 0-1 float)
|
---|
| 147 | \param top
|
---|
| 148 | The top side of this subrectangle (in the range of 0-1 float)
|
---|
| 149 | \param bottom
|
---|
| 150 | The bottom side of this subrectangle (in the range of 0-1 float)
|
---|
| 151 |
|
---|
| 152 | \return
|
---|
| 153 | A ColourRect from the specified range
|
---|
| 154 | */
|
---|
| 155 | ColourRect getSubRectangle( float left, float right, float top, float bottom ) const;
|
---|
| 156 |
|
---|
| 157 | /*!
|
---|
| 158 | \brief
|
---|
| 159 | Get the colour at a point in the rectangle
|
---|
| 160 |
|
---|
| 161 | \param x
|
---|
| 162 | The x coordinate of the point
|
---|
| 163 | \param y
|
---|
| 164 | The y coordinate of the point
|
---|
| 165 |
|
---|
| 166 | \return
|
---|
| 167 | The colour at the specified point.
|
---|
| 168 | */
|
---|
| 169 | colour getColourAtPoint( float x, float y ) const;
|
---|
| 170 |
|
---|
| 171 |
|
---|
| 172 | /*!
|
---|
| 173 | \brief
|
---|
| 174 | Set the colour of all four corners simultaneously.
|
---|
| 175 |
|
---|
| 176 | \param col
|
---|
| 177 | colour that is to be set for all four corners of the ColourRect;
|
---|
| 178 | */
|
---|
| 179 | void setColours(const colour& col);
|
---|
| 180 |
|
---|
| 181 |
|
---|
| 182 | /*!
|
---|
| 183 | \brief
|
---|
| 184 | Module the alpha components of each corner's colour by a constant.
|
---|
| 185 |
|
---|
| 186 | \param alpha
|
---|
| 187 | The constant factor to modulate all alpha colour components by.
|
---|
| 188 | */
|
---|
| 189 | void modulateAlpha(float alpha);
|
---|
| 190 |
|
---|
| 191 | /*!
|
---|
| 192 | \brief
|
---|
| 193 | Modulate all components of this colour rect with corresponding components from another colour rect.
|
---|
| 194 | */
|
---|
| 195 | ColourRect& operator*=(const ColourRect& other);
|
---|
| 196 |
|
---|
| 197 |
|
---|
| 198 | colour d_top_left, d_top_right, d_bottom_left, d_bottom_right; //<! ColourRect component colours
|
---|
| 199 | };
|
---|
| 200 |
|
---|
| 201 | } // End of CEGUI namespace section
|
---|
| 202 |
|
---|
| 203 |
|
---|
| 204 | #endif // end of guard _CEGUIColourRect_h_
|
---|