OSDL::Video::TwoDimensional::UprightRectangle Class Reference

This classes defines a rectangle whose sides are parallel or orthogonal to the screen's sides. More...

#include <OSDLUprightRectangle.h>

Inheritance diagram for OSDL::Video::TwoDimensional::UprightRectangle:
Inheritance graph
[legend]

List of all members.

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 LowLevelRecttoLowLevelRect () 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.
UprightRectangleoperator= (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.

Detailed Description

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.

Note:
When width or height for an upright rectangle is to be retrieved, even in its own implementation or in the one of its children, getWidth() and getHeight() should always be used, instead of _width and _height, since one child class may overload these two get methods (see Surface for an example).

Definition at line 168 of file OSDLUprightRectangle.h.


Constructor & Destructor Documentation

UprightRectangle::UprightRectangle ( const Point2D upperLeftCorner,
const Point2D lowerRightCorner 
)
UprightRectangle::UprightRectangle ( const Point2D upperLeftCorner,
Length  width,
Length  height 
)

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.

Exceptions:
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.


Member Function Documentation

OSDL::Video::TwoDimensional::UprightRectangle::bool::operator== ( const UprightRectangle first,
const UprightRectangle second 
) [private]
Length UprightRectangle::computeRadiusForRoundRectangle ( Length  edgeWidth  )  const [virtual]

Computes the preferred radius of round corners for this rectangle, with the specified edge width.

Parameters:
edgeWidth the edge width to take into account for the radius.
Returns:
a suitable radius, whose dimension is deemed appropriate.
Exceptions:
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.

Parameters:
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.
Note:
Locks surface if needed.

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.

Parameters:
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.
Note:
Locks surface if needed.

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.

Parameters:
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.
Note:
Locks surface if needed.

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]
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]
Point2D UprightRectangle::getUpperLeftCorner (  )  const [virtual]

Returns this UprightRectangle's upper left corner.

Definition at line 157 of file OSDLUprightRectangle.cc.

References _x, and _y.

Coordinate UprightRectangle::getUpperLeftOrdinate (  )  const [virtual]
Length UprightRectangle::getWidth (  )  const [virtual]
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]
void UprightRectangle::setLowerRightAbscissa ( Coordinate  newAbscissa  )  [virtual]

Sets directly the abscissa of the lower right corner of this rectangle.

Exceptions:
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.

Exceptions:
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.

Exceptions:
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]
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.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
Ceylan::TextDisplayable

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().


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 14:06:27 2010 for OSDL by  doxygen 1.6.3