Skia
2D Graphics Library

#include <SkRect.h>
Public Member Functions  
int32_t  left () const 
Returns left edge of SkIRect, if sorted. More...  
int32_t  top () const 
Returns top edge of SkIRect, if sorted. More...  
int32_t  right () const 
Returns right edge of SkIRect, if sorted. More...  
int32_t  bottom () const 
Returns bottom edge of SkIRect, if sorted. More...  
int32_t  x () const 
Returns left edge of SkIRect, if sorted. More...  
int32_t  y () const 
Returns top edge of SkIRect, if sorted. More...  
SkIPoint  topLeft () const 
int32_t  width () const 
Returns span on the xaxis. More...  
int32_t  height () const 
Returns span on the yaxis. More...  
SkISize  size () const 
Returns spans on the xaxis and yaxis. More...  
int64_t  width64 () const 
Returns span on the xaxis. More...  
int64_t  height64 () const 
Returns span on the yaxis. More...  
bool  isEmpty64 () const 
Returns true if fLeft is equal to or greater than fRight, or if fTop is equal to or greater than fBottom. More...  
bool  isEmpty () const 
Returns true if width() or height() are zero or negative. More...  
void  setEmpty () 
Sets SkIRect to (0, 0, 0, 0). More...  
void  setLTRB (int32_t left, int32_t top, int32_t right, int32_t bottom) 
Sets SkIRect to (left, top, right, bottom). More...  
void  setXYWH (int32_t x, int32_t y, int32_t width, int32_t height) 
Sets SkIRect to: (x, y, x + width, y + height). More...  
void  setWH (int32_t width, int32_t height) 
constexpr SkIRect  makeOffset (int32_t dx, int32_t dy) const 
Returns SkIRect offset by (dx, dy). More...  
constexpr SkIRect  makeOffset (SkIVector offset) const 
Returns SkIRect offset by (offset.x(), offset.y()). More...  
SkIRect  makeInset (int32_t dx, int32_t dy) const 
Returns SkIRect, inset by (dx, dy). More...  
SkIRect  makeOutset (int32_t dx, int32_t dy) const 
Returns SkIRect, outset by (dx, dy). More...  
void  offset (int32_t dx, int32_t dy) 
Offsets SkIRect by adding dx to fLeft, fRight; and by adding dy to fTop, fBottom. More...  
void  offset (const SkIPoint &delta) 
Offsets SkIRect by adding delta.fX to fLeft, fRight; and by adding delta.fY to fTop, fBottom. More...  
void  offsetTo (int32_t newX, int32_t newY) 
Offsets SkIRect so that fLeft equals newX, and fTop equals newY. More...  
void  inset (int32_t dx, int32_t dy) 
Insets SkIRect by (dx,dy). More...  
void  outset (int32_t dx, int32_t dy) 
Outsets SkIRect by (dx, dy). More...  
void  adjust (int32_t dL, int32_t dT, int32_t dR, int32_t dB) 
Adjusts SkIRect by adding dL to fLeft, dT to fTop, dR to fRight, and dB to fBottom. More...  
bool  contains (int32_t x, int32_t y) const 
Returns true if: fLeft <= x < fRight && fTop <= y < fBottom. More...  
bool  contains (const SkIRect &r) const 
Returns true if SkIRect contains r. More...  
bool  contains (const SkRect &r) const 
Returns true if SkIRect contains r. More...  
bool  containsNoEmptyCheck (const SkIRect &r) const 
Returns true if SkIRect contains construction. More...  
bool  intersect (const SkIRect &r) 
Returns true if SkIRect intersects r, and sets SkIRect to intersection. More...  
bool SK_WARN_UNUSED_RESULT  intersect (const SkIRect &a, const SkIRect &b) 
Returns true if a intersects b, and sets SkIRect to intersection. More...  
void  join (const SkIRect &r) 
Sets SkIRect to the union of itself and r. More...  
void  sort () 
Swaps fLeft and fRight if fLeft is greater than fRight; and swaps fTop and fBottom if fTop is greater than fBottom. More...  
SkIRect  makeSorted () const 
Returns SkIRect with fLeft and fRight swapped if fLeft is greater than fRight; and with fTop and fBottom swapped if fTop is greater than fBottom. More...  
Static Public Member Functions  
static constexpr SkIRect SK_WARN_UNUSED_RESULT  MakeEmpty () 
Returns constructed SkIRect set to (0, 0, 0, 0). More...  
static constexpr SkIRect SK_WARN_UNUSED_RESULT  MakeWH (int32_t w, int32_t h) 
Returns constructed SkIRect set to (0, 0, w, h). More...  
static constexpr SkIRect SK_WARN_UNUSED_RESULT  MakeSize (const SkISize &size) 
Returns constructed SkIRect set to (0, 0, size.width(), size.height()). More...  
static constexpr SkIRect SK_WARN_UNUSED_RESULT  MakePtSize (SkIPoint pt, SkISize size) 
Returns constructed SkIRect set to (pt.x(), pt.y(), pt.x() + size.width(), pt.y() + size.height()). More...  
static constexpr SkIRect SK_WARN_UNUSED_RESULT  MakeLTRB (int32_t l, int32_t t, int32_t r, int32_t b) 
Returns constructed SkIRect set to (l, t, r, b). More...  
static constexpr SkIRect SK_WARN_UNUSED_RESULT  MakeXYWH (int32_t x, int32_t y, int32_t w, int32_t h) 
Returns constructed SkIRect set to: (x, y, x + w, y + h). More...  
static bool  Intersects (const SkIRect &a, const SkIRect &b) 
Returns true if a intersects b. More...  
Public Attributes  
int32_t  fLeft 
smaller xaxis bounds More...  
int32_t  fTop 
smaller yaxis bounds More...  
int32_t  fRight 
larger xaxis bounds More...  
int32_t  fBottom 
larger yaxis bounds More...  
Friends  
bool  operator== (const SkIRect &a, const SkIRect &b) 
Returns true if all members in a: fLeft, fTop, fRight, and fBottom; are identical to corresponding members in b. More...  
bool  operator!= (const SkIRect &a, const SkIRect &b) 
Returns true if any member in a: fLeft, fTop, fRight, and fBottom; is not identical to the corresponding member in b. More...  
SkIRect holds four 32bit integer coordinates describing the upper and lower bounds of a rectangle. SkIRect may be created from outer bounds or from position, width, and height. SkIRect describes an area; if its right is less than or equal to its left, or if its bottom is less than or equal to its top, it is considered empty.

inline 
Adjusts SkIRect by adding dL to fLeft, dT to fTop, dR to fRight, and dB to fBottom.
If dL is positive, narrows SkIRect on the left. If negative, widens it on the left. If dT is positive, shrinks SkIRect on the top. If negative, lengthens it on the top. If dR is positive, narrows SkIRect on the right. If negative, widens it on the right. If dB is positive, shrinks SkIRect on the bottom. If negative, lengthens it on the bottom.
The resulting SkIRect is not checked for validity. Thus, if the resulting SkIRect left is greater than right, the SkIRect will be considered empty. Call sort() after this call if that is not the desired behavior.
dL  offset added to fLeft 
dT  offset added to fTop 
dR  offset added to fRight 
dB  offset added to fBottom 

inline 

inline 

inline 

inline 

inline 

inline 
Returns span on the yaxis.
This does not check if SkIRect is sorted, or if result fits in 32bit signed integer; result may be negative.

inline 

inline 
Insets SkIRect by (dx,dy).
If dx is positive, makes SkIRect narrower. If dx is negative, makes SkIRect wider. If dy is positive, makes SkIRect shorter. If dy is negative, makes SkIRect taller.
dx  offset added to fLeft and subtracted from fRight 
dy  offset added to fTop and subtracted from fBottom 
bool SK_WARN_UNUSED_RESULT SkIRect::intersect  (  const SkIRect &  a, 
const SkIRect &  b  
) 

inline 

inline 

inline 
Returns true if fLeft is equal to or greater than fRight, or if fTop is equal to or greater than fBottom.
Call sort() to reverse rectangles with negative width64() or height64().
void SkIRect::join  (  const SkIRect &  r  ) 

inline 

inlinestaticconstexpr 
Returns constructed SkIRect set to (0, 0, 0, 0).
Many other rectangles are empty; if left is equal to or greater than right, or if top is equal to or greater than bottom. Setting all members to zero is a convenience, but does not designate a special empty rectangle.

inline 
Returns SkIRect, inset by (dx, dy).
If dx is negative, SkIRect returned is wider. If dx is positive, SkIRect returned is narrower. If dy is negative, SkIRect returned is taller. If dy is positive, SkIRect returned is shorter.
dx  offset added to fLeft and subtracted from fRight 
dy  offset added to fTop and subtracted from fBottom 

inlinestaticconstexpr 

inlineconstexpr 
Returns SkIRect offset by (dx, dy).
If dx is negative, SkIRect returned is moved to the left. If dx is positive, SkIRect returned is moved to the right. If dy is negative, SkIRect returned is moved upward. If dy is positive, SkIRect returned is moved downward.
dx  offset added to fLeft and fRight 
dy  offset added to fTop and fBottom 
Returns SkIRect offset by (offset.x(), offset.y()).
If offset.x() is negative, SkIRect returned is moved to the left. If offset.x() is positive, SkIRect returned is moved to the right. If offset.y() is negative, SkIRect returned is moved upward. If offset.y() is positive, SkIRect returned is moved downward.
offset  translation vector 

inline 
Returns SkIRect, outset by (dx, dy).
If dx is negative, SkIRect returned is narrower. If dx is positive, SkIRect returned is wider. If dy is negative, SkIRect returned is shorter. If dy is positive, SkIRect returned is taller.
dx  offset subtracted to fLeft and added from fRight 
dy  offset subtracted to fTop and added from fBottom 

inlinestaticconstexpr 
Returns constructed SkIRect set to (pt.x(), pt.y(), pt.x() + size.width(), pt.y() + size.height()).
Does not validate input; size.width() or size.height() may be negative.

inlinestaticconstexpr 

inline 

inlinestaticconstexpr 

inlinestaticconstexpr 
Returns constructed SkIRect set to: (x, y, x + w, y + h).
Does not validate input; w or h may be negative.
x  stored in fLeft 
y  stored in fTop 
w  added to x and stored in fRight 
h  added to y and stored in fBottom 

inline 
Offsets SkIRect by adding delta.fX to fLeft, fRight; and by adding delta.fY to fTop, fBottom.
If delta.fX is negative, moves SkIRect returned to the left. If delta.fX is positive, moves SkIRect returned to the right. If delta.fY is negative, moves SkIRect returned upward. If delta.fY is positive, moves SkIRect returned downward.
delta  offset added to SkIRect 

inline 
Offsets SkIRect by adding dx to fLeft, fRight; and by adding dy to fTop, fBottom.
If dx is negative, moves SkIRect returned to the left. If dx is positive, moves SkIRect returned to the right. If dy is negative, moves SkIRect returned upward. If dy is positive, moves SkIRect returned downward.
dx  offset added to fLeft and fRight 
dy  offset added to fTop and fBottom 

inline 

inline 

inline 

inline 
Sets SkIRect to (0, 0, 0, 0).
Many other rectangles are empty; if left is equal to or greater than right, or if top is equal to or greater than bottom. Setting all members to zero is a convenience, but does not designate a special empty rectangle.

inline 
Sets SkIRect to (left, top, right, bottom).
left and right are not sorted; left is not necessarily less than right. top and bottom are not sorted; top is not necessarily less than bottom.
left  stored in fLeft 
top  stored in fTop 
right  stored in fRight 
bottom  stored in fBottom 

inline 

inline 
Sets SkIRect to: (x, y, x + width, y + height).
Does not validate input; width or height may be negative.
x  stored in fLeft 
y  stored in fTop 
width  added to x and stored in fRight 
height  added to y and stored in fBottom 

inline 

inline 

inline 

inline 

inline 
Returns span on the xaxis.
This does not check if SkIRect is sorted, or if result fits in 32bit signed integer; result may be negative.

inline 

inline 

inline 
int32_t SkIRect::fBottom 
larger yaxis bounds
int32_t SkIRect::fLeft 
smaller xaxis bounds
int32_t SkIRect::fRight 
larger xaxis bounds
int32_t SkIRect::fTop 
smaller yaxis bounds