osncore::CRect Class Reference

class osncore::CRect

Defines a two dimensional rectangle data type.

Since
S60 5.0 Draft CRect
Public Member Functions
CRect ()
CRect ( int32 , int32 , int32 , int32 )
CRect (const CPoint &, const CSize &)
CRect (const CSize &)
CRect (const CRect &)
void FastIntersection (const CRect &)
bool32 FastIntersects (const CRect &)
void Intersection ( CRect )
bool32 Intersects ( CRect )
bool32 IsEmpty ()
bool32 IsNormalized ()
void Normalize ()
bool32 operator!= (const CRect &)
CRect & operator+= (const CPoint &)
CRect & operator+= (const CSize &)
CRect & operator-= (const CPoint &)
CRect & operator-= (const CSize &)
bool32 operator== (const CRect &)
Public Attributes
int32 mHeight
int32 mWidth
int32 mX
int32 mY

Constructor & Destructor Documentation

CRect()

CRect ( ) [inline]

Default constructor, initializing the coordinates of the top left corner and the size to ( 0,0 ).

CRect(int32, int32, int32, int32)

CRect ( int32 aX,
int32 aY,
int32 aWidth,
int32 aHeight
) [inline]

Parameterized constructor.

Parameters

int32 aX The first coordinate of the rectangle's top left point.
int32 aY The second coordinate of the rectangle's top left point.
int32 aWidth The width of the rectangle.
int32 aHeight The height of the rectangle.

CRect(const CPoint &, const CSize &)

CRect ( const CPoint & aTopLeft,
const CSize & aSize
) [inline]

Parameterized constructor.

Constructs the rectangle with a point ( top left corner ) and a size.

Parameters

const CPoint & aTopLeft The top left point of the rectangle.
const CSize & aSize The size of the rectangle.

CRect(const CSize &)

CRect ( const CSize & aSize ) [inline]

Parameterized constructor.

Constructs the rectangle with a size. The top left corner is set to (0,0).

Parameters

const CSize & aSize The size of the rectangle.

CRect(const CRect &)

CRect ( const CRect & aRect ) [inline]

Copy constructor.

Parameters

const CRect & aRect The rectangle object to be copied.

Member Functions Documentation

FastIntersection(const CRect &)

void FastIntersection ( const CRect & aRect ) [inline]

Gets the normalized area of intersection between this normalized rectangle and the specified normalized rectangle, and assigns it to this rectangle.

If the two rectangles do not intersect or are not normalized, then, on return, this rectangle is set to be empty.

Because of performance reasons this function should be favored over the Intersection() function, when it is certain that both rectangles are normalized.

Parameters

const CRect & aRect The rectangle to be used with this rectangle to get the area of intersection.

FastIntersects(const CRect &)

bool32 FastIntersects ( const CRect & aRect ) const [inline]

Tests whether this normalized rectangle overlaps with the specified normalized rectangle.

Two rectangles overlap if any point is located within both rectangles. There is no intersection if two adjacent sides touch without overlapping, or if either rectangle is empty. If one of the rectangles isn't normalized, then the function also returns FALSE,

Because of performance reasons this function should favored over the Intersects function, when it is certain that both rectangles are normalized.

Parameters

const CRect & aRect The rectangle to compare with this rectangle for an intersection.

Intersection(CRect)

void Intersection ( CRect aRect ) [inline]

Gets the normalized area of intersection between this rectangle and the specified rectangle, and assigns it to this rectangle.

If the two rectangles do not intersect, then, on return, this rectangle is set to be empty.

Parameters

CRect aRect The rectangle to be used with this rectangle to get the area of intersection.

Intersects(CRect)

bool32 Intersects ( CRect aRect ) const [inline]

Tests whether this rectangle overlaps with the specified rectangle.

Two rectangles overlap if any point is located within both rectangles. There is no intersection if two adjacent sides touch without overlapping, or if either rectangle is empty.

Parameters

CRect aRect The rectangle to compare with this rectangle for an intersection.

IsEmpty()

bool32 IsEmpty ( ) const [inline]

Determines whether the area covered by the rectangle is zero.

IsNormalized()

bool32 IsNormalized ( ) const [inline]

Tests whether the rectangle is normalized.

A rectangle is normalized, when its width and height are both greater than or equal to zero.

Normalize()

void Normalize ( ) [inline]

Ensures that the rectangle's width and height have positive values.

For example, if the rectangle's co-ordinates are such that the top is below the bottom, or the right hand side is to the left of the left hand side, normalisation swaps the co-ordinates of the top and bottom or of the left and right.

operator!=(const CRect &)

bool32 operator!= ( const CRect & aRect ) const [inline]

Compares two rectangles for inequality.

Two rectangles are unequal if the coordinates of their top left corners or their sizes differ.

Parameters

const CRect & aRect The rectangle to compare with this rectangle.

operator+=(const CPoint &)

CRect & operator+= ( const CPoint & aPoint ) [inline]

CPoint addition assignment operator.

The operator moves this CRect's offset by the given point's coordinates.

Parameters

const CPoint & aPoint The CPoint to be added.

operator+=(const CSize &)

CRect & operator+= ( const CSize & aSize ) [inline]

CSize addition assignment operator.

The operator increases this CRect's size by the given size.

Parameters

const CSize & aSize The CSize to be added.

operator-=(const CPoint &)

CRect & operator-= ( const CPoint & aPoint ) [inline]

CPoint subtraction assignment operator.

The operator moves this CRect's offset by the given point's coordinates.

Parameters

const CPoint & aPoint The CPoint to be substracted.

operator-=(const CSize &)

CRect & operator-= ( const CSize & aSize ) [inline]

CSize subtraction assignment operator.

The operator decreases this CRect's size by the given size.

Parameters

const CSize & aSize The CSize to be substracted.

operator==(const CRect &)

bool32 operator== ( const CRect & aRect ) const [inline]

Compares two rectangles for equality.

For two rectangles to be equal, the coordinates of their top left corners and their sizes must be equal.

Parameters

const CRect & aRect The rectangle to compare with this rectangle.

Member Data Documentation

int32 mHeight

int32 mHeight

int32 mWidth

int32 mWidth

int32 mX

int32 mX

The position of the left-hand side of the

int32 mY

int32 mY