Tizen Native API
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) vector.
 Uint16Pair (uint32_t width, uint32_t height)
 Constructor taking separate x and y (width and height) parameters.
 Uint16Pair (const Uint16Pair &rhs)
 Copy constructor.
uint16_t GetWidth () const
uint16_t GetHeight () const
 Returns the y dimension stored in this 2-tuple.
uint16_t GetX () const
 Returns the x dimension stored in this 2-tuple.
uint16_t GetY () const
 Returns the y dimension stored in this 2-tuple.
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)
 Create an instance by rounding a floating point vector to closest integers.
template<typename FLOAT_ARRAY >
static Uint16Pair FromFloatArray (const FLOAT_ARRAY &from)
 Create 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). These are immutable. If you want to change a value, make a whole new object. One of these can be passed in a single 32 bit integer register on common architectures.

Since :
2.4

Constructor & Destructor Documentation

Default constructor for the (0, 0) vector.

Since :
2.4
Dali::Uint16Pair::Uint16Pair ( uint32_t  width,
uint32_t  height 
)

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

Since :
2.4
Parameters:
[in]widthThe width or X dimension of the vector. Make sure it is less than 65536,
[in]heightThe height or Y dimension of the vector. Make sure it is less than 65536,

Copy constructor.

Since :
2.4
Parameters:
[in]rhsA reference to the copied Uint16Pair

Member Function Documentation

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

Create 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 :
2.4
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]

Create 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 :
2.4
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 :
2.4
Returns:
Height
uint16_t Dali::Uint16Pair::GetWidth ( ) const
Returns:
the x dimension stored in this 2-tuple.
Since :
2.4
uint16_t Dali::Uint16Pair::GetX ( ) const

Returns the x dimension stored in this 2-tuple.

Since :
2.4
Returns:
X
uint16_t Dali::Uint16Pair::GetY ( ) const

Returns the y dimension stored in this 2-tuple.

Since :
2.4
Returns:
Y
bool Dali::Uint16Pair::operator!= ( const Uint16Pair rhs) const

Inequality operator.

Since :
2.4
Parameters:
i]rhs A 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 :
2.4
Parameters:
i]rhs A reference for comparison
Returns:
True if less
bool Dali::Uint16Pair::operator== ( const Uint16Pair rhs) const

Equality operator.

Since :
2.4
Parameters:
i]rhs A 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 :
2.4
Parameters:
i]rhs A reference for comparison
Returns:
True if greater