SkPath::Iter iter(src, false); while (auto rec = iter.next()) {
SkSpan<const SkPoint> pts = rec->fPoints; switch (rec->fVerb) { case SkPathVerb::kMove: // close out the previous (open) contour if (SkPathVerb::kLine == prevVerb) {
dst->lineTo(lastCorner);
}
closed = iter.isClosedContour(); if (closed) {
moveTo = pts[0];
prevIsValid = false;
} else {
dst->moveTo(pts[0]);
prevIsValid = true;
} break; case SkPathVerb::kLine: { bool drawSegment = ComputeStep(pts[0], pts[1], fRadius, &step); // prev corner if (!prevIsValid) {
dst->moveTo(moveTo + step);
prevIsValid = true;
} else {
dst->quadTo(pts[0].fX, pts[0].fY, pts[0].fX + step.fX,
pts[0].fY + step.fY);
} if (drawSegment) {
dst->lineTo(pts[1].fX - step.fX, pts[1].fY - step.fY);
}
lastCorner = pts[1];
prevIsValid = true; break;
} case SkPathVerb::kQuad: // TBD - just replicate the curve for now if (!prevIsValid) {
dst->moveTo(pts[0]);
prevIsValid = true;
}
dst->quadTo(pts[1], pts[2]);
lastCorner = pts[2];
firstStep.set(0, 0); break; case SkPathVerb::kConic: // TBD - just replicate the curve for now if (!prevIsValid) {
dst->moveTo(pts[0]);
prevIsValid = true;
}
dst->conicTo(pts[1], pts[2], rec->conicWeight());
lastCorner = pts[2];
firstStep.set(0, 0); break; case SkPathVerb::kCubic: if (!prevIsValid) {
dst->moveTo(pts[0]);
prevIsValid = true;
} // TBD - just replicate the curve for now
dst->cubicTo(pts[1], pts[2], pts[3]);
lastCorner = pts[3];
firstStep.set(0, 0); break; case SkPathVerb::kClose: if (firstStep.fX || firstStep.fY) {
dst->quadTo(lastCorner.fX, lastCorner.fY,
lastCorner.fX + firstStep.fX,
lastCorner.fY + firstStep.fY);
}
dst->close();
prevIsValid = false; break;
} if (SkPathVerb::kMove == prevVerb) {
firstStep = step;
}
prevVerb = rec->fVerb;
} if (prevIsValid) {
dst->lineTo(lastCorner);
} return true;
}
bool computeFastBounds(SkRect*) const override { // Rounding sharp corners within a path produces a new path that is still contained within // the original's bounds, so leave 'bounds' unmodified. return true;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.