RectI Class Reference

#include <Pt/Gfx/Rect.h>

Rect with integer coordinates.

Public Member Functions

bool isEmpty () const
 Returns true if width or height is zero.
 
RectI toIntersected (const RectI &rect) const
 Returns the intersection of this rect and another, or an empty rect if they do not overlap.
 
bool contains (const PointI &p) const
 Returns true if the given point is inside or on the edge of this rect.
 
bool contains (const RectI &r) const
 Returns true if the given rect is entirely inside this rect.
 
bool intersects (const RectI &r) const
 Returns true if this rect overlaps with the given rect.
 
PointI center () const
 Returns the center point of this rect.
 
void normalize ()
 Normalizes this rect so that width and height are non-negative.
 
RectI toNormalized () const
 Returns a normalized copy of this rect.
 

Static Public Member Functions

static RectI fromLTRB (Int left, Int top, Int right, Int bottom)
 Creates a rect from left, top, right, and bottom edges.
 
static RectI fromXYWH (Int x, Int y, Int w, Int h)
 Creates a rect from x, y, width, and height.