#include <OSDLUprightRectangle.h>
Inheritance diagram for OSDL::Video::TwoDimensional::UprightRectangle:
It is the user responsability to provide a set of coordinates so that the upper left corner is indeed higher than the lower right corner, and at its left, in usual OSDL 2D referential.
Failure to do so result in an exception to be raised.
Definition at line 99 of file OSDLUprightRectangle.h.
Public Member Functions | |
UprightRectangle (const Point2D &upperLeftCorner, const Point2D &lowerRightCorner) throw ( VideoException ) | |
Two corners define an UprightRectangle. | |
UprightRectangle (const Point2D &upperLeftCorner, Length width, Length height) throw () | |
One corner, width and height define an UprightRectangle. | |
UprightRectangle (Coordinate x, Coordinate y, Length width, Length height) throw () | |
Two coordinates, width and height define an UprightRectangle. | |
UprightRectangle (const SDL_Rect &source) throw () | |
An SDL_Rect defines an UprightRectangle. | |
virtual | ~UprightRectangle () throw () |
Basic destructor, so that it remains virtual. | |
virtual Point2D | getUpperLeftCorner () const throw () |
Returns this UprightRectangle's upper left corner. | |
virtual void | setUpperLeftCorner (Point2D &newUpperLeftCorner) throw () |
Sets this UprightRectangle's upper left corner, width and height do not change. | |
virtual Coordinate | getUpperLeftAbscissa () const throw () |
Returns directly the abscissa of upper left corner. | |
virtual void | setUpperLeftAbscissa (Coordinate newAbscissa) throw () |
Sets directly the abscissa of the upper left corner of this rectangle. | |
virtual Coordinate | getUpperLeftOrdinate () const throw () |
Returns directly the ordinate of upper left corner. | |
virtual void | setUpperLeftOrdinate (Coordinate newOrdinate) throw () |
Sets directly the ordinate of the upper left corner of this rectangle. | |
virtual Point2D | getLowerRightCorner () const throw () |
Returns this UprightRectangle's lower right corner. | |
virtual void | setLowerRightCorner (Point2D &newLowerRightCorner) throw ( VideoException) |
Sets directly the lower right corner of this rectangle. | |
virtual Coordinate | getLowerRightAbscissa () const throw () |
Returns directly the abscissa of lower right corner. | |
virtual void | setLowerRightAbscissa (Coordinate newAbscissa) throw ( VideoException ) |
Sets directly the abscissa of the lower right corner of this rectangle. | |
virtual Coordinate | getLowerRightOrdinate () const throw () |
Returns directly the ordinate of lower right corner. | |
virtual void | setLowerRightOrdinate (Coordinate newOrdinate) throw ( VideoException ) |
Sets directly the ordinate of the lower right corner of this rectangle. | |
virtual Length | getWidth () const throw () |
Returns this UprightRectangle's width. | |
virtual void | setWidth (Length newWidth) throw () |
Sets this UprightRectangle's width. | |
virtual Length | getHeight () const throw () |
Returns this UprightRectangle's height. | |
virtual void | setHeight (Length newHeight) throw () |
Sets this UprightRectangle's height. | |
virtual bool | draw (Surface &target, Pixels::ColorElement red, Pixels::ColorElement blue, Pixels::ColorElement green, Pixels::ColorElement alpha=Pixels::AlphaOpaque, bool filled=true) const throw () |
Draws this UprightRectangle to specified surface with specified RGBA color. | |
virtual bool | draw (Surface &target, Pixels::ColorDefinition colorDef=Pixels::White, bool filled=true) const throw () |
Draws this UprightRectangle to specified surface with specified RGBA color. | |
virtual bool | drawWithRoundedCorners (Surface &target, Length edgeWidth=3, Pixels::ColorDefinition edgeColorDef=Pixels::White, Pixels::ColorDefinition backgroundColorDef=Pixels::Transparent) const throw () |
Draws this UprightRectangle to specified surface with rounded corners, drawn with specified color, above a background of specified color. | |
virtual Length | computeRadiusForRoundRectangle (Length edgeWidth) const throw ( VideoException ) |
Computes the preferred radius of round corners for this rectangle, with the specified edge width. | |
virtual SDL_Rect * | toSDLRect () const throw ( VideoException ) |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const throw () |
Returns an user-friendly description of the state of this object. | |
Protected Attributes | |
Coordinate | _x |
Upper left corner's abscissa (horizontal coordinate). | |
Coordinate | _y |
Upper left corner's ordinate (vertical coordinate). | |
Private Member Functions | |
friend | bool::operator== (const UprightRectangle &first, const UprightRectangle &second) throw () |
UprightRectangle (const UprightRectangle &source) throw () | |
Copy constructor made private to ensure that it will be never called. | |
UprightRectangle & | operator= (const UprightRectangle &source) throw () |
Assignment operator made private to ensure that it will be never called. | |
Private Attributes | |
Length | _width |
Width is counted from current abscissa, going right. | |
Length | _height |
Height is count from current ordinate, going down. |
UprightRectangle::UprightRectangle | ( | const Point2D & | upperLeftCorner, | |
const Point2D & | lowerRightCorner | |||
) | throw ( VideoException ) |
Two corners define an UprightRectangle.
Definition at line 26 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::toString().
Referenced by OSDL::Video::Surface::getClippingArea().
UprightRectangle::UprightRectangle | ( | const Point2D & | upperLeftCorner, | |
Length | width, | |||
Length | height | |||
) | throw () |
One corner, width and height define an UprightRectangle.
Definition at line 53 of file OSDLUprightRectangle.cc.
UprightRectangle::UprightRectangle | ( | Coordinate | x, | |
Coordinate | y, | |||
Length | width, | |||
Length | height | |||
) | throw () |
Two coordinates, width and height define an UprightRectangle.
Definition at line 64 of file OSDLUprightRectangle.cc.
UprightRectangle::UprightRectangle | ( | const SDL_Rect & | source | ) | throw () [explicit] |
UprightRectangle::~UprightRectangle | ( | ) | throw () [virtual] |
Basic destructor, so that it remains virtual.
Definition at line 86 of file OSDLUprightRectangle.cc.
OSDL::Video::TwoDimensional::UprightRectangle::UprightRectangle | ( | const UprightRectangle & | source | ) | throw () [explicit, private] |
Copy constructor made private to ensure that it will be never called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
OSDL::Video::TwoDimensional::UprightRectangle::bool::operator== | ( | const UprightRectangle & | first, | |
const UprightRectangle & | second | |||
) | throw () [private] |
Point2D UprightRectangle::getUpperLeftCorner | ( | ) | const throw () [virtual] |
Returns this UprightRectangle's upper left corner.
Definition at line 98 of file OSDLUprightRectangle.cc.
void UprightRectangle::setUpperLeftCorner | ( | Point2D & | newUpperLeftCorner | ) | throw () [virtual] |
Sets this UprightRectangle's upper left corner, width and height do not change.
Definition at line 106 of file OSDLUprightRectangle.cc.
Coordinate UprightRectangle::getUpperLeftAbscissa | ( | ) | const throw () [virtual] |
Returns directly the abscissa of upper left corner.
Definition at line 117 of file OSDLUprightRectangle.cc.
References _x.
Referenced by OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer().
void UprightRectangle::setUpperLeftAbscissa | ( | Coordinate | newAbscissa | ) | throw () [virtual] |
Sets directly the abscissa of the upper left corner of this rectangle.
Definition at line 125 of file OSDLUprightRectangle.cc.
Referenced by drawWithRoundedCorners(), OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
Coordinate UprightRectangle::getUpperLeftOrdinate | ( | ) | const throw () [virtual] |
Returns directly the ordinate of upper left corner.
Definition at line 134 of file OSDLUprightRectangle.cc.
References _y.
Referenced by OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer().
void UprightRectangle::setUpperLeftOrdinate | ( | Coordinate | newOrdinate | ) | throw () [virtual] |
Sets directly the ordinate of the upper left corner of this rectangle.
Definition at line 142 of file OSDLUprightRectangle.cc.
Referenced by drawWithRoundedCorners(), OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
Point2D UprightRectangle::getLowerRightCorner | ( | ) | const throw () [virtual] |
Returns this UprightRectangle's lower right corner.
Definition at line 155 of file OSDLUprightRectangle.cc.
References _x, _y, getHeight(), and getWidth().
void UprightRectangle::setLowerRightCorner | ( | Point2D & | newLowerRightCorner | ) | throw ( VideoException) [virtual] |
Sets directly the lower right corner of this rectangle.
VideoException | if width or height would become negative. |
Definition at line 164 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::toString().
Coordinate UprightRectangle::getLowerRightAbscissa | ( | ) | const throw () [virtual] |
Returns directly the abscissa of lower right corner.
Definition at line 181 of file OSDLUprightRectangle.cc.
References _x, and getWidth().
void UprightRectangle::setLowerRightAbscissa | ( | Coordinate | newAbscissa | ) | throw ( VideoException ) [virtual] |
Sets directly the abscissa of the lower right corner of this rectangle.
VideoException | if width or height would become negative. |
Definition at line 189 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::toString().
Coordinate UprightRectangle::getLowerRightOrdinate | ( | ) | const throw () [virtual] |
Returns directly the ordinate of lower right corner.
Definition at line 205 of file OSDLUprightRectangle.cc.
References _y, and getHeight().
void UprightRectangle::setLowerRightOrdinate | ( | Coordinate | newOrdinate | ) | throw ( VideoException ) [virtual] |
Sets directly the ordinate of the lower right corner of this rectangle.
VideoException | if width or height would become negative. |
Definition at line 213 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::toString().
Length UprightRectangle::getWidth | ( | ) | const throw () [virtual] |
Returns this UprightRectangle's width.
Reimplemented in OSDL::Video::Surface.
Definition at line 231 of file OSDLUprightRectangle.cc.
References _width.
Referenced by getLowerRightAbscissa(), getLowerRightCorner(), OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer(), and toSDLRect().
void UprightRectangle::setWidth | ( | Length | newWidth | ) | throw () [virtual] |
Sets this UprightRectangle's width.
Reimplemented in OSDL::Video::Surface, and OSDL::Video::TwoDimensional::Widget.
Definition at line 239 of file OSDLUprightRectangle.cc.
Referenced by OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
Length UprightRectangle::getHeight | ( | ) | const throw () [virtual] |
Returns this UprightRectangle's height.
Reimplemented in OSDL::Video::Surface.
Definition at line 248 of file OSDLUprightRectangle.cc.
References _height.
Referenced by getLowerRightCorner(), getLowerRightOrdinate(), OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer(), and toSDLRect().
void UprightRectangle::setHeight | ( | Length | newHeight | ) | throw () [virtual] |
Sets this UprightRectangle's height.
Reimplemented in OSDL::Video::Surface, and OSDL::Video::TwoDimensional::Widget.
Definition at line 256 of file OSDLUprightRectangle.cc.
Referenced by OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
bool UprightRectangle::draw | ( | Surface & | target, | |
Pixels::ColorElement | red, | |||
Pixels::ColorElement | blue, | |||
Pixels::ColorElement | green, | |||
Pixels::ColorElement | alpha = Pixels::AlphaOpaque , |
|||
bool | filled = true | |||
) | const throw () [virtual] |
Draws this UprightRectangle to specified surface with specified RGBA color.
target | the surface to which this rectangle will be rendered. | |
filled | tells whether the drawn rectangle should be filled with specified color, or if only its sides should be drawn. |
Definition at line 265 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::convertRGBAToColorDefinition(), and OSDL::Video::TwoDimensional::Line::draw().
Referenced by drawWithRoundedCorners().
bool UprightRectangle::draw | ( | Surface & | target, | |
Pixels::ColorDefinition | colorDef = Pixels::White , |
|||
bool | filled = true | |||
) | const throw () [virtual] |
Draws this UprightRectangle to specified surface with specified RGBA color.
target | the surface to which this rectangle will be rendered. | |
filled | tells whether the drawn rectangle should be filled with specified color, or if only its sides should be drawn. |
Definition at line 276 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::convertColorDefinitionToRawPixelColor(), and OSDL::Video::Pixels::toString().
bool UprightRectangle::drawWithRoundedCorners | ( | Surface & | target, | |
Length | edgeWidth = 3 , |
|||
Pixels::ColorDefinition | edgeColorDef = Pixels::White , |
|||
Pixels::ColorDefinition | backgroundColorDef = Pixels::Transparent | |||
) | const throw () [virtual] |
Draws this UprightRectangle to specified surface with rounded corners, drawn with specified color, above a background of specified color.
The width of the borders can be chosen, and should not be incompatible with the dimensions of this rectangle.
target | the surface to which this rectangle will be rendered. | |
edgeWidth | the width of the edges of this rectangle. | |
edgeColorDef | the color definition of the edges of this rectangle. | |
backgroundColorDef | the color definition of the background of this rectangle. |
Definition at line 323 of file OSDLUprightRectangle.cc.
References OSDL::Video::Surface::AlphaBlendingBlit, OSDL::Video::Pixels::AlphaOpaque, OSDL::Video::Surface::ColorkeyBlit, draw(), OSDL::Video::Pixels::getCurrentColorMasks(), OSDL::Video::Surface::RLEColorkeyBlit, OSDL::Video::Pixels::selectColorDifferentFrom(), setUpperLeftAbscissa(), setUpperLeftOrdinate(), OSDL::Video::TwoDimensional::Point2D::setX(), OSDL::Video::TwoDimensional::Point2D::setY(), OSDL::Video::Surface::Software, and OSDL::Video::Pixels::toString().
Referenced by OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer().
Length UprightRectangle::computeRadiusForRoundRectangle | ( | Length | edgeWidth | ) | const throw ( VideoException ) [virtual] |
Computes the preferred radius of round corners for this rectangle, with the specified edge width.
edgeWidth | the edge width to take into account for the radius. |
VideoException | if no radius can fullfill the set of constraints due to this rectangle and the edge width. |
Definition at line 694 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::toString().
Referenced by OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
SDL_Rect * UprightRectangle::toSDLRect | ( | ) | const throw ( VideoException ) [virtual] |
Definition at line 724 of file OSDLUprightRectangle.cc.
References _x, _y, getHeight(), and getWidth().
const string UprightRectangle::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const throw () [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Reimplemented in OSDL::Video::Surface, OSDL::Video::TwoDimensional::BackBufferedWidget, OSDL::Video::TwoDimensional::TextWidget, and OSDL::Video::TwoDimensional::Widget.
Definition at line 747 of file OSDLUprightRectangle.cc.
References OSDL::Video::Pixels::toString().
UprightRectangle& OSDL::Video::TwoDimensional::UprightRectangle::operator= | ( | const UprightRectangle & | source | ) | throw () [private] |
Assignment operator made private to ensure that it will be never called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
Upper left corner's abscissa (horizontal coordinate).
Definition at line 404 of file OSDLUprightRectangle.h.
Referenced by getLowerRightAbscissa(), getLowerRightCorner(), getUpperLeftAbscissa(), getUpperLeftCorner(), and toSDLRect().
Upper left corner's ordinate (vertical coordinate).
Definition at line 408 of file OSDLUprightRectangle.h.
Referenced by getLowerRightCorner(), getLowerRightOrdinate(), getUpperLeftCorner(), getUpperLeftOrdinate(), and toSDLRect().
Width is counted from current abscissa, going right.
Definition at line 416 of file OSDLUprightRectangle.h.
Referenced by getWidth().
Height is count from current ordinate, going down.
Definition at line 420 of file OSDLUprightRectangle.h.
Referenced by getHeight().