Flutter Engine
The Flutter Engine
|
#include <SkRect.h>
Public Member Functions | |
constexpr int32_t | left () const |
constexpr int32_t | top () const |
constexpr int32_t | right () const |
constexpr int32_t | bottom () const |
constexpr int32_t | x () const |
constexpr int32_t | y () const |
constexpr SkIPoint | topLeft () const |
constexpr int32_t | width () const |
constexpr int32_t | height () const |
constexpr SkISize | size () const |
constexpr int64_t | width64 () const |
constexpr int64_t | height64 () const |
bool | isEmpty64 () const |
bool | isEmpty () const |
void | setEmpty () |
void | setLTRB (int32_t left, int32_t top, int32_t right, int32_t bottom) |
void | setXYWH (int32_t x, int32_t y, int32_t width, int32_t height) |
void | setWH (int32_t width, int32_t height) |
void | setSize (SkISize size) |
constexpr SkIRect | makeOffset (int32_t dx, int32_t dy) const |
constexpr SkIRect | makeOffset (SkIVector offset) const |
SkIRect | makeInset (int32_t dx, int32_t dy) const |
SkIRect | makeOutset (int32_t dx, int32_t dy) const |
void | offset (int32_t dx, int32_t dy) |
void | offset (const SkIPoint &delta) |
void | offsetTo (int32_t newX, int32_t newY) |
void | inset (int32_t dx, int32_t dy) |
void | outset (int32_t dx, int32_t dy) |
void | adjust (int32_t dL, int32_t dT, int32_t dR, int32_t dB) |
bool | contains (int32_t x, int32_t y) const |
bool | contains (const SkIRect &r) const |
bool | contains (const SkRect &r) const |
bool | containsNoEmptyCheck (const SkIRect &r) const |
bool | intersect (const SkIRect &r) |
bool | intersect (const SkIRect &a, const SkIRect &b) |
void | join (const SkIRect &r) |
void | sort () |
SkIRect | makeSorted () const |
Static Public Member Functions | |
static constexpr SkIRect | MakeEmpty () |
static constexpr SkIRect | MakeWH (int32_t w, int32_t h) |
static constexpr SkIRect | MakeSize (const SkISize &size) |
static constexpr SkIRect | MakePtSize (SkIPoint pt, SkISize size) |
static constexpr SkIRect | MakeLTRB (int32_t l, int32_t t, int32_t r, int32_t b) |
static constexpr SkIRect | MakeXYWH (int32_t x, int32_t y, int32_t w, int32_t h) |
static bool | Intersects (const SkIRect &a, const SkIRect &b) |
Public Attributes | |
int32_t | fLeft = 0 |
smaller x-axis bounds More... | |
int32_t | fTop = 0 |
smaller y-axis bounds More... | |
int32_t | fRight = 0 |
larger x-axis bounds More... | |
int32_t | fBottom = 0 |
larger y-axis bounds More... | |
Friends | |
bool | operator== (const SkIRect &a, const SkIRect &b) |
bool | operator!= (const SkIRect &a, const SkIRect &b) |
SkIRect holds four 32-bit 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 |
Definition at line 446 of file SkRect.h.
|
inlineconstexpr |
|
inline |
|
inline |
|
inline |
Returns true if: fLeft <= x < fRight && fTop <= y < fBottom. Returns false if SkIRect is empty.
Considers input to describe constructed SkIRect: (x, y, x + 1, y + 1) and returns true if constructed area is completely enclosed by SkIRect area.
Definition at line 463 of file SkRect.h.
|
inline |
|
inlineconstexpr |
Returns span on the y-axis. This does not check if SkIRect is sorted, or if result fits in 32-bit signed integer; result may be negative.
Definition at line 165 of file SkRect.h.
|
inlineconstexpr |
|
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 |
Definition at line 411 of file SkRect.h.
Returns true if a intersects b, and sets SkIRect to intersection. Returns false if a does not intersect b, and leaves SkIRect unchanged.
Returns false if either a or b is empty, leaving SkIRect unchanged.
Definition at line 17 of file SkRect.cpp.
|
inline |
Returns true if SkIRect intersects r, and sets SkIRect to intersection. Returns false if SkIRect does not intersect r, and leaves SkIRect unchanged.
Returns false if either r or SkIRect is empty, leaving SkIRect unchanged.
r | limit of result |
Definition at line 513 of file SkRect.h.
|
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 | ) |
Sets SkIRect to the union of itself and r.
Has no effect if r is empty. Otherwise, if SkIRect is empty, sets SkIRect to r.
r | expansion SkIRect |
example: https://fiddle.skia.org/c/@IRect_join_2
Definition at line 31 of file SkRect.cpp.
|
inlineconstexpr |
|
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 |
Definition at line 332 of file SkRect.h.
|
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 |
Definition at line 300 of file SkRect.h.
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 |
Definition at line 350 of file SkRect.h.
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.
Definition at line 78 of file SkRect.h.
|
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 |
Definition at line 384 of file SkRect.h.
|
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 |
Definition at line 367 of file SkRect.h.
|
inline |
|
inline |
Outsets SkIRect by (dx, dy).
If dx is positive, makes SkIRect wider. If dx is negative, makes SkIRect narrower. If dy is positive, makes SkIRect taller. If dy is negative, makes SkIRect shorter.
dx | subtracted to fLeft and added from fRight |
dy | subtracted to fTop and added from fBottom |
Definition at line 428 of file SkRect.h.
|
inlineconstexpr |
|
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.
Definition at line 242 of file SkRect.h.
|
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 |
Definition at line 253 of file SkRect.h.
|
inline |
|
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 |
|
inlineconstexpr |
|
inline |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Returns true if any member in a: fLeft, fTop, fRight, and fBottom; is not identical to the corresponding member in b.
Returns true if all members in a: fLeft, fTop, fRight, and fBottom; are identical to corresponding members in b.