Public Member Functions | |
TMCRect (void) | |
TMCRect (const int32 left, const int32 top, const int32 right, const int32 bottom) | |
TMCRect (const TMCPoint &topLeft, const TMCPoint &bottomRight) | |
int32 | L (void) const |
int32 | T (void) const |
int32 | R (void) const |
int32 | B (void) const |
void | CenterInside (const TMCRect &inRect) |
void | CenterTo (const TMCPoint &inCenter) |
void | MaximizeInside (const TMCRect &inBounds, const TMCPoint &inRatio) |
boolean | EqualDimensions (const TMCRect &inRect) const |
boolean | Empty (void) const |
boolean | Valid () const |
boolean | Invalid () const |
boolean | Equal (const TMCRect &inRect) const |
int32 | GetWidth (void) const |
int32 | GetHeight (void) const |
TMCPoint | GetSize (void) const |
TMCPoint | GetCenter (void) const |
int32 | GetArea (void) const |
void | Inset (const int32 dx, const int32 dy) |
boolean | Intersect (const TMCRect &inRect, const boolean inSetEmpty=1) |
void | Offset (const int32 dx, const int32 dy) |
void | PinPoint (const TMCPoint &inPt, TMCPoint &outPoint) const |
TMCPoint | PinPoint (const TMCPoint &inPt) const |
void | Proportion (const TMCRect &inRect) |
void | PtToRect (const TMCPoint &pt1, const TMCPoint &pt2) |
boolean | PtInside (const TMCPoint &srcPt) const |
boolean | RectInside (const TMCRect &inRect) const |
boolean | RectInRect (const TMCRect &inRect) const |
boolean | RectOverRect (const TMCRect &inRect) const |
void | Scale (const float scale) |
void | Set (const int32 inLeft, const int32 inTop, const int32 inRight, const int32 inBottom) |
void | SetFromReal64 (const real64 inLeft, const real64 inTop, const real64 inRight, const real64 inBottom) |
Same than Set but with real32 parameters (thanks to gcc...). | |
void | SetEmpty (void) |
void | SetInvalid (void) |
void | Union (const TMCRect &inRect) |
void | SafeUnion (const TMCRect &inRect) |
void | UnionPt (const TMCPoint &inPt) |
TMCPoint | TopLeft (void) const |
TMCPoint | TopRight (void) const |
TMCPoint | TopCenter (void) const |
TMCPoint | LeftCenter (void) const |
TMCPoint | RightCenter (void) const |
TMCPoint | BottomLeft (void) const |
TMCPoint | BottomRight (void) const |
TMCPoint | BottomCenter (void) const |
int32 | GetSidePos (const ERectangleSide side) const |
returns the value of the field corresponding to the given side of the rectangle | |
void | SetSidePos (const ERectangleSide side, int32 value) |
Sets the value of the field corresponding to the given side of the rectangle. | |
boolean | operator== (const TMCRect &rr) const |
boolean | operator!= (const TMCRect &rr) const |
TMCRect & | operator= (const TMCRect &rr) |
TMCRect & | operator= (const int32 i) |
TMCRect & | operator+= (const TMCPoint &pp) |
TMCRect & | operator-= (const TMCPoint &pp) |
Public Attributes | |
int32 | left |
int32 | top |
int32 | right |
int32 | bottom |
Static Public Attributes | |
static const TMCRect | kZero |
static const TMCRect | kEmpty |
static const TMCRect | kInvalid |
static const TMCRect | kBiggest |
A rectangle class that uses integers.
TMCRect::TMCRect | ( | void | ) | [inline] |
TMCRect::TMCRect | ( | const int32 | left, | |
const int32 | top, | |||
const int32 | right, | |||
const int32 | bottom | |||
) | [inline] |
int32 TMCRect::B | ( | void | ) | const [inline] |
TMCPoint TMCRect::BottomCenter | ( | void | ) | const |
TMCPoint TMCRect::BottomLeft | ( | void | ) | const [inline] |
TMCPoint TMCRect::BottomRight | ( | void | ) | const [inline] |
void TMCRect::CenterInside | ( | const TMCRect & | inRect | ) |
Positions "centerRect" at the center of srcRect.
void TMCRect::CenterTo | ( | const TMCPoint & | inCenter | ) |
Center the rect on a point.
boolean TMCRect::Empty | ( | void | ) | const |
Return TRUE if the rectangle has no width or height.
UIFramework Compatibility: Equal(). Compare the components of the two rectangles and return TRUE if they are all the same.
Compare the components of the two rectangles and return TRUE if they are the same width and height.
int32 TMCRect::GetArea | ( | void | ) | const |
Calculate and return the area of the rectangle.
TMCPoint TMCRect::GetCenter | ( | void | ) | const |
Calculate and return the center of the rectangle.
int32 TMCRect::GetHeight | ( | void | ) | const [inline] |
Calculate and return the height of the rectangle. May return a negative width.
int32 TMCRect::GetSidePos | ( | const ERectangleSide | side | ) | const [inline] |
returns the value of the field corresponding to the given side of the rectangle
TMCPoint TMCRect::GetSize | ( | void | ) | const [inline] |
returns TMCPoint(GetWidth(), GetHeight())
int32 TMCRect::GetWidth | ( | void | ) | const [inline] |
Calculate and return the width of the rectangle. May return a negative width.
void TMCRect::Inset | ( | const int32 | dx, | |
const int32 | dy | |||
) |
InsetRect shrinks or expands the rectangle. The left and right sides are moved by dx; the top and bottom sides are moved by dy. Note: The rectangle is not set to an empty rect (0,0,0,0) if the resulting width or height is less than zero.
Intersect calculates the rectangle that is the intersection of "this" and the input rectangle, and returns TRUE if they indeed intersect or FALSE if they do not. If the rectangles do not intersect, the rect is set either empty or invalid based on the "inSetEmpty" flag.
boolean TMCRect::Invalid | ( | void | ) | const [inline] |
int32 TMCRect::L | ( | void | ) | const [inline] |
TMCPoint TMCRect::LeftCenter | ( | void | ) | const |
Gives "this" the maximum possible size at the center of inBounds that has the same ratio than inRatio
void TMCRect::Offset | ( | const int32 | dx, | |
const int32 | dy | |||
) |
Offset moves the rectangle by adding dx to the horizontal coordinates, and adding dy to the vertical coordinates.
TMCRect& TMCRect::operator= | ( | const int32 | i | ) | [inline] |
Pin the passed in point to within the rectangle and return the resulting point.
Pin the passed in point to within the rectangle and return the resulting point.
void TMCRect::Proportion | ( | const TMCRect & | inRect | ) |
Proportionally map src rect into dst. Warning: zero width or zero height rects are dangerous.
PtInside determines whether a point is enclosed within the specified rectangle, and returns TRUE if so and FALSE if not.
PtToRect returns the smallest rectangle which encloses the two input points.
int32 TMCRect::R | ( | void | ) | const [inline] |
Note: similar to above, but ignores empty rects.
This routine interprets rectangles in the same way that QD does. A rectangle will hit if any of the bits in the bitmap it encloses overlap with any of the bits in the bitmap enclosed by the other rectangle.
RectInside determines whether a rectangle is enclosed within a second rectangle, and returns TRUE if so and FALSE if not.
returns true if rects intersect false otherwise
TMCPoint TMCRect::RightCenter | ( | void | ) | const |
void TMCRect::SafeUnion | ( | const TMCRect & | inRect | ) |
this version of Union rect handle the case when one of the rects is empty
void TMCRect::Scale | ( | const float | scale | ) |
Scales each component. Note: accurate but slow.
void TMCRect::Set | ( | const int32 | inLeft, | |
const int32 | inTop, | |||
const int32 | inRight, | |||
const int32 | inBottom | |||
) | [inline] |
Set assigns the four boundary coordinates to a rectangle. The result is a rectangle with coordinates (left,top,right,bottom).
void TMCRect::SetEmpty | ( | void | ) |
Set the rectangle to no width or height.
void TMCRect::SetFromReal64 | ( | const real64 | inLeft, | |
const real64 | inTop, | |||
const real64 | inRight, | |||
const real64 | inBottom | |||
) | [inline] |
Same than Set but with real32 parameters (thanks to gcc...).
void TMCRect::SetInvalid | ( | void | ) |
Set the rectangle to have negative width or height. This is useful for initializing a rectangle to be the union of a set of rectangles
void TMCRect::SetSidePos | ( | const ERectangleSide | side, | |
int32 | value | |||
) | [inline] |
Sets the value of the field corresponding to the given side of the rectangle.
int32 TMCRect::T | ( | void | ) | const [inline] |
TMCPoint TMCRect::TopCenter | ( | void | ) | const |
TMCPoint TMCRect::TopLeft | ( | void | ) | const [inline] |
TMCPoint TMCRect::TopRight | ( | void | ) | const [inline] |
void TMCRect::Union | ( | const TMCRect & | inRect | ) |
Union calculates the smallest rectangle which encloses both input rectangles. The destination (result) rectangle may also be one of the input rectangles.
void TMCRect::UnionPt | ( | const TMCPoint & | inPt | ) |
UnionPt expands the input rectangle to enclose the input point. If the point is already within the rectangle, nothing is changed.
boolean TMCRect::Valid | ( | void | ) | const [inline] |
int32 TMCRect::bottom |
const TMCRect TMCRect::kBiggest [static] |
const TMCRect TMCRect::kEmpty [static] |
const TMCRect TMCRect::kInvalid [static] |
const TMCRect TMCRect::kZero [static] |
int32 TMCRect::left |
int32 TMCRect::right |
int32 TMCRect::top |