Rect Class Reference

#include <Pt/Gfx/Rect.h>

Rect with floating-point coordinates.

Public Member Functions

bool isEmpty () const
 Returns true if width or height is zero.
 
Rect toIntersected (const Rect &rect) const
 Returns the intersection of this rect and another, or an empty rect if they do not overlap.
 
bool contains (const Point &p) const
 Returns true if the given point is inside or on the edge of this rect.
 
bool contains (const Rect &r) const
 Returns true if the given rect is entirely inside this rect.
 
bool intersects (const Rect &r) const
 Returns true if this rect overlaps with the given rect.
 
Point center () const
 Returns the center point of this rect.
 
void normalize ()
 Normalizes this rect so that width and height are non-negative.
 
Rect toNormalized () const
 Returns a normalized copy of this rect.
 
 Rect (const RectI &r)
 Constructs from a RectI by widening the coordinates.
 
Rectoperator= (const RectI &r)
 Assigns from a RectI by widening the coordinates.
 
RectI round () const
 Rounds each component to the nearest integer and returns a RectI.
 
RectI floor () const
 Floors each component and returns a RectI.
 
RectI ceil () const
 Ceils each component and returns a RectI.
 
RectI roundOut () const
 Returns the smallest enclosing integer rect.
 
RectI roundIn () const
 Returns the largest integer rect contained within this rect.
 

Static Public Member Functions

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