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

DsSize is class that represents the 2D size of a graphic object (width, height) as integer values. More...

#include <ds_geometry.h>

Public Member Functions

 DsSize ()
 Creates a DsSize object of size (0, 0).
 
 DsSize (int32_t w, int32_t h)
 Creates a DsSize object of size (w, h).
 
 DsSize (const DsPoint &p)
 Creates a DsSize object using the X and Y coordinates of a point as width and height.
 
bool operator== (const DsSize &rhs) const
 Comparison operator.
 
bool operator!= (const DsSize &rhs) const
 Comparison operator.
 
DsSize operator- () const
 Unary minus operator. Reverses the signs of both the W and H of the current DsSize object.
 
DsSizeoperator+= (const DsSize &rhs)
 Addition operator - adds a DsSize object to the current DsSize object.
 
DsSizeoperator+= (int32_t rhs)
 Addition operator - adds an integer to the current DsSize object (add to both w and h).
 
DsSizeoperator-= (const DsSize &rhs)
 Subtraction operator - subtracts a DsSize object from the current DsSize object.
 
DsSizeoperator-= (int32_t rhs)
 Subtraction operator - subtracts an integer from the current DsSize object.
 
DsSize saturateMin (const DsSize &min)
 Saturates the current DsSize object components to the minimum specified.
 
DsSize saturateMax (const DsSize &max)
 Saturates the current DsSize object components to the maximum specified.
 
DsSize swap (void)
 Returns a DsSize object with the width and height swapped.
 
DsSize saturate (const DsSize &min, const DsSize &max)
 Saturates the current DsSize object components to the minimum and maximum specified.
 
 operator DsPoint () const
 Conversion operator to DsPoint.
 
 operator DsFPoint () const
 Conversion operator to DsFPoint.
 

Public Attributes

int32_t w
 Width component.
 
int32_t h
 Height component.
 

Friends

DsSize operator+ (const DsSize &lhs, const DsSize &rhs)
 Addition operator - adds two DsSize objects.
 
DsSize operator+ (const DsSize &lhs, int32_t rhs)
 Addition operator - adds two DsSize objects.
 
DsSize operator- (const DsSize &lhs, const DsSize &rhs)
 Subtraction operator - subtracts two DsSize objects.
 
DsSize operator- (const DsSize &lhs, int32_t rhs)
 Subtraction operator - subtracts an integer from a DsSize object.
 
DsSize operator* (const DsSize &lhs, float multiplier)
 Multiplication operator - multiplies both W and H components of a DsSize object with the same multiplier.
 
DsSize operator/ (const DsSize &lhs, float divisor)
 Division operator - divides both W and H components of a DsSize object by the same divisor.
 

Detailed Description

DsSize is class that represents the 2D size of a graphic object (width, height) as integer values.

Constructor & Destructor Documentation

◆ DsSize() [1/2]

DsSize::DsSize ( int32_t  w,
int32_t  h 
)
inline

Creates a DsSize object of size (w, h).

Parameters
wWidth in pixels
hHeight in pixels

◆ DsSize() [2/2]

DsSize::DsSize ( const DsPoint p)
inline

Creates a DsSize object using the X and Y coordinates of a point as width and height.

Parameters
pSource point

Member Function Documentation

◆ operator DsFPoint()

DsSize::operator DsFPoint ( ) const
inline

Conversion operator to DsFPoint.

Returns
DsFPoint object

◆ operator DsPoint()

DsSize::operator DsPoint ( ) const
inline

Conversion operator to DsPoint.

Returns
DsPoint object

◆ operator!=()

bool DsSize::operator!= ( const DsSize rhs) const
inline

Comparison operator.

Parameters
rhsRight hand side DsSize object of the comparison operator

◆ operator+=() [1/2]

DsSize & DsSize::operator+= ( const DsSize rhs)
inline

Addition operator - adds a DsSize object to the current DsSize object.

Parameters
rhsRight hand side DsSize object
Returns
Object reference

◆ operator+=() [2/2]

DsSize & DsSize::operator+= ( int32_t  rhs)
inline

Addition operator - adds an integer to the current DsSize object (add to both w and h).

Parameters
rhsRight hand side value
Returns
Object reference

◆ operator-()

DsSize DsSize::operator- ( ) const
inline

Unary minus operator. Reverses the signs of both the W and H of the current DsSize object.

Returns
DsSize with both the W and H components of the current object having the signs reversed

◆ operator-=() [1/2]

DsSize & DsSize::operator-= ( const DsSize rhs)
inline

Subtraction operator - subtracts a DsSize object from the current DsSize object.

Parameters
rhsRight hand side DsSize object
Returns
Object reference

◆ operator-=() [2/2]

DsSize & DsSize::operator-= ( int32_t  rhs)
inline

Subtraction operator - subtracts an integer from the current DsSize object.

Parameters
rhsRight hand side
Returns
Object reference

◆ operator==()

bool DsSize::operator== ( const DsSize rhs) const
inline

Comparison operator.

Parameters
rhsRight hand side DsSize object of the comparison operator

◆ saturate()

DsSize DsSize::saturate ( const DsSize min,
const DsSize max 
)
inline

Saturates the current DsSize object components to the minimum and maximum specified.

Parameters
minMinimum value
maxMaximum value
Returns
Saturated DsSize object

◆ saturateMax()

DsSize DsSize::saturateMax ( const DsSize max)
inline

Saturates the current DsSize object components to the maximum specified.

Parameters
minMaximum value
Returns
Saturated DsSize object

◆ saturateMin()

DsSize DsSize::saturateMin ( const DsSize min)
inline

Saturates the current DsSize object components to the minimum specified.

Parameters
minMinimum value
Returns
Saturated DsSize object

◆ swap()

DsSize DsSize::swap ( void  )
inline

Returns a DsSize object with the width and height swapped.

Returns
Swapped DsSize object

Friends And Related Symbol Documentation

◆ operator*

DsSize operator* ( const DsSize lhs,
float  multiplier 
)
friend

Multiplication operator - multiplies both W and H components of a DsSize object with the same multiplier.

Parameters
lhsLeft hand side DsSize object
multiplierRight hand side multiplier
Returns
lfs DsSize object multiplied by the multiplier

◆ operator+ [1/2]

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

Addition operator - adds two DsSize objects.

Parameters
lhsLeft hand side DsSize object
rhsRight hand side DsSize object
Returns
The sum of lhs and rhs DsSize objects

◆ operator+ [2/2]

DsSize operator+ ( const DsSize lhs,
int32_t  rhs 
)
friend

Addition operator - adds two DsSize objects.

Parameters
lhsLeft hand side DsSize object
rhsRight hand side value
Returns
The sum of lhs and the rhs value

◆ operator- [1/2]

DsSize operator- ( const DsSize lhs,
const DsSize rhs 
)
friend

Subtraction operator - subtracts two DsSize objects.

Parameters
lhsLeft hand side DsSize object
rhsRight hand side DsSize object
Returns
The difference between lhs and rhs DsSize objects

◆ operator- [2/2]

DsSize operator- ( const DsSize lhs,
int32_t  rhs 
)
friend

Subtraction operator - subtracts an integer from a DsSize object.

Parameters
lhsLeft hand side DsSize object
rhsRight hand side value
Returns
The difference between lhs and rhs DsSize objects

◆ operator/

DsSize operator/ ( const DsSize lhs,
float  divisor 
)
friend

Division operator - divides both W and H components of a DsSize object by the same divisor.

Parameters
lhsLeft hand side DsSize object
divisorRight hand side divisor
Returns
lfs DsSize object divided by the divisor

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