Flutter Engine
The Flutter Engine
|
#include <SkRegion.h>
Classes | |
class | Cliperator |
class | Iterator |
struct | RunHead |
class | Spanerator |
Public Types | |
enum | Op { kDifference_Op , kIntersect_Op , kUnion_Op , kXOR_Op , kReverseDifference_Op , kReplace_Op , kLastOp = kReplace_Op } |
using | sk_is_trivially_relocatable = std::true_type |
Public Member Functions | |
SkRegion () | |
SkRegion (const SkRegion ®ion) | |
SkRegion (const SkIRect &rect) | |
~SkRegion () | |
SkRegion & | operator= (const SkRegion ®ion) |
bool | operator== (const SkRegion &other) const |
bool | operator!= (const SkRegion &other) const |
bool | set (const SkRegion &src) |
void | swap (SkRegion &other) |
bool | isEmpty () const |
bool | isRect () const |
bool | isComplex () const |
const SkIRect & | getBounds () const |
int | computeRegionComplexity () const |
bool | getBoundaryPath (SkPath *path) const |
bool | setEmpty () |
bool | setRect (const SkIRect &rect) |
bool | setRects (const SkIRect rects[], int count) |
bool | setRegion (const SkRegion ®ion) |
bool | setPath (const SkPath &path, const SkRegion &clip) |
bool | intersects (const SkIRect &rect) const |
bool | intersects (const SkRegion &other) const |
bool | contains (int32_t x, int32_t y) const |
bool | contains (const SkIRect &other) const |
bool | contains (const SkRegion &other) const |
bool | quickContains (const SkIRect &r) const |
bool | quickReject (const SkIRect &rect) const |
bool | quickReject (const SkRegion &rgn) const |
void | translate (int dx, int dy) |
void | translate (int dx, int dy, SkRegion *dst) const |
bool | op (const SkIRect &rect, Op op) |
bool | op (const SkRegion &rgn, Op op) |
bool | op (const SkIRect &rect, const SkRegion &rgn, Op op) |
bool | op (const SkRegion &rgn, const SkIRect &rect, Op op) |
bool | op (const SkRegion &rgna, const SkRegion &rgnb, Op op) |
size_t | writeToMemory (void *buffer) const |
size_t | readFromMemory (const void *buffer, size_t length) |
Static Public Attributes | |
static const int | kOpCnt = kLastOp + 1 |
Friends | |
struct | RunHead |
class | Iterator |
class | Spanerator |
class | SkRegionPriv |
class | SkRgnBuilder |
class | SkFlatRegion |
SkRegion describes the set of pixels used to clip SkCanvas. SkRegion is compact, efficiently storing a single integer rectangle, or a run length encoded array of rectangles. SkRegion may reduce the current SkCanvas clip, or may be drawn as one or more integer rectangles. SkRegion iterator returns the scan lines or rectangles contained by it, optionally intersecting a bounding rectangle.
Definition at line 30 of file SkRegion.h.
using SkRegion::sk_is_trivially_relocatable = std::true_type |
Definition at line 616 of file SkRegion.h.
enum SkRegion::Op |
Definition at line 366 of file SkRegion.h.
SkRegion::SkRegion | ( | ) |
Constructs an empty SkRegion. SkRegion is set to empty bounds at (0, 0) with zero width and height.
example: https://fiddle.skia.org/c/@Region_empty_constructor
Definition at line 123 of file SkRegion.cpp.
SkRegion::SkRegion | ( | const SkRegion & | region | ) |
Constructs a copy of an existing region. Copy constructor makes two regions identical by value. Internally, region and the returned result share pointer values. The underlying SkRect array is copied when modified.
Creating a SkRegion copy is very efficient and never allocates memory. SkRegion are always copied by value from the interface; the underlying shared pointers are not exposed.
region | SkRegion to copy by value |
example: https://fiddle.skia.org/c/@Region_copy_const_SkRegion
Definition at line 128 of file SkRegion.cpp.
|
explicit |
Constructs a rectangular SkRegion matching the bounds of rect.
rect | bounds of constructed SkRegion |
example: https://fiddle.skia.org/c/@Region_copy_const_SkIRect
Definition at line 133 of file SkRegion.cpp.
SkRegion::~SkRegion | ( | ) |
Releases ownership of any shared data and deletes data if SkRegion is sole owner.
example: https://fiddle.skia.org/c/@Region_destructor
Definition at line 138 of file SkRegion.cpp.
int SkRegion::computeRegionComplexity | ( | ) | const |
Returns a value that increases with the number of elements in SkRegion. Returns zero if SkRegion is empty. Returns one if SkRegion equals SkIRect; otherwise, returns value greater than one indicating that SkRegion is complex.
Call to compare SkRegion for relative complexity.
example: https://fiddle.skia.org/c/@Region_computeRegionComplexity
Definition at line 176 of file SkRegion.cpp.
bool SkRegion::contains | ( | const SkIRect & | other | ) | const |
Returns true if other is completely inside SkRegion. Returns false if SkRegion or other is empty.
other | SkIRect to contain |
example: https://fiddle.skia.org/c/@Region_contains_2
Definition at line 422 of file SkRegion.cpp.
bool SkRegion::contains | ( | const SkRegion & | other | ) | const |
Returns true if other is completely inside SkRegion. Returns false if SkRegion or other is empty.
other | SkRegion to contain |
example: https://fiddle.skia.org/c/@Region_contains_3
Definition at line 446 of file SkRegion.cpp.
bool SkRegion::contains | ( | int32_t | x, |
int32_t | y | ||
) | const |
Returns true if SkIPoint (x, y) is inside SkRegion. Returns false if SkRegion is empty.
example: https://fiddle.skia.org/c/@Region_contains
Definition at line 364 of file SkRegion.cpp.
bool SkRegion::getBoundaryPath | ( | SkPath * | path | ) | const |
Appends outline of SkRegion to path. Returns true if SkRegion is not empty; otherwise, returns false, and leaves path unmodified.
path | SkPath to append to |
example: https://fiddle.skia.org/c/@Region_getBoundaryPath
Definition at line 551 of file SkRegion_path.cpp.
|
inline |
bool SkRegion::intersects | ( | const SkIRect & | rect | ) | const |
Returns true if SkRegion intersects rect. Returns false if either rect or SkRegion is empty, or do not intersect.
rect | SkIRect to intersect |
example: https://fiddle.skia.org/c/@Region_intersects
Definition at line 502 of file SkRegion.cpp.
bool SkRegion::intersects | ( | const SkRegion & | other | ) | const |
Returns true if SkRegion intersects other. Returns false if either other or SkRegion is empty, or do not intersect.
other | SkRegion to intersect |
example: https://fiddle.skia.org/c/@Region_intersects_2
Definition at line 531 of file SkRegion.cpp.
|
inline |
|
inline |
Returns true if SkRegion is empty. Empty SkRegion has bounds width or height less than or equal to zero. SkRegion() constructs empty SkRegion; setEmpty() and setRect() with dimensionless data make SkRegion empty.
Definition at line 146 of file SkRegion.h.
|
inline |
Replaces SkRegion with the result of rect op rgn. Returns true if replaced SkRegion is not empty.
example: https://fiddle.skia.org/c/@Region_op_4
Definition at line 217 of file SkRegion.cpp.
Replaces SkRegion with the result of rgn op rect. Returns true if replaced SkRegion is not empty.
example: https://fiddle.skia.org/c/@Region_op_5
Definition at line 223 of file SkRegion.cpp.
Replaces SkRegion with the result of rgna op rgnb. Returns true if replaced SkRegion is not empty.
example: https://fiddle.skia.org/c/@Region_op_6
Definition at line 1142 of file SkRegion.cpp.
|
inline |
Compares SkRegion and other; returns true if they do not enclose the same area.
other | SkRegion to compare |
Definition at line 105 of file SkRegion.h.
Constructs a copy of an existing region. Makes two regions identical by value. Internally, region and the returned result share pointer values. The underlying SkRect array is copied when modified.
Creating a SkRegion copy is very efficient and never allocates memory. SkRegion are always copied by value from the interface; the underlying shared pointers are not exposed.
region | SkRegion to copy by value |
example: https://fiddle.skia.org/c/@Region_copy_operator
Definition at line 165 of file SkRegion.cpp.
bool SkRegion::operator== | ( | const SkRegion & | other | ) | const |
Compares SkRegion and other; returns true if they enclose exactly the same area.
other | SkRegion to compare |
example: https://fiddle.skia.org/c/@Region_equal1_operator
Definition at line 559 of file SkRegion.cpp.
|
inline |
Returns true if SkRegion is a single rectangle and contains r. May return false even though SkRegion contains r.
r | SkIRect to contain |
Definition at line 310 of file SkRegion.h.
|
inline |
|
inline |
size_t SkRegion::readFromMemory | ( | const void * | buffer, |
size_t | length | ||
) |
Constructs SkRegion from buffer of size length. Returns bytes read. Returned value will be multiple of four or zero if length was too small.
buffer | storage for binary data |
length | size of buffer |
example: https://fiddle.skia.org/c/@Region_readFromMemory
Definition at line 1276 of file SkRegion.cpp.
|
inline |
Sets SkRegion to src, and returns true if src bounds is not empty. This makes SkRegion and src identical by value. Internally, SkRegion and src share pointer values. The underlying SkRect array is copied when modified.
Creating a SkRegion copy is very efficient and never allocates memory. SkRegion are always copied by value from the interface; the underlying shared pointers are not exposed.
src | SkRegion to copy |
Definition at line 121 of file SkRegion.h.
bool SkRegion::setEmpty | ( | ) |
Constructs an empty SkRegion. SkRegion is set to empty bounds at (0, 0) with zero width and height. Always returns false.
example: https://fiddle.skia.org/c/@Region_setEmpty
Definition at line 185 of file SkRegion.cpp.
Constructs SkRegion to match outline of path within clip. Returns false if constructed SkRegion is empty.
Constructed SkRegion draws the same pixels as path through clip when anti-aliasing is disabled.
example: https://fiddle.skia.org/c/@Region_setPath
Definition at line 338 of file SkRegion_path.cpp.
bool SkRegion::setRect | ( | const SkIRect & | rect | ) |
Constructs a rectangular SkRegion matching the bounds of rect. If rect is empty, constructs empty and returns false.
rect | bounds of constructed SkRegion |
example: https://fiddle.skia.org/c/@Region_setRect
Definition at line 192 of file SkRegion.cpp.
Constructs SkRegion as the union of SkIRect in rects array. If count is zero, constructs empty SkRegion. Returns false if constructed SkRegion is empty.
May be faster than repeated calls to op().
rects | array of SkIRect |
count | array size |
example: https://fiddle.skia.org/c/@Region_setRects
Definition at line 657 of file SkRegion.cpp.
bool SkRegion::setRegion | ( | const SkRegion & | region | ) |
Constructs a copy of an existing region. Makes two regions identical by value. Internally, region and the returned result share pointer values. The underlying SkRect array is copied when modified.
Creating a SkRegion copy is very efficient and never allocates memory. SkRegion are always copied by value from the interface; the underlying shared pointers are not exposed.
region | SkRegion to copy by value |
example: https://fiddle.skia.org/c/@Region_setRegion
Definition at line 204 of file SkRegion.cpp.
void SkRegion::swap | ( | SkRegion & | other | ) |
Exchanges SkIRect array of SkRegion and other. swap() internally exchanges pointers, so it is lightweight and does not allocate memory.
swap() usage has largely been replaced by operator=(const SkRegion& region). SkPath do not copy their content on assignment until they are written to, making assignment as efficient as swap().
other | operator=(const SkRegion& region) set |
example: https://fiddle.skia.org/c/@Region_swap
Definition at line 170 of file SkRegion.cpp.
Offsets SkRegion by ivector (dx, dy). Has no effect if SkRegion is empty.
dx | x-axis offset |
dy | y-axis offset |
Definition at line 349 of file SkRegion.h.
Offsets SkRegion by ivector (dx, dy), writing result to dst. SkRegion may be passed as dst parameter, translating SkRegion in place. Has no effect if dst is nullptr. If SkRegion is empty, sets dst to empty.
dx | x-axis offset |
dy | y-axis offset |
dst | translated result |
example: https://fiddle.skia.org/c/@Region_translate_2
Definition at line 596 of file SkRegion.cpp.
size_t SkRegion::writeToMemory | ( | void * | buffer | ) | const |
Writes SkRegion to buffer, and returns number of bytes written. If buffer is nullptr, returns number number of bytes that would be written.
buffer | storage for binary data |
example: https://fiddle.skia.org/c/@Region_writeToMemory
Definition at line 1149 of file SkRegion.cpp.
|
friend |
Definition at line 677 of file SkRegion.h.
|
friend |
Definition at line 676 of file SkRegion.h.
|
friend |
Definition at line 681 of file SkRegion.h.
|
friend |
Definition at line 679 of file SkRegion.h.
|
friend |
Definition at line 680 of file SkRegion.h.
|
friend |
Definition at line 678 of file SkRegion.h.
Definition at line 376 of file SkRegion.h.