SkRect Struct Reference
#include <SkRect.h>
List of all members.
Public Member Functions |
bool | isEmpty () const |
SkScalar | width () const |
SkScalar | height () const |
SkScalar | centerX () const |
SkScalar | centerY () const |
void | toQuad (SkPoint quad[4]) const |
void | setEmpty () |
void | set (const SkIRect &src) |
void | set (SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) |
void | iset (int left, int top, int right, int bottom) |
void | set (const SkPoint pts[], int count) |
void | offset (SkScalar dx, SkScalar dy) |
void | inset (SkScalar dx, SkScalar dy) |
bool | intersect (const SkRect &r) |
bool | intersect (SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) |
bool | intersects (SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) const |
void | join (SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) |
void | join (const SkRect &r) |
bool | contains (const SkPoint &p) const |
bool | contains (SkScalar x, SkScalar y) const |
bool | contains (const SkRect &r) const |
void | round (SkIRect *dst) const |
void | roundOut (SkIRect *dst) const |
void | sort () |
Static Public Member Functions |
static bool | Intersects (const SkRect &a, const SkRect &b) |
Public Attributes |
SkScalar | fLeft |
SkScalar | fTop |
SkScalar | fRight |
SkScalar | fBottom |
Friends |
int | operator== (const SkRect &a, const SkRect &b) |
int | operator!= (const SkRect &a, const SkRect &b) |
Detailed Description
Definition at line 239 of file SkRect.h.
Member Function Documentation
SkScalar SkRect::centerX |
( |
|
) |
const [inline] |
SkScalar SkRect::centerY |
( |
|
) |
const [inline] |
bool SkRect::contains |
( |
const SkRect & |
r |
) |
const [inline] |
Return true if this rectangle contains r. If either rectangle is empty, return false.
Definition at line 401 of file SkRect.h.
Returns true if (x,y) is inside the rectangle. The left and top coordinates of the rectangle are considered to be inside, while the right and bottom coordinates 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. If this rectangle is empty, return false.
Definition at line 391 of file SkRect.h.
bool SkRect::contains |
( |
const SkPoint & |
p |
) |
const [inline] |
Returns true if (p.fX,p.fY) is inside the rectangle. The left and top coordinates of the rectangle are considered to be inside, while the right and bottom coordinates 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. If this rectangle is empty, return false.
Definition at line 378 of file SkRect.h.
SkScalar SkRect::height |
( |
|
) |
const [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 314 of file SkRect.h.
If this rectangle intersects the rectangle specified by left, top, right, bottom, 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.
bool SkRect::intersect |
( |
const SkRect & |
r |
) |
|
If this rectangle intersects r, 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.
static bool SkRect::Intersects |
( |
const SkRect & |
a, |
|
|
const SkRect & |
b | |
|
) |
| | [inline, static] |
Return true if rectangles a and b are not empty and intersect.
Definition at line 350 of file SkRect.h.
Return true if this rectangle is not empty, and the specified sides of a rectangle are not empty, and they intersect.
Definition at line 338 of file SkRect.h.
bool SkRect::isEmpty |
( |
|
) |
const [inline] |
Return true if the rectangle's width or height are <= 0
Definition at line 244 of file SkRect.h.
void SkRect::iset |
( |
int |
left, |
|
|
int |
top, |
|
|
int |
right, |
|
|
int |
bottom | |
|
) |
| | [inline] |
Initialize the rect with the 4 specified integers. The routine handles converting them to scalars (by calling SkIntToScalar)
Definition at line 286 of file SkRect.h.
void SkRect::join |
( |
const SkRect & |
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 367 of file SkRect.h.
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.
Offset set the rectangle by adding dx to its left and right, and adding dy to its top and bottom.
Definition at line 302 of file SkRect.h.
void SkRect::round |
( |
SkIRect * |
dst |
) |
const [inline] |
Set the dst integer rectangle by rounding this rectangle's coordinates to their nearest integer values.
Definition at line 411 of file SkRect.h.
void SkRect::roundOut |
( |
SkIRect * |
dst |
) |
const [inline] |
Set the dst integer rectangle by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bototm.
Definition at line 420 of file SkRect.h.
void SkRect::set |
( |
const SkPoint |
pts[], |
|
|
int |
count | |
|
) |
| | |
Set this rectangle to be the bounds of the array of points. If the array is empty (count == 0), then set this rectangle to the empty rectangle (0,0,0,0)
void SkRect::set |
( |
const SkIRect & |
src |
) |
[inline] |
void SkRect::setEmpty |
( |
|
) |
[inline] |
Set this rectangle to the empty rectangle (0,0,0,0)
Definition at line 265 of file SkRect.h.
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
void SkRect::toQuad |
( |
SkPoint |
quad[4] |
) |
const |
return the 4 points that enclose the rectangle
SkScalar SkRect::width |
( |
|
) |
const [inline] |
Friends And Related Function Documentation
int operator!= |
( |
const SkRect & |
a, |
|
|
const SkRect & |
b | |
|
) |
| | [friend] |
int operator== |
( |
const SkRect & |
a, |
|
|
const SkRect & |
b | |
|
) |
| | [friend] |
Member Data Documentation
The documentation for this struct was generated from the following file: