// First pass: compute the total len.
SkScalar len = 0;
SkPathMeasure meas(src, false); do {
len += meas.getLength();
} while (meas.nextContour());
constauto arcStart = len * fStartT,
arcStop = len * fStopT;
// Second pass: actually add segments. if (fMode == SkTrimPathEffect::Mode::kNormal) { // Normal mode -> one span. if (arcStart < arcStop) {
add_segments(src, arcStart, arcStop, dst);
}
} else { // Inverted mode -> one logical span which wraps around at the end -> two actual spans. // In order to preserve closed path continuity: // // 1) add the second/tail span first // // 2) skip the head span move-to for single-closed-contour paths
bool requires_moveto = true; if (arcStop < len) { // since we're adding the "tail" first, this is the total number of contours constauto contour_count = add_segments(src, arcStop, len, dst);
// if the path consists of a single closed contour, we don't want to disconnect // the two parts with a moveto. if (contour_count == 1 && src.isLastContourClosed()) {
requires_moveto = false;
}
} if (0 < arcStart) {
add_segments(src, 0, arcStart, dst, requires_moveto);
}
}
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.