This classes defines a rectangle whose sides are parallel or orthogonal to the screen's sides. More...
#include <OSDLUprightRectangle.h>
Public Member Functions | |
UprightRectangle (const Point2D &upperLeftCorner, const Point2D &lowerRightCorner) | |
Two corners define an UprightRectangle. | |
UprightRectangle (const Point2D &upperLeftCorner, Length width, Length height) | |
One corner, width and height define an UprightRectangle. | |
UprightRectangle (Coordinate x, Coordinate y, Length width, Length height) | |
Two coordinates, width and height define an UprightRectangle. | |
UprightRectangle (const LowLevelRect &source) | |
A LowLevelRect defines an UprightRectangle. | |
virtual | ~UprightRectangle () throw () |
Basic destructor, so that it remains virtual. | |
virtual Point2D | getUpperLeftCorner () const |
Returns this UprightRectangle's upper left corner. | |
virtual void | setUpperLeftCorner (Point2D &newUpperLeftCorner) |
Sets this UprightRectangle's upper left corner, width and height do not change. | |
virtual Coordinate | getUpperLeftAbscissa () const |
Returns directly the abscissa of upper left corner. | |
virtual void | setUpperLeftAbscissa (Coordinate newAbscissa) |
Sets directly the abscissa of the upper left corner of this rectangle. | |
virtual Coordinate | getUpperLeftOrdinate () const |
Returns directly the ordinate of upper left corner. | |
virtual void | setUpperLeftOrdinate (Coordinate newOrdinate) |
Sets directly the ordinate of the upper left corner of this rectangle. | |
virtual Point2D | getLowerRightCorner () const |
Returns this UprightRectangle's lower right corner. | |
virtual void | setLowerRightCorner (Point2D &newLowerRightCorner) |
Sets directly the lower right corner of this rectangle. | |
virtual Coordinate | getLowerRightAbscissa () const |
Returns directly the abscissa of lower right corner. | |
virtual void | setLowerRightAbscissa (Coordinate newAbscissa) |
Sets directly the abscissa of the lower right corner of this rectangle. | |
virtual Coordinate | getLowerRightOrdinate () const |
Returns directly the ordinate of lower right corner. | |
virtual void | setLowerRightOrdinate (Coordinate newOrdinate) |
Sets directly the ordinate of the lower right corner of this rectangle. | |
virtual Length | getWidth () const |
Returns this UprightRectangle's width. | |
virtual void | setWidth (Length newWidth) |
Sets this UprightRectangle's width. | |
virtual Length | getHeight () const |
Returns this UprightRectangle's height. | |
virtual void | setHeight (Length newHeight) |
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 |
Draws this UprightRectangle to specified surface with specified RGBA color. | |
virtual bool | draw (Surface &target, Pixels::ColorDefinition colorDef=Pixels::White, bool filled=true) const |
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 |
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 |
Computes the preferred radius of round corners for this rectangle, with the specified edge width. | |
virtual LowLevelRect * | toLowLevelRect () const |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
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) |
UprightRectangle (const UprightRectangle &source) | |
Copy constructor made private to ensure that it will be never called. | |
UprightRectangle & | operator= (const UprightRectangle &source) |
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. |
This classes defines a rectangle whose sides are parallel or orthogonal to the screen's sides.
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 results in an exception to be raised.
Definition at line 168 of file OSDLUprightRectangle.h.
UprightRectangle::UprightRectangle | ( | const Point2D & | upperLeftCorner, | |
const Point2D & | lowerRightCorner | |||
) |
Two corners define an UprightRectangle.
Definition at line 63 of file OSDLUprightRectangle.cc.
References OSDL::Video::TwoDimensional::Point2D::getX(), OSDL::Video::TwoDimensional::Point2D::getY(), and OSDL::Video::Pixels::toString().
Referenced by OSDL::Video::Surface::getClippingArea(), OSDL::Video::Surface::getContentArea(), and OSDL::Video::Surface::toString().
One corner, width and height define an UprightRectangle.
Definition at line 91 of file OSDLUprightRectangle.cc.
UprightRectangle::UprightRectangle | ( | Coordinate | x, | |
Coordinate | y, | |||
Length | width, | |||
Length | height | |||
) |
Two coordinates, width and height define an UprightRectangle.
Definition at line 103 of file OSDLUprightRectangle.cc.
UprightRectangle::UprightRectangle | ( | const LowLevelRect & | source | ) | [explicit] |
A LowLevelRect defines an UprightRectangle.
VideoException | if the operation is not supported. |
Definition at line 131 of file OSDLUprightRectangle.cc.
UprightRectangle::~UprightRectangle | ( | ) | throw () [virtual] |
Basic destructor, so that it remains virtual.
Definition at line 145 of file OSDLUprightRectangle.cc.
OSDL::Video::TwoDimensional::UprightRectangle::UprightRectangle | ( | const UprightRectangle & | source | ) | [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 | |||
) | [private] |
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 770 of file OSDLUprightRectangle.cc.
References getHeight(), getWidth(), toString(), and OSDL::Video::Pixels::toString().
Referenced by drawWithRoundedCorners(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
bool UprightRectangle::draw | ( | Surface & | target, | |
Pixels::ColorDefinition | colorDef = Pixels::White , |
|||
bool | filled = true | |||
) | const [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 341 of file OSDLUprightRectangle.cc.
References _x, _y, OSDL::Video::Pixels::convertColorDefinitionToRawPixelColor(), getHeight(), OSDL::Video::Surface::getSDLSurface(), getWidth(), and OSDL::Video::Pixels::toString().
virtual bool OSDL::Video::TwoDimensional::UprightRectangle::draw | ( | Surface & | target, | |
Pixels::ColorElement | red, | |||
Pixels::ColorElement | blue, | |||
Pixels::ColorElement | green, | |||
Pixels::ColorElement | alpha = Pixels::AlphaOpaque , |
|||
bool | filled = true | |||
) | const [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. |
Referenced by OSDL::Video::Surface::drawLine(), and drawWithRoundedCorners().
bool UprightRectangle::drawWithRoundedCorners | ( | Surface & | target, | |
Length | edgeWidth = 3 , |
|||
Pixels::ColorDefinition | edgeColorDef = Pixels::White , |
|||
Pixels::ColorDefinition | backgroundColorDef = Pixels::Transparent | |||
) | const [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 395 of file OSDLUprightRectangle.cc.
References _x, _y, OSDL::Video::Surface::AlphaBlendingBlit, OSDL::Video::Pixels::AlphaOpaque, OSDL::Video::Surface::blitTo(), OSDL::Video::Surface::ColorkeyBlit, computeRadiusForRoundRectangle(), OSDL::Video::Surface::describePixelAt(), draw(), OSDL::Video::Surface::drawDiscWithEdge(), OSDL::Video::Surface::fill(), OSDL::Video::Surface::getBitsPerPixel(), OSDL::Video::Pixels::getCurrentColorMasks(), getHeight(), OSDL::Video::Surface::getPixelFormat(), getWidth(), OSDL::Video::Surface::RLEColorkeyBlit, OSDL::Video::Surface::savePNG(), OSDL::Video::Pixels::selectColorDifferentFrom(), OSDL::Video::Surface::setColorKey(), setUpperLeftAbscissa(), setUpperLeftOrdinate(), OSDL::Video::TwoDimensional::Point2D::setX(), OSDL::Video::TwoDimensional::Point2D::setY(), OSDL::Video::Surface::Software, OSDL::Video::Surface::toString(), and OSDL::Video::Pixels::toString().
Referenced by OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer().
Length UprightRectangle::getHeight | ( | ) | const [virtual] |
Returns this UprightRectangle's height.
Reimplemented in OSDL::Video::Surface.
Definition at line 310 of file OSDLUprightRectangle.cc.
References _height.
Referenced by OSDL::Video::TwoDimensional::Text::Font::blitLatin1MultiLineText(), computeRadiusForRoundRectangle(), draw(), drawWithRoundedCorners(), getLowerRightCorner(), getLowerRightOrdinate(), operator==(), OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer(), toLowLevelRect(), and toString().
Coordinate UprightRectangle::getLowerRightAbscissa | ( | ) | const [virtual] |
Returns directly the abscissa of lower right corner.
Definition at line 243 of file OSDLUprightRectangle.cc.
References _x, and getWidth().
Point2D UprightRectangle::getLowerRightCorner | ( | ) | const [virtual] |
Returns this UprightRectangle's lower right corner.
Definition at line 217 of file OSDLUprightRectangle.cc.
References _x, _y, getHeight(), and getWidth().
Coordinate UprightRectangle::getLowerRightOrdinate | ( | ) | const [virtual] |
Returns directly the ordinate of lower right corner.
Definition at line 267 of file OSDLUprightRectangle.cc.
References _y, and getHeight().
Coordinate UprightRectangle::getUpperLeftAbscissa | ( | ) | const [virtual] |
Returns directly the abscissa of upper left corner.
Definition at line 176 of file OSDLUprightRectangle.cc.
References _x.
Referenced by OSDL::Video::TwoDimensional::Text::Font::blitLatin1MultiLineText(), OSDL::Video::TwoDimensional::Widget::drawDecorations(), and OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer().
Point2D UprightRectangle::getUpperLeftCorner | ( | ) | const [virtual] |
Returns this UprightRectangle's upper left corner.
Definition at line 157 of file OSDLUprightRectangle.cc.
Coordinate UprightRectangle::getUpperLeftOrdinate | ( | ) | const [virtual] |
Returns directly the ordinate of upper left corner.
Definition at line 194 of file OSDLUprightRectangle.cc.
References _y.
Referenced by OSDL::Video::TwoDimensional::Text::Font::blitLatin1MultiLineText(), OSDL::Video::TwoDimensional::Widget::drawDecorations(), and OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer().
Length UprightRectangle::getWidth | ( | ) | const [virtual] |
Returns this UprightRectangle's width.
Reimplemented in OSDL::Video::Surface.
Definition at line 292 of file OSDLUprightRectangle.cc.
References _width.
Referenced by OSDL::Video::TwoDimensional::Text::Font::blitLatin1MultiLineText(), computeRadiusForRoundRectangle(), draw(), drawWithRoundedCorners(), getLowerRightAbscissa(), getLowerRightCorner(), operator==(), OSDL::Video::TwoDimensional::TextWidget::redrawBackBuffer(), toLowLevelRect(), and toString().
UprightRectangle& OSDL::Video::TwoDimensional::UprightRectangle::operator= | ( | const UprightRectangle & | source | ) | [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.
void UprightRectangle::setHeight | ( | Length | newHeight | ) | [virtual] |
Sets this UprightRectangle's height.
Reimplemented in OSDL::Video::Surface, and OSDL::Video::TwoDimensional::Widget.
Definition at line 319 of file OSDLUprightRectangle.cc.
References _height.
Referenced by OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
void UprightRectangle::setLowerRightAbscissa | ( | Coordinate | newAbscissa | ) | [virtual] |
Sets directly the abscissa of the lower right corner of this rectangle.
VideoException | if width or height would become negative. |
Definition at line 252 of file OSDLUprightRectangle.cc.
References _width, _x, toString(), and OSDL::Video::Pixels::toString().
void UprightRectangle::setLowerRightCorner | ( | Point2D & | newLowerRightCorner | ) | [virtual] |
Sets directly the lower right corner of this rectangle.
VideoException | if width or height would become negative. |
Definition at line 227 of file OSDLUprightRectangle.cc.
References _height, _width, _x, _y, OSDL::Video::TwoDimensional::Point2D::getX(), OSDL::Video::TwoDimensional::Point2D::getY(), toString(), and OSDL::Video::TwoDimensional::Point2D::toString().
void UprightRectangle::setLowerRightOrdinate | ( | Coordinate | newOrdinate | ) | [virtual] |
Sets directly the ordinate of the lower right corner of this rectangle.
VideoException | if width or height would become negative. |
Definition at line 276 of file OSDLUprightRectangle.cc.
References _height, _y, toString(), and OSDL::Video::Pixels::toString().
void UprightRectangle::setUpperLeftAbscissa | ( | Coordinate | newAbscissa | ) | [virtual] |
Sets directly the abscissa of the upper left corner of this rectangle.
Definition at line 185 of file OSDLUprightRectangle.cc.
References _x.
Referenced by drawWithRoundedCorners(), OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
void UprightRectangle::setUpperLeftCorner | ( | Point2D & | newUpperLeftCorner | ) | [virtual] |
Sets this UprightRectangle's upper left corner, width and height do not change.
Definition at line 166 of file OSDLUprightRectangle.cc.
References _x, _y, OSDL::Video::TwoDimensional::Point2D::getX(), and OSDL::Video::TwoDimensional::Point2D::getY().
void UprightRectangle::setUpperLeftOrdinate | ( | Coordinate | newOrdinate | ) | [virtual] |
Sets directly the ordinate of the upper left corner of this rectangle.
Definition at line 203 of file OSDLUprightRectangle.cc.
References _y.
Referenced by drawWithRoundedCorners(), OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
void UprightRectangle::setWidth | ( | Length | newWidth | ) | [virtual] |
Sets this UprightRectangle's width.
Reimplemented in OSDL::Video::Surface, and OSDL::Video::TwoDimensional::Widget.
Definition at line 301 of file OSDLUprightRectangle.cc.
References _width.
Referenced by OSDL::Video::TwoDimensional::Widget::updateClientArea(), and OSDL::Video::TwoDimensional::TextWidget::updateClientArea().
LowLevelRect * UprightRectangle::toLowLevelRect | ( | ) | const [virtual] |
Definition at line 801 of file OSDLUprightRectangle.cc.
References _x, _y, getHeight(), and getWidth().
Referenced by OSDL::Video::Surface::blitTo().
const string UprightRectangle::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [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 834 of file OSDLUprightRectangle.cc.
References _x, _y, getHeight(), and getWidth().
Referenced by OSDL::Video::TwoDimensional::Text::Font::blitLatin1MultiLineText(), OSDL::Video::Surface::blitTo(), computeRadiusForRoundRectangle(), operator<<(), setLowerRightAbscissa(), setLowerRightCorner(), setLowerRightOrdinate(), and OSDL::Video::TwoDimensional::Widget::toString().
Height is count from current ordinate, going down.
Definition at line 509 of file OSDLUprightRectangle.h.
Referenced by getHeight(), setHeight(), setLowerRightCorner(), and setLowerRightOrdinate().
Width is counted from current abscissa, going right.
Definition at line 505 of file OSDLUprightRectangle.h.
Referenced by getWidth(), setLowerRightAbscissa(), setLowerRightCorner(), and setWidth().
Upper left corner's abscissa (horizontal coordinate).
Definition at line 491 of file OSDLUprightRectangle.h.
Referenced by draw(), drawWithRoundedCorners(), OSDL::Video::Surface::fill(), getLowerRightAbscissa(), getLowerRightCorner(), getUpperLeftAbscissa(), getUpperLeftCorner(), operator==(), setLowerRightAbscissa(), setLowerRightCorner(), setUpperLeftAbscissa(), setUpperLeftCorner(), toLowLevelRect(), and toString().
Upper left corner's ordinate (vertical coordinate).
Definition at line 495 of file OSDLUprightRectangle.h.
Referenced by draw(), drawWithRoundedCorners(), OSDL::Video::Surface::fill(), getLowerRightCorner(), getLowerRightOrdinate(), getUpperLeftCorner(), getUpperLeftOrdinate(), operator==(), setLowerRightCorner(), setLowerRightOrdinate(), setUpperLeftCorner(), setUpperLeftOrdinate(), toLowLevelRect(), and toString().