SkIRect Struct Reference

#include <SkRect.h>

List of all members.

Public Member Functions

bool isEmpty () const
int width () const
int height () const
void setEmpty ()
void set (int32_t left, int32_t top, int32_t right, int32_t bottom)
void offset (int32_t dx, int32_t dy)
void inset (int32_t dx, int32_t dy)
bool contains (int32_t x, int32_t y) const
bool contains (int32_t left, int32_t top, int32_t right, int32_t bottom) const
bool contains (const SkIRect &r) const
bool containsNoEmptyCheck (int32_t left, int32_t top, int32_t right, int32_t bottom) const
bool intersect (const SkIRect &r)
bool intersect (const SkIRect &a, const SkIRect &b)
bool intersectNoEmptyCheck (const SkIRect &a, const SkIRect &b)
bool intersect (int32_t left, int32_t top, int32_t right, int32_t bottom)
void join (int32_t left, int32_t top, int32_t right, int32_t bottom)
void join (const SkIRect &r)
void sort ()

Static Public Member Functions

static bool Intersects (const SkIRect &a, const SkIRect &b)

Public Attributes

int32_t fLeft
int32_t fTop
int32_t fRight
int32_t fBottom

Friends

int operator== (const SkIRect &a, const SkIRect &b)
int operator!= (const SkIRect &a, const SkIRect &b)

Detailed Description

SkIRect holds four 32 bit integer coordinates for a rectangle

Definition at line 26 of file SkRect.h.


Member Function Documentation

bool SkIRect::contains ( const SkIRect r  )  const [inline]

Returns true if the specified rectangle r is inside or equal to this rectangle.

Definition at line 109 of file SkRect.h.

bool SkIRect::contains ( int32_t  left,
int32_t  top,
int32_t  right,
int32_t  bottom 
) const [inline]

Returns true if the 4 specified sides of a rectangle are inside or equal to this rectangle. If either rectangle is empty, contains() returns false.

Definition at line 100 of file SkRect.h.

bool SkIRect::contains ( int32_t  x,
int32_t  y 
) const [inline]

Returns true if (x,y) is inside the rectangle and the rectangle is not empty. The left and top are considered to be inside, while the right and bottom are not. Thus for the rectangle (0, 0, 5, 10), the points (0,0) and (0,9) are inside, while (-1,0) and (5,9) are not.

Definition at line 91 of file SkRect.h.

bool SkIRect::containsNoEmptyCheck ( int32_t  left,
int32_t  top,
int32_t  right,
int32_t  bottom 
) const [inline]

Return true if this rectangle contains the specified rectangle. For speed, this method does not check if either this or the specified rectangles are empty, and if either is, its return value is undefined. In the debugging build however, we assert that both this and the specified rectangles are non-empty.

Definition at line 122 of file SkRect.h.

int SkIRect::height (  )  const [inline]

Returns the rectangle's height. This does not check for a valid rectangle (i.e. top <= bottom) so the result may be negative.

Definition at line 41 of file SkRect.h.

void SkIRect::inset ( int32_t  dx,
int32_t  dy 
) [inline]

Inset the rectangle by (dx,dy). If dx is positive, then the sides are moved inwards, making the rectangle narrower. If dx is negative, then the sides are moved outwards, making the rectangle wider. The same hods true for dy and the top and bottom.

Definition at line 79 of file SkRect.h.

bool SkIRect::intersect ( int32_t  left,
int32_t  top,
int32_t  right,
int32_t  bottom 
) [inline]

If the rectangle specified by left,top,right,bottom intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle. If either rectangle is empty, do nothing and return false.

Definition at line 191 of file SkRect.h.

bool SkIRect::intersect ( const SkIRect a,
const SkIRect b 
) [inline]

If rectangles a and b intersect, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle. If either rectangle is empty, do nothing and return false.

Definition at line 146 of file SkRect.h.

bool SkIRect::intersect ( const SkIRect r  )  [inline]

If r intersects this rectangle, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle. If either rectangle is empty, do nothing and return false.

Definition at line 136 of file SkRect.h.

bool SkIRect::intersectNoEmptyCheck ( const SkIRect a,
const SkIRect b 
) [inline]

If rectangles a and b intersect, return true and set this rectangle to that intersection, otherwise return false and do not change this rectangle. For speed, no check to see if a or b are empty is performed. If either is, then the return result is undefined. In the debug build, we assert that both rectangles are non-empty.

Definition at line 169 of file SkRect.h.

static bool SkIRect::Intersects ( const SkIRect a,
const SkIRect b 
) [inline, static]

Returns true if a and b are not empty, and they intersect

Definition at line 207 of file SkRect.h.

bool SkIRect::isEmpty (  )  const [inline]

Return true if the rectangle's width or height are <= 0

Definition at line 31 of file SkRect.h.

void SkIRect::join ( const SkIRect r  )  [inline]

Update this rectangle to enclose itself and the specified rectangle. If this rectangle is empty, just set it to the specified rectangle. If the specified rectangle is empty, do nothing.

Definition at line 224 of file SkRect.h.

void SkIRect::join ( int32_t  left,
int32_t  top,
int32_t  right,
int32_t  bottom 
)

Update this rectangle to enclose itself and the specified rectangle. If this rectangle is empty, just set it to the specified rectangle. If the specified rectangle is empty, do nothing.

void SkIRect::offset ( int32_t  dx,
int32_t  dy 
) [inline]

Offset set the rectangle by adding dx to its left and right, and adding dy to its top and bottom.

Definition at line 67 of file SkRect.h.

void SkIRect::set ( int32_t  left,
int32_t  top,
int32_t  right,
int32_t  bottom 
) [inline]

Definition at line 56 of file SkRect.h.

void SkIRect::setEmpty (  )  [inline]

Set the rectangle to (0,0,0,0)

Definition at line 54 of file SkRect.h.

void SkIRect::sort (  ) 

Swap top/bottom or left/right if there are flipped. This can be called if the edges are computed separately, and may have crossed over each other. When this returns, left <= right && top <= bottom

int SkIRect::width (  )  const [inline]

Returns the rectangle's width. This does not check for a valid rectangle (i.e. left <= right) so the result may be negative.

Definition at line 36 of file SkRect.h.


Friends And Related Function Documentation

int operator!= ( const SkIRect a,
const SkIRect b 
) [friend]

Definition at line 47 of file SkRect.h.

int operator== ( const SkIRect a,
const SkIRect b 
) [friend]

Definition at line 43 of file SkRect.h.


Member Data Documentation

Definition at line 27 of file SkRect.h.

int32_t SkIRect::fLeft

Definition at line 27 of file SkRect.h.

int32_t SkIRect::fRight

Definition at line 27 of file SkRect.h.

int32_t SkIRect::fTop

Definition at line 27 of file SkRect.h.


The documentation for this struct was generated from the following file:

Generated on Tue Oct 20 11:03:42 2009 for Skia by  doxygen 1.6.1