Tizen Native API  5.5
Dali::Uint16Pair Class Reference

Simple class for passing around pairs of small unsigned integers. More...

Public Member Functions

 Uint16Pair ()
 Default constructor for the (0, 0) tuple.
 Uint16Pair (uint32_t width, uint32_t height)
 Constructor taking separate x and y (width and height) parameters.
 Uint16Pair (const Uint16Pair &rhs)
 Copy constructor.
void SetWidth (uint16_t width)
 Sets the width.
uint16_t GetWidth () const
 Get the width.
void SetHeight (uint16_t height)
 Sets the height.
uint16_t GetHeight () const
 Returns the y dimension stored in this 2-tuple.
void SetX (uint16_t x)
 Sets the x dimension (same as width).
uint16_t GetX () const
 Returns the x dimension stored in this 2-tuple.
void SetY (uint16_t y)
 Sets the y dimension (same as height).
uint16_t GetY () const
 Returns the y dimension stored in this 2-tuple.
Uint16Pairoperator= (const Uint16Pair &rhs)
 Assignment operator.
bool operator== (const Uint16Pair &rhs) const
 Equality operator.
bool operator!= (const Uint16Pair &rhs) const
 Inequality operator.
bool operator< (const Uint16Pair &rhs) const
 Less than comparison operator for storing in collections (not geometrically meaningful).
bool operator> (const Uint16Pair &rhs) const
 Greater than comparison operator for storing in collections (not geometrically meaningful).

Static Public Member Functions

template<typename FLOAT_VECTOR_N_TYPE >
static Uint16Pair FromFloatVec2 (const FLOAT_VECTOR_N_TYPE &from)
 Creates an instance by rounding a floating point vector to closest integers.
template<typename FLOAT_ARRAY >
static Uint16Pair FromFloatArray (const FLOAT_ARRAY &from)
 Creates an instance by rounding a floating point array to closest integers.

Detailed Description

Simple class for passing around pairs of small unsigned integers.

Use this for integer dimensions and points with limited range such as image sizes and pixel coordinates where a pair of floating point numbers is inefficient and illogical (i.e. the data is inherently integer). One of these can be passed in a single 32 bit integer register on common architectures.

Since:
3.0, DALi version 1.0.0

Constructor & Destructor Documentation

Default constructor for the (0, 0) tuple.

Since:
3.0, DALi version 1.0.0
Dali::Uint16Pair::Uint16Pair ( uint32_t  width,
uint32_t  height 
)

Constructor taking separate x and y (width and height) parameters.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]widthThe width or X dimension of the tuple. Make sure it is less than 65536
[in]heightThe height or Y dimension of the tuple. Make sure it is less than 65536

Copy constructor.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsA reference to assign

Member Function Documentation

template<typename FLOAT_ARRAY >
static Uint16Pair Dali::Uint16Pair::FromFloatArray ( const FLOAT_ARRAY &  from) [static]

Creates an instance by rounding a floating point array to closest integers.

Uses a template to allow any vector type with operator [] to be converted in addition to plain arrays.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]fromFloating point array
Returns:
Closest integer value
template<typename FLOAT_VECTOR_N_TYPE >
static Uint16Pair Dali::Uint16Pair::FromFloatVec2 ( const FLOAT_VECTOR_N_TYPE &  from) [static]

Creates an instance by rounding a floating point vector to closest integers.

Uses a template for loose coupling, to save a header include, and allow any vector type with .x and .y members to be converted.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]fromFloating point vector2
Returns:
Closest integer value
uint16_t Dali::Uint16Pair::GetHeight ( ) const

Returns the y dimension stored in this 2-tuple.

Since:
3.0, DALi version 1.0.0
Returns:
Height
uint16_t Dali::Uint16Pair::GetWidth ( ) const

Get the width.

Since:
3.0, DALi version 1.0.0
Returns:
the x dimension stored in this 2-tuple
uint16_t Dali::Uint16Pair::GetX ( ) const

Returns the x dimension stored in this 2-tuple.

Since:
3.0, DALi version 1.0.0
Returns:
X
uint16_t Dali::Uint16Pair::GetY ( ) const

Returns the y dimension stored in this 2-tuple.

Since:
3.0, DALi version 1.0.0
Returns:
Y
bool Dali::Uint16Pair::operator!= ( const Uint16Pair rhs) const

Inequality operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsA reference for comparison
Returns:
True if different
bool Dali::Uint16Pair::operator< ( const Uint16Pair rhs) const

Less than comparison operator for storing in collections (not geometrically meaningful).

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsA reference for comparison
Returns:
True if less
Uint16Pair& Dali::Uint16Pair::operator= ( const Uint16Pair rhs)

Assignment operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsHandle to an object
Returns:
A reference to this
bool Dali::Uint16Pair::operator== ( const Uint16Pair rhs) const

Equality operator.

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsA reference for comparison
Returns:
True if same
bool Dali::Uint16Pair::operator> ( const Uint16Pair rhs) const

Greater than comparison operator for storing in collections (not geometrically meaningful).

Since:
3.0, DALi version 1.0.0
Parameters:
[in]rhsA reference for comparison
Returns:
True if greater
void Dali::Uint16Pair::SetHeight ( uint16_t  height)

Sets the height.

Since:
3.0, DALi version 1.1.13
Parameters:
[in]heightThe y dimension to be stored in this 2-tuple
void Dali::Uint16Pair::SetWidth ( uint16_t  width)

Sets the width.

Since:
3.0, DALi version 1.1.13
Parameters:
[in]widthThe x dimension to be stored in this 2-tuple
void Dali::Uint16Pair::SetX ( uint16_t  x)

Sets the x dimension (same as width).

Since:
3.0, DALi version 1.1.14
Parameters:
[in]xThe x dimension to be stored in this 2-tuple
void Dali::Uint16Pair::SetY ( uint16_t  y)

Sets the y dimension (same as height).

Since:
3.0, DALi version 1.1.14
Parameters:
[in]yThe y dimension to be stored in this 2-tuple