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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « gm/arcto.cpp ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkPath_DEFINED 8 #ifndef SkPath_DEFINED
9 #define SkPath_DEFINED 9 #define SkPath_DEFINED
10 10
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 */ 492 */
493 void arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radi us); 493 void arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radi us);
494 494
495 /** Append a line and arc to the current path. This is the same as the 495 /** Append a line and arc to the current path. This is the same as the
496 PostScript call "arct". 496 PostScript call "arct".
497 */ 497 */
498 void arcTo(const SkPoint p1, const SkPoint p2, SkScalar radius) { 498 void arcTo(const SkPoint p1, const SkPoint p2, SkScalar radius) {
499 this->arcTo(p1.fX, p1.fY, p2.fX, p2.fY, radius); 499 this->arcTo(p1.fX, p1.fY, p2.fX, p2.fY, radius);
500 } 500 }
501 501
502 /**
503 * Append an elliptical arc from the current point in the format used by SV G.
504 * The center of the ellipse is computed to satisfy the constraints below.
505 *
506 * @param rx,ry The radii in the x and y directions respectively.
507 * @param xAxisRotate The angle in degrees relative to the x-axis.
508 * @param largeArc Determines whether the smallest (false) or largest (true ) arc possible
509 * is drawn.
510 * @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.)
511 * clockwise (true) direction.
512 * @param x,y The destination coordinates.
513 */
514 void arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, bool largeArc, bo ol sweep,
515 SkScalar x, SkScalar y);
516
517 void arcTo(const SkPoint r, SkScalar xAxisRotate, bool largeArc, bool sweep,
518 const SkPoint xy) {
519 this->arcTo(r.fX, r.fY, xAxisRotate, largeArc, sweep, xy.fX, xy.fY);
520 }
521
522 /** Same as arcTo format used by SVG, but the destination coordinate is rela tive to the
523 * last point on this contour. If there is no previous point, then a
524 * moveTo(0,0) is inserted automatically.
525 *
526 * @param rx,ry The radii in the x and y directions respectively.
527 * @param xAxisRotate The angle in degrees relative to the x-axis.
528 * @param largeArc Determines whether the smallest (false) or largest (true ) arc possible
529 * is drawn.
530 * @param sweep Determines if the arc should be swept in an anti-clockwise (false) or
531 * clockwise (true) direction.
532 * @param dx,dy The destination coordinates relative to the last point.
533 */
534 void rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, bool largeArc, b ool sweep,
535 SkScalar dx, SkScalar dy);
536
502 /** Close the current contour. If the current point is not equal to the 537 /** Close the current contour. If the current point is not equal to the
503 first point of the contour, a line segment is automatically added. 538 first point of the contour, a line segment is automatically added.
504 */ 539 */
505 void close(); 540 void close();
506 541
507 enum Direction { 542 enum Direction {
508 /** clockwise direction for adding closed contours */ 543 /** clockwise direction for adding closed contours */
509 kCW_Direction, 544 kCW_Direction,
510 /** counter-clockwise direction for adding closed contours */ 545 /** counter-clockwise direction for adding closed contours */
511 kCCW_Direction, 546 kCCW_Direction,
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 1134
1100 friend class SkAutoPathBoundsUpdate; 1135 friend class SkAutoPathBoundsUpdate;
1101 friend class SkAutoDisableOvalCheck; 1136 friend class SkAutoDisableOvalCheck;
1102 friend class SkAutoDisableDirectionCheck; 1137 friend class SkAutoDisableDirectionCheck;
1103 friend class SkBench_AddPathTest; // perf test reversePathTo 1138 friend class SkBench_AddPathTest; // perf test reversePathTo
1104 friend class PathTest_Private; // unit test reversePathTo 1139 friend class PathTest_Private; // unit test reversePathTo
1105 friend class ForceIsRRect_Private; // unit test isRRect 1140 friend class ForceIsRRect_Private; // unit test isRRect
1106 }; 1141 };
1107 1142
1108 #endif 1143 #endif
OLDNEW
« 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