Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

CascadeRect Class Reference

represents a rectangle More...

#include <cascade/graphics/CascadeRect.h>

Inheritance diagram for CascadeRect:

CascadeObject List of all members.

Public Member Functions

 CascadeRect ()
 CascadeRect (s32 xx, s32 yy, u32 ww, u32 hh)
 CascadeRect (const CascadeRect &rect)
bool IsObscuredBy (const CascadeRect &rect) const
bool IntersectRect (const CascadeRect &rect) const
bool MakeIntersectRect (const CascadeRect &rect, CascadeRect &intersectRectToMake) const
void MakeUnionRect (const CascadeRect &rect, CascadeRect &unionRectToMake) const
bool PointInRect (const CascadePoint &point) const
CascadePoint TopLeft () const
CascadePoint BottomLeft () const
CascadePoint TopRight () const
CascadePoint BottomRight () const
CascadePoint CenterPoint () const
void MoveTo (const CascadePoint &point)
void MoveCenterTo (const CascadePoint &point)
void InsetRect (s32 dx, s32 dy)
void InflateRect (s32 dx, s32 dy)
void OffsetRect (s32 dx, s32 dy)
bool operator== (const CascadeRect &rect) const
bool operator!= (const CascadeRect &rect) const

Public Attributes

s32 x
s32 y
u32 w
u32 h

Detailed Description

represents a rectangle

Skip the description

CascadeRect represents a rectangle described by (x, y, width, height) whose endpoints are x, y, x + w - 1, y + h - 1


class CascadeRect


Constructor & Destructor Documentation

CascadeRect::CascadeRect  )  [inline]
 

default constructor

The default constructor for CascadeRect initializes the rectangle with zero values.

CascadeRect::CascadeRect s32  xx,
s32  yy,
u32  ww,
u32  hh
[inline]
 

constructor with arguments

This constructor rectangle with the values passed in.

Parameters:
xx the x coordinate of the top-left of the rectangle
yy the y coordinate of the top-left of the rectangle
ww the width of the rectangle
hh the height of the rectangle

CascadeRect::CascadeRect const CascadeRect rect  )  [inline]
 

copy constructor

This copy constructor copies the rectangle from the rect passed in.

Parameters:
rect the rectangle to copy


Member Function Documentation

CascadePoint CascadeRect::BottomLeft  )  const [inline]
 

returns the point at the bottom left of the rectangle

BottomLeft() returns a CascadePoint representing the bottom left point of this rectangle.

Returns:
the bottom-left point of the rectangle

CascadePoint CascadeRect::BottomRight  )  const [inline]
 

returns the point at the bottom right of the rectangle

BottomRight() returns a CascadePoint representing the bottom right point of this rectangle.

Returns:
the bottom-right point of the rectangle

CascadePoint CascadeRect::CenterPoint  )  const [inline]
 

returns the point at the center of the rectangle

CenterPoint() gets the center point of the rectangle, rounded down if a dimension isn't evenly divisible by 2.

Returns:
the point at the center of the rectangle

void CascadeRect::InflateRect s32  dx,
s32  dy
[inline]
 

inflates or shrinks a rectangle

Inflates or shrinks the rectangle by moving its left and right edges out by the number of pixels specified in dx, and the top and bottom edges out by the number of pixels specified in dy. Negative arguments to the function move the edges inward, shrinking the rectangle. The rectangle remains centered on the same point in the coordinate plane, and the size is altered by 2*dx in the horizontal and 2*dy in the vertical. If the size of either dimension shrinks to less than one, the rectangle is set to the empty rectangle (0,0,0,0).

Parameters:
dx the change in x
dy the change in y
Note:
this function is the inverse of InsetRect()
See also:
InsetRect()

void CascadeRect::InsetRect s32  dx,
s32  dy
 

shrinks or inflates a rectangle

Shrinks or inflates the rectangle by moving its left and right edges in by the number of pixels specified in dx, and the top and bottom edges in by the number of pixels specified in dy. Negative arguments to the function move the edges outward, expanding the rectangle. The rectangle remains centered on the same point in the coordinate plane, and the size is altered by 2*dx in the horizontal and 2*dy in the vertical. If the size of either dimension shrinks to less than one, the rectangle is set to the empty rectangle (0,0,0,0).

Parameters:
dx the change in x
dy the change in y
Note:
This function is the inverse of InflateRect()
See also:
InflateRect()

bool CascadeRect::IntersectRect const CascadeRect rect  )  const
 

determines whether a rectangle intersects with this rectangle

IntersectRect() returns true if the rectangle described by rect intersects with the rectangle described by this, false otherwise.

Parameters:
rect the rectangle to test
Returns:
true if rect intersects with this, false otherwise

bool CascadeRect::IsObscuredBy const CascadeRect rect  )  const [inline]
 

determines whether a rectangle obscures this rectangle

IsObscuredBy() returns true if the rectangle described by rect completely overlaps (obscures) the rectangle described by this, false otherwise.

Parameters:
rect the rectangle to test
Returns:
true if rect obscures this, false otherwise

bool CascadeRect::MakeIntersectRect const CascadeRect rect,
CascadeRect intersectRectToMake
const
 

makes the intersection of two rectangles

MakeIntersectRect() sets intersectRectToMake to be the intersection of rect and this, returning true if rect and this intersect, false otherwise. if MakeIntersectRect() returns false, intersectRectToMake is left untouched. intersectRectToMake can refer to either *this or rect successfully.

Parameters:
rect the rect to intersect with this rectangle
intersectRectToMake the rectangle to set with the intersection of rect and this
Returns:
true if the rectangles intersect, false otherwise

void CascadeRect::MakeUnionRect const CascadeRect rect,
CascadeRect unionRectToMake
const
 

makes the union of two rectangles

MakeUnionRect() sets unionRectToMake to be the union of rect and this. unionRectToMake can refer to either *this or rect successfully

Parameters:
rect the rect to union with this rectangle
unionRectToMake the rectangle to set with the union of rect and this

void CascadeRect::MoveCenterTo const CascadePoint point  )  [inline]
 

makes the rectangle centered on a point

Move the center of this rectangle to the supplied point. The center point is calculated as in CenterPoint() -- it is rounded down if a dimension isn't evenly divisible by 2.

Parameters:
point the point to center the rectangle around

void CascadeRect::MoveTo const CascadePoint point  )  [inline]
 

moves the rectangle

Move the rectangle's x & y coordinates to the supplied point.

Parameters:
point the new top-left point for the rectangle

void CascadeRect::OffsetRect s32  dx,
s32  dy
[inline]
 

offsets a rectangle

Offsets the rectangle by moving it's x and y coordinates by the amounts specified.

Parameters:
dx the distance to offset the x coordinate
dy the distance to offset the y coordinate

bool CascadeRect::operator!= const CascadeRect rect  )  const [inline]
 

short desc

This comparison operator determines whether or not two rectangles are not equal.

Parameters:
rect the rectangle to test
Returns:
true if the rectangles are not equal, false if they are equal

bool CascadeRect::operator== const CascadeRect rect  )  const [inline]
 

short desc

This comparison operator determines whether or not two rectangles are equal.

Parameters:
rect the rectangle to test
Returns:
true if the rectangles are equal, false otherwise

bool CascadeRect::PointInRect const CascadePoint point  )  const
 

tests whether or not a point falls within the rect

PointInRect() returns true if point falls within the rectangle described by this, false otherwise

Parameters:
point the point to test
Returns:
whether or not the point falls within the rectangle

CascadePoint CascadeRect::TopLeft  )  const [inline]
 

returns the point at the top left of the rectangle

TopLeft() returns a CascadePoint representing the top left point of this rectangle.

Returns:
the top-left point of the rectangle

CascadePoint CascadeRect::TopRight  )  const [inline]
 

returns the point at the top right of the rectangle

TopRight() returns a CascadePoint representing the top right point of this rectangle.

Returns:
the top-right point of the rectangle


Member Data Documentation

u32 CascadeRect::h
 

the height of the rectangle

h represents the height of the rectangle.

u32 CascadeRect::w
 

the width of the rectangle

w represents the width of the rectangle.

s32 CascadeRect::x
 

the left edge of the rectangle

x represents the left coordinate of the rectangle.

s32 CascadeRect::y
 

the top edge of the rectangle

y represents the top coordinate of the rectangle.


The documentation for this class was generated from the following file:
Generated on Sun Jul 24 14:27:20 2005 for Cascade Library by  doxygen 1.4.1