Go to the source code of this file.
◆ SkPathOp
The logical operations that can be performed when combining two paths.
Enumerator |
---|
kDifference_SkPathOp | subtract the op path from the first path
|
kIntersect_SkPathOp | intersect the two paths
|
kUnion_SkPathOp | union (inclusive-or) the two paths
|
kXOR_SkPathOp | exclusive-or the two paths
|
kReverseDifference_SkPathOp | subtract the first path from the op path
|
Definition at line 22 of file SkPathOps.h.
22 {
28};
@ kReverseDifference_SkPathOp
subtract the first path from the op path
@ kDifference_SkPathOp
subtract the op path from the first path
@ kIntersect_SkPathOp
intersect the two paths
@ kUnion_SkPathOp
union (inclusive-or) the two paths
@ kXOR_SkPathOp
exclusive-or the two paths
◆ AsWinding()
Set the result with fill type winding to area equivalent to path. Returns true if successful. Does not detect if path contains contours which contain self-crossings or cross other contours; in these cases, may return true even though result does not fill same area as path.
Returns true if operation was able to produce a result; otherwise, result is unmodified. The result may be the input.
- Parameters
-
path | The path typically with fill type set to even odd. |
result | The equivalent path with fill type set to winding. |
- Returns
- True if winding path was set.
Definition at line 408 of file SkPathOpsAsWinding.cpp.
408 {
409 if (!
path.isFinite()) {
410 return false;
411 }
416 }
419 if (
path.isEmpty() ||
path.isConvex()) {
421 }
422
423 vector<Contour> contours;
425 winder.contourBounds(&contours);
426 if (contours.size() <= 1) {
428 }
429
431 for (
auto&
contour : contours) {
432 winder.inParent(
contour, sorted);
433 }
434
435 if (std::all_of(sorted.fChildren.begin(), sorted.fChildren.end(),
436 [](
const Contour*
contour) ->
bool { return contour->fChildren.empty(); } )) {
438 }
439
440 for (
auto contour : sorted.fChildren) {
441 winder.nextEdge(*
contour, OpAsWinding::Edge::kInitial);
443 if (!winder.checkContainerChildren(
nullptr,
contour)) {
444 return false;
445 }
446 }
447
448 bool reversed = false;
449 for (
auto contour : sorted.fChildren) {
450 reversed |= winder.markReverse(
nullptr,
contour);
451 }
452 if (!reversed) {
454 }
455 *
result = winder.reverseMarkedContours(contours, fillType);
456 return true;
457}
static bool set_result_path(SkPath *result, const SkPath &path, SkPathFillType fillType)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
◆ Op()
Set this path to the result of applying the Op to this path and the specified path: this = (this op operand). The resulting path will be constructed from non-overlapping contours. The curve order is reduced where possible so that cubics may be turned into quadratics, and quadratics maybe turned into lines.
Returns true if operation was able to produce a result; otherwise, result is unmodified.
- Parameters
-
one | The first operand (for difference, the minuend) |
two | The second operand (for difference, the subtrahend) |
op | The operator to apply. |
result | The product of the operands. The result may be one of the inputs. |
- Returns
- True if the operation succeeded.
Definition at line 383 of file SkPathOpsOp.cpp.
383 {
384#if DEBUG_DUMP_VERIFY
385 if (SkPathOpsDebug::gVerifyOp) {
387 ReportOpFail(one, two, op);
388 return false;
389 }
390 VerifyOp(one, two, op, *
result);
391 return true;
392 }
393#endif
395}
#define SkDEBUGPARAMS(...)
bool OpDebug(const SkPath &one, const SkPath &two, SkPathOp op, SkPath *result SkDEBUGPARAMS(bool skipAssert) SkDEBUGPARAMS(const char *testName))
◆ Simplify()
Set this path to a set of non-overlapping contours that describe the same area as the original path. The curve order is reduced where possible so that cubics may be turned into quadratics, and quadratics maybe turned into lines.
Returns true if operation was able to produce a result; otherwise, result is unmodified.
- Parameters
-
path | The path to simplify. |
result | The simplified path. The result may be the input. |
- Returns
- True if simplification succeeded.
Definition at line 283 of file SkPathOpsSimplify.cpp.
283 {
284#if DEBUG_DUMP_VERIFY
285 if (SkPathOpsDebug::gVerifyOp) {
287 ReportSimplifyFail(path);
288 return false;
289 }
290 VerifySimplify(path, *
result);
291 return true;
292 }
293#endif
295}
bool SimplifyDebug(const SkPath &path, SkPath *result SkDEBUGPARAMS(bool skipAssert) SkDEBUGPARAMS(const char *testName))
◆ TightBounds()
Set the resulting rectangle to the tight bounds of the path.
- Parameters
-
path | The path measured. |
result | The tight bounds of the path. |
- Returns
- True if the bounds could be computed.
Definition at line 23 of file SkPathOpsTightBounds.cpp.
23 {
25 bool wellBehaved = true;
27 switch (verb) {
29 moveBounds.
fLeft = std::min(moveBounds.
fLeft, pts[0].fX);
30 moveBounds.
fTop = std::min(moveBounds.
fTop, pts[0].fY);
31 moveBounds.
fRight = std::max(moveBounds.
fRight, pts[0].fX);
33 break;
36 if (!wellBehaved) {
37 break;
38 }
39 wellBehaved &=
between(pts[0].fX, pts[1].fX, pts[2].fX);
40 wellBehaved &=
between(pts[0].fY, pts[1].fY, pts[2].fY);
41 break;
43 if (!wellBehaved) {
44 break;
45 }
46 wellBehaved &=
between(pts[0].fX, pts[1].fX, pts[3].fX);
47 wellBehaved &=
between(pts[0].fY, pts[1].fY, pts[3].fY);
48 wellBehaved &=
between(pts[0].fX, pts[2].fX, pts[3].fX);
49 wellBehaved &=
between(pts[0].fY, pts[2].fY, pts[3].fY);
50 break;
51 default:
52 break;
53 }
54 }
55 if (wellBehaved) {
57 return true;
58 }
64
67 return false;
68 }
71 return true;
72 }
75 while ((current = current->
next())) {
77 }
81 }
82 return true;
83}
static bool between(SkScalar a, SkScalar b, SkScalar c)
bool SortContourList(SkOpContourHead **contourList, bool evenOdd, bool oppEvenOdd)
@ kCubic
SkPath::RawIter returns 4 points.
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
@ kQuad
SkPath::RawIter returns 3 points.
@ kMove
SkPath::RawIter returns 1 point.
const SkPathOpsBounds & bounds() const
Optional< SkRect > bounds
SkScalar fBottom
larger y-axis bounds
SkScalar fLeft
smaller x-axis bounds
SkScalar fRight
larger x-axis bounds
SkScalar fTop
smaller y-axis bounds