Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: include/core/SkPath.h

Issue 1613303002: Add svg path arcto (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use enums for arcto's sweep and largeArc params Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/arcto.cpp ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPath.h
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 695271981550a0038b788003cd88befc81516297..7c6fd35d5af8798c74e499644b606c435081d40f 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -499,10 +499,12 @@ public:
this->arcTo(p1.fX, p1.fY, p2.fX, p2.fY, radius);
}
- /** Close the current contour. If the current point is not equal to the
- first point of the contour, a line segment is automatically added.
- */
- void close();
+ enum ArcSize {
+ /** the smaller of the two possible SVG arcs. */
+ kSmall_ArcSize,
+ /** the larger of the two possible SVG arcs. */
+ kLarge_ArcSize,
+ };
enum Direction {
/** clockwise direction for adding closed contours */
@@ -512,6 +514,48 @@ public:
};
/**
+ * Append an elliptical arc from the current point in the format used by SVG.
+ * The center of the ellipse is computed to satisfy the constraints below.
+ *
+ * @param rx,ry The radii in the x and y directions respectively.
+ * @param xAxisRotate The angle in degrees relative to the x-axis.
+ * @param largeArc Determines whether the smallest or largest arc possible
+ * is drawn.
+ * @param sweep Determines if the arc should be swept in an anti-clockwise or
+ * clockwise direction. Note that this enum value is opposite the SVG
+ * arc sweep value.
+ * @param x,y The destination coordinates.
+ */
+ void arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
+ Direction sweep, SkScalar x, SkScalar y);
+
+ void arcTo(const SkPoint r, SkScalar xAxisRotate, ArcSize largeArc, Direction sweep,
+ const SkPoint xy) {
+ this->arcTo(r.fX, r.fY, xAxisRotate, largeArc, sweep, xy.fX, xy.fY);
+ }
+
+ /** Same as arcTo format used by SVG, but the destination coordinate is relative to the
+ * last point on this contour. If there is no previous point, then a
+ * moveTo(0,0) is inserted automatically.
+ *
+ * @param rx,ry The radii in the x and y directions respectively.
+ * @param xAxisRotate The angle in degrees relative to the x-axis.
+ * @param largeArc Determines whether the smallest or largest arc possible
+ * is drawn.
+ * @param sweep Determines if the arc should be swept in an anti-clockwise or
+ * clockwise direction. Note that this enum value is opposite the SVG
+ * arc sweep value.
+ * @param dx,dy The destination coordinates relative to the last point.
+ */
+ void rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc,
+ Direction sweep, SkScalar dx, SkScalar dy);
+
+ /** Close the current contour. If the current point is not equal to the
+ first point of the contour, a line segment is automatically added.
+ */
+ void close();
+
+ /**
* Returns whether or not a fill type is inverted
*
* kWinding_FillType -> false
« no previous file with comments | « gm/arcto.cpp ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698