Iridescence 1.00
Embedded Graphic Framework
Loading...
Searching...
No Matches
DsFRect Class Reference

DsFRect is a class that represents a 2D rectangle (X, Y, W, H) using floating point coordiantes and size. More...

#include <ds_geometry.h>

Inheritance diagram for DsFRect:
[legend]

Public Member Functions

 DsFRect ()
 Creates a DsRect object initialized to (0, 0, 0, 0).
 
 DsFRect (const DsRect &r)
 Creates a DsFRect object from a DsRect object.
 
 DsFRect (float x, float y, float w, float h)
 Creates a DsPoint object initialized to (x, y, w, h).
 
 DsFRect (const DsFPoint &pos, const DsFSize &size)
 Creates a DsPoint object initialized to (x, y, w, h).
 
DsFPoint getPosition (void) const
 Gets the position of the rectangle (top left corner).
 
void setPosition (const DsFPoint &pos)
 Sets the position of the rectangle (top left corner).
 
DsFSize getSize (void) const
 Gets the size of the rectangle.
 
void setSize (const DsFSize &size)
 Sets the size of the rectangle.
 
DsFPoint getCenter (void) const
 Gets the position of the center of the rectangle.
 
float area (void) const
 Gets the area of rectangle.
 
bool contains (const DsFPoint &p) const
 Does the rectangle contain a specific point?
 
DsFRect intersect (const DsFRect &r) const
 Gets the intersection rectangle of the current DsRect object with another rectangle.
 
DsFRect move (const DsFPoint &offset) override final
 Moves the current DsRect object by a specified 2D offset.
 
DsFRectcat (const DsFRect &r)
 Concatenates the current DsRect object with another rectangle.
 
DsFRect erode (float size) const
 Erodes the current DsRect object by a specific size.
 
DsFRect erodeHorizontal (float size) const
 Erodes the current DsRect object by a specific size in the horizontal direction.
 
DsFRect erodeLeft (float size) const
 Erodes the current DsRect object by a specific size on the left side only.
 
DsFRect erodeRight (float size) const
 Erodes the current DsRect object by a specific size on the right side only.
 
DsFRect erodeVertical (float size) const
 Erodes the current DsRect object by a specific size in the vertical direction only.
 
DsFRect erodeTop (float size) const
 Erodes the current DsRect object by a specific size on the top side only.
 
DsFRect erodeBottom (float size) const
 Erodes the current DsRect object by a specific size on the bottom side only.
 
DsFRect dilate (float size)
 Dilates the current DsRect object by a specific size.
 
DsFRect dilateTop (float size)
 Dilates the current DsRect object by a specific size on the top side only.
 
DsFRect dilateBotom (float size)
 Dilates the current DsRect object by a specific size on the bottom side only.
 
DsFRect dilateLeft (float size)
 Dilates the current DsRect object by a specific size on the left side only.
 
DsFRect dilateRight (float size)
 Dilates the current DsRect object by a specific size on the right side only.
 
DsFRect getLeftRegion (float split_line)
 Splits the rectangle in two using a vertical line and returns the left rectangle.
 
DsFRect getRightRegion (float split_line)
 Splits the rectangle in two using a vertical line and returns the right rectangle.
 
DsFRect getTopRegion (float split_line)
 Splits the rectangle in two using a horizontal line and returns the top rectangle.
 
DsFRect getBottomRegion (float split_line)
 Splits the rectangle in two using a horizontal line and returns the bottom rectangle.
 
DsFRectalign (const DsFRect &boundary, const DsAlignment &alignment, const DsFPoint &offset=DsFPoint())
 Changes the X and Y components of the current rectangle to align it in the specified parent rectangle.
 
 operator DsRect () const
 Conversion operator to DsPoint.
 
pair< float, float > getVerticalRange (float x) const override final
 
pair< float, float > getHorizontalRange (float y) const override final
 
DsFRect getRect (void) const override final
 
void rotate (const DsSurface &surface) override final
 

Public Attributes

float x
 X coordinate of the top left corner.
 
float y
 Y coordinate of the top left corner.
 
float w
 Width of the rectangle in pixels.
 
float h
 Height of the rectangle in pixels.
 

Friends

DsFRect operator+ (const DsFRect &lhs, const DsFRect &rhs)
 Addition operator - concatenates two DsRect objects.
 

Detailed Description

DsFRect is a class that represents a 2D rectangle (X, Y, W, H) using floating point coordiantes and size.

Constructor & Destructor Documentation

◆ DsFRect() [1/3]

DsFRect::DsFRect ( const DsRect r)
inline

Creates a DsFRect object from a DsRect object.

Parameters
sSource DsRect object

◆ DsFRect() [2/3]

DsFRect::DsFRect ( float  x,
float  y,
float  w,
float  h 
)
inline

Creates a DsPoint object initialized to (x, y, w, h).

Parameters
xX coordinate of the top left corner
yY coordinate of the top left corner
wRectangle width
hRectangle height

◆ DsFRect() [3/3]

DsFRect::DsFRect ( const DsFPoint pos,
const DsFSize size 
)
inline

Creates a DsPoint object initialized to (x, y, w, h).

Parameters
posPosition of the top left corner
sizeRectangle size

Member Function Documentation

◆ align()

DsFRect & DsFRect::align ( const DsFRect boundary,
const DsAlignment alignment,
const DsFPoint offset = DsFPoint() 
)
inline

Changes the X and Y components of the current rectangle to align it in the specified parent rectangle.

Parameters
boundaryThe boundary rectangle
alignmentAlignment mode
offsetOffset to apply to the aligned rectangle
Returns
Reference to the DsRect object

◆ area()

float DsFRect::area ( void  ) const
inline

Gets the area of rectangle.

Returns
Rectangle area

◆ cat()

DsFRect & DsFRect::cat ( const DsFRect r)
inline

Concatenates the current DsRect object with another rectangle.

Parameters
rRectangle to concatenate with the current DsRect object
Returns
Reference to the current DsRect object

◆ contains()

bool DsFRect::contains ( const DsFPoint p) const
inline

Does the rectangle contain a specific point?

Parameters
pPoint to check if it's inside the rectangle
Returns
True if the rectangle contains the specified point

◆ dilate()

DsFRect DsFRect::dilate ( float  size)
inline

Dilates the current DsRect object by a specific size.

Parameters
sizeThe size to dilate the current DsRect by
Returns
New DsRect object

◆ dilateBotom()

DsFRect DsFRect::dilateBotom ( float  size)
inline

Dilates the current DsRect object by a specific size on the bottom side only.

Parameters
sizeThe size to dilate the current DsRect by
Returns
New DsRect object

◆ dilateLeft()

DsFRect DsFRect::dilateLeft ( float  size)
inline

Dilates the current DsRect object by a specific size on the left side only.

Parameters
sizeThe size to dilate the current DsRect by
Returns
New DsRect object

◆ dilateRight()

DsFRect DsFRect::dilateRight ( float  size)
inline

Dilates the current DsRect object by a specific size on the right side only.

Parameters
sizeThe size to dilate the current DsRect by
Returns
New DsRect object

◆ dilateTop()

DsFRect DsFRect::dilateTop ( float  size)
inline

Dilates the current DsRect object by a specific size on the top side only.

Parameters
sizeThe size to dilate the current DsRect by
Returns
New DsRect object

◆ erode()

DsFRect DsFRect::erode ( float  size) const
inline

Erodes the current DsRect object by a specific size.

Parameters
sizeThe size to erode the current DsRect by
Returns
New DsRect object

◆ erodeBottom()

DsFRect DsFRect::erodeBottom ( float  size) const
inline

Erodes the current DsRect object by a specific size on the bottom side only.

Parameters
sizeThe size to erode the current DsRect by
Returns
New DsRect object

◆ erodeHorizontal()

DsFRect DsFRect::erodeHorizontal ( float  size) const
inline

Erodes the current DsRect object by a specific size in the horizontal direction.

Parameters
sizeThe size to erode the current DsRect by
Returns
New DsRect object

◆ erodeLeft()

DsFRect DsFRect::erodeLeft ( float  size) const
inline

Erodes the current DsRect object by a specific size on the left side only.

Parameters
sizeThe size to erode the current DsRect by
Returns
New DsRect object

◆ erodeRight()

DsFRect DsFRect::erodeRight ( float  size) const
inline

Erodes the current DsRect object by a specific size on the right side only.

Parameters
sizeThe size to erode the current DsRect by
Returns
New DsRect object

◆ erodeTop()

DsFRect DsFRect::erodeTop ( float  size) const
inline

Erodes the current DsRect object by a specific size on the top side only.

Parameters
sizeThe size to erode the current DsRect by
Returns
New DsRect object

◆ erodeVertical()

DsFRect DsFRect::erodeVertical ( float  size) const
inline

Erodes the current DsRect object by a specific size in the vertical direction only.

Parameters
sizeThe size to erode the current DsRect by
Returns
New DsRect object

◆ getBottomRegion()

DsFRect DsFRect::getBottomRegion ( float  split_line)
inline

Splits the rectangle in two using a horizontal line and returns the bottom rectangle.

Parameters
split_lineThe Y coordinate of the split line
Returns
Bottom side DsRect object

◆ getCenter()

DsFPoint DsFRect::getCenter ( void  ) const
inline

Gets the position of the center of the rectangle.

Returns
Center position

◆ getHorizontalRange()

pair< float, float > DsFRect::getHorizontalRange ( float  y) const
finaloverridevirtual

Implements DsRegion.

◆ getLeftRegion()

DsFRect DsFRect::getLeftRegion ( float  split_line)
inline

Splits the rectangle in two using a vertical line and returns the left rectangle.

Parameters
split_lineThe X coordinate of the split line
Returns
Left side DsRect object

◆ getPosition()

DsFPoint DsFRect::getPosition ( void  ) const
inline

Gets the position of the rectangle (top left corner).

Returns
Top left corner position

◆ getRect()

DsFRect DsFRect::getRect ( void  ) const
finaloverridevirtual

Implements DsRegion.

◆ getRightRegion()

DsFRect DsFRect::getRightRegion ( float  split_line)
inline

Splits the rectangle in two using a vertical line and returns the right rectangle.

Parameters
split_lineThe X coordinate of the split line
Returns
Right side DsRect object

◆ getSize()

DsFSize DsFRect::getSize ( void  ) const
inline

Gets the size of the rectangle.

Returns
Rectangle size

◆ getTopRegion()

DsFRect DsFRect::getTopRegion ( float  split_line)
inline

Splits the rectangle in two using a horizontal line and returns the top rectangle.

Parameters
split_lineThe Y coordinate of the split line
Returns
Top side DsRect object

◆ getVerticalRange()

pair< float, float > DsFRect::getVerticalRange ( float  x) const
finaloverridevirtual

Implements DsRegion.

◆ intersect()

DsFRect DsFRect::intersect ( const DsFRect r) const
inline

Gets the intersection rectangle of the current DsRect object with another rectangle.

Parameters
rRectangle to intersect with the current DsRect object
Returns
The intersection of the current DsRect object with r

◆ move()

DsFRect DsFRect::move ( const DsFPoint offset)
inlinefinaloverridevirtual

Moves the current DsRect object by a specified 2D offset.

Parameters
offsetOffset (x, y)
Returns
Reference the current DsFRect object

Implements DsRegion.

◆ operator DsRect()

DsFRect::operator DsRect ( ) const
inline

Conversion operator to DsPoint.

Returns
DsPoint object

◆ rotate()

void DsFRect::rotate ( const DsSurface surface)
finaloverridevirtual

Implements DsRegion.

◆ setPosition()

void DsFRect::setPosition ( const DsFPoint pos)
inline

Sets the position of the rectangle (top left corner).

Parameters
posTop left corner position

◆ setSize()

void DsFRect::setSize ( const DsFSize size)
inline

Sets the size of the rectangle.

Parameters
sizeRectangle size

Friends And Related Symbol Documentation

◆ operator+

DsFRect operator+ ( const DsFRect lhs,
const DsFRect rhs 
)
friend

Addition operator - concatenates two DsRect objects.

Parameters
lhsLeft hand side DsRect object
rhsRight hand side DsRect object
Returns
Concatenated rectangles

The documentation for this class was generated from the following file: