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

Unified Diff: include/core/SkPath.h

Issue 1613303002: Add svg path arcto (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add int-to-float (good catch, windows!) 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..9ce49bfdb4fa094e407a1666669b5807c5cc1ae4 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -499,6 +499,41 @@ public:
this->arcTo(p1.fX, p1.fY, p2.fX, p2.fY, radius);
}
+ /**
+ * 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 (false) or largest (true) arc possible
+ * is drawn.
+ * @param sweep Determines if the arc should be swept in an anti-clockwise (false) or
reed1 2016/01/22 19:39:53 Can we use Direction enum for sweep, rather than a
caryclark 2016/01/22 22:14:00 This is a dilemma. Note that Direction assigns 0 t
caryclark 2016/01/23 12:53:34 Made largeArc and sweep enums (Done.)
+ * clockwise (true) direction.
+ * @param x,y The destination coordinates.
+ */
+ void arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, bool largeArc, bool sweep,
+ SkScalar x, SkScalar y);
+
+ void arcTo(const SkPoint r, SkScalar xAxisRotate, bool largeArc, bool 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 (false) or largest (true) arc possible
+ * is drawn.
+ * @param sweep Determines if the arc should be swept in an anti-clockwise (false) or
+ * clockwise (true) direction.
+ * @param dx,dy The destination coordinates relative to the last point.
+ */
+ void rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, bool largeArc, bool 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.
*/
« 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