Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

Rect_

 

template <class T>

struct Rect_ : public Moveable< Rect_<T> > 

 

Rect_ is a generic structure describing a rectangular area defined by the coordinates of the upper left corner, left and top, and the coordinates of the bottom right corner, right and bottom. All coordinates are of type T.

 

 

To get a specialized version of Size_, use one of the following:

 

Rect

typedef Rect_<int> Rect

Rect_ with int coordinates.

 


 

Rect16

typedef Rect_<int16> Rect16

Rect_ with int16 coordinates.

 


 

Rect64

typedef Rect_<int64> Rect64

Rect_ with int64 coordinates.

 


 

Rectf

typedef Rect_<double> Rectf

Rect_ with double coordinates.

 

 

Public typedef Detail

 

typedef Point_<T> Pt

A Point_ with it's coordinates of the same type T as Rect_.

 


 

typedef Size_<T> Sz

A Size_ with it's coordinates of the same type T as Rect_.

 

 

Constructor Detail

 

Rect_()

Creates an uninitialized Rect_.

 


 

Rect_(const Value& src)

Default copy constructor.

 


 

Rect_(T l, T t, T r, T b)

Creates a Rect_ and initializes it's coordinates with l, t, r and b.

 


 

Rect_(Pt a, Pt b)

Creates a Rect_ and initializes it's upper left corner with a and it's bottom right corner with b.

 


 

Rect_(Pt a, Sz sz)

Creates a Rect_ and initializes it's upper left corner with a and it's bottom right corner with a + sz.

 


 

Rect_(Sz sz)

Creates a Rect_ and initializes it's upper left corner with (0, 0) and it's bottom right corner with sz.

 


 

Rect_(const Rect_<int>& r)

Creates a Rect_ and initializes it with Rect r.

 


 

Rect_(const Rect_<short>& r)

Creates a Rect_ and initializes it with Rect16 r.

 


 

Rect_(const Rect_<int64>& r)

Creates a Rect_ and initializes it with Rect64 r.

 


 

Rect_(const Rect_<double>& r)

Creates a Rect_ and initializes it with Rectf r.

 


 

Rect_(const Nuller&)

Creates a Rect_ and initializes it with Null.

 

 

Public Field List

 

T left

the horizontal coordinate of the upper left corner

 


 

T top

the vertical coordinate of the upper left corner

 


 

T right

the horizontal coordinate of the lower right corner

 


 

T bottom

the vertical coordinate of the lower right corner

 

 

Public Method List

 

void Clear()

Sets coordinates to 0.

 


 

bool IsEmpty() const

Returns true if right <= left or if bottom <= top.

 


 

bool IsNullInstance() const

Verifies if rectangle is Null.

 


 

T Width() const

T GetWidth() const

Returns the width of the rectangle, equal to right - left.

 


 

T Height() const

T GetHeight() const

Returns the height of the rectangle, equal to bottom - top.

 


 

Sz Size() const

Sz GetSize() const

Returns a size containing the width and the height of the rectangle.

 


 

Pt TopLeft() const

Returns a point containing the top-left coordinates.

 


 

Pt TopCenter() const

Returns a point containing the top-center coordinates.

 


 

Pt TopRight() const

Returns a point containing the top-right coordinates.

 


 

Pt CenterLeft() const

Returns a point containing the center-left coordinates.

 


 

Pt CenterPoint() const

Returns a point containing the coordinates of the center of the rectangle.

 


 

Pt CenterRight() const

Returns a point containing the center-right coordinates.

 


 

Pt BottomLeft() const

Returns a point containing the bottom-left coordinates.

 


 

Pt BottomCenter() const

Returns a point containing the bottom-center coordinates.

 


 

Pt BottomRight() const

Returns a point containing the bottom-right coordinates.

 


 

Pt CenterPos(T cx, T cyconst

Returns the left and top coordinates of an object of sizes cx and cy that is centered inside the rectangle.

 


 

Pt CenterPos(Sz szconst

Returns the left and top coordinates of an object of size sz that is centered inside the rectangle.

 


 

Rect_ CenterRect(T cx, T cyconst

Return the coordinates of a new rectangle with sizes cx and cy centered inside the rectangle.

 


 

Rect_ CenterRect(Sz szconst

Return the coordinates of a new rectangle with size sz centered inside the rectangle.

 


 

void Set(T l, T t, T r, T b)

Initializes rectangle's coordinates with l, t, r and b.

 


 

void Set(Pt a, Pt b)

Initializes rectangles upper left corner with a and it's bottom right corner with b.

 


 

void Set(Pt a, Sz sz)

Initializes rectangle's upper left corner with a and it's bottom right corner with a + sz.

 


 

void Set(const Rect_& r)

Initializes rectangles coordinates with the ones of r.

 


 

void SetSize(int cx, int cy)

Sets the width of the rectangle to cx and the height to cy.

 


 

void SetSize(Sz sz)

Sets the width and height of the rectangle to sz.

 


 

void InflateHorz(T dx)

Inflates the rectangle horizontally by dx. Inflating a rectangle horizontally results in having it's left coordinate decreased and it's right coordinate increased.

 


 

void InflateVert(T dy)

Inflates the rectangle vertically by dy. Inflating a rectangle vertically results in having it's top coordinate decreased and it's bottom coordinate increased.

 


 

void Inflate(T dx, T dy)

Inflates the rectangle horizontally by dx and vertically by dy.

 


 

void Inflate(Sz sz)

Inflates the rectangle horizontally by the horizontal dimension of sz and vertically by the vertical one.

 


 

void Inflate(T dxy)

Inflates the rectangle uniformly by dxy.

 


 

void Inflate(T l, T t, T r, T b)

Inflates the rectangle by l, t, r and b.

 


 

void Inflate(const Rect_& r)

Inflates the rectangle by r.left, r.top, r.right and r.bottom.

 


 

void DeflateHorz(T dx)

Deflates the rectangle horizontally by dx. Deflating a rectangle horizontally results in having it's left coordinate increased and it's right coordinate decreased.

 


 

void DeflateVert(T dy)

Deflates the rectangle vertically by dy. Deflating a rectangle vertically results in having it's top coordinate increased and it's bottom coordinate decreased.

 


 

void Deflate(T dx, T dy)

Deflates the rectangle horizontally by dx and vertically by dy.

 


 

void Deflate(Sz sz)

Deflates the rectangle horizontally by the horizontal dimension of sz and vertically by the vertical one.

 


 

void Deflate(T dxy)

Deflates the rectangle uniformly by dxy.

 


 

void Deflate(T l, T t, T r, T b)

Deflates the rectangle by l, t, r and b.

 


 

void Deflate(const Rect_& r)

Deflates the rectangle by r.left, r.top, r.right and r.bottom.

 


 

Rect_ InflatedHorz(T dxconst

Returns the result of inflating the rectangle horizontally by dx.

 


 

Rect_ InflatedVert(T dyconst

Returns the result of inflating the rectangle horizontally by dx.

 


 

Rect_ Inflated(T dx, T dyconst

Rect_ Inflated(Sz szconst

Rect_ Inflated(T dxyconst

Rect_ Inflated(T l, T t, T r, T bconst

Rect_ Inflated(const Rect_& qconst

Returns the result of inflating the rectangle with the amount specified by the respective parameters.

 


 

Rect_ DeflatedHorz(T dxconst

Returns the result of deflating the rectangle horizontally by dx.

 


 

Rect_ DeflatedVert(T dyconst

Returns the result of deflating the rectangle horizontally by dx.

 


 

Rect_ Deflated(T dx, T dyconst

Rect_ Deflated(Sz szconst

Rect_ Deflated(T dxyconst

Rect_ Deflated(T l, T t, T r, T bconst

Rect_ Deflated(const Rect_& qconst

Returns the result of deflating the rectangle with the amount specified by the respective parameters.

 

 

Last edit by cbpporter on 01/29/2010. Do you want to contribute?. T++