OLD | NEW |
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 Loading... |
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 /** Close the current contour. If the current point is not equal to the | 502 enum ArcSize { |
503 first point of the contour, a line segment is automatically added. | 503 /** the smaller of the two possible SVG arcs. */ |
504 */ | 504 kSmall_ArcSize, |
505 void close(); | 505 /** the larger of the two possible SVG arcs. */ |
| 506 kLarge_ArcSize, |
| 507 }; |
506 | 508 |
507 enum Direction { | 509 enum Direction { |
508 /** clockwise direction for adding closed contours */ | 510 /** clockwise direction for adding closed contours */ |
509 kCW_Direction, | 511 kCW_Direction, |
510 /** counter-clockwise direction for adding closed contours */ | 512 /** counter-clockwise direction for adding closed contours */ |
511 kCCW_Direction, | 513 kCCW_Direction, |
512 }; | 514 }; |
513 | 515 |
514 /** | 516 /** |
| 517 * Append an elliptical arc from the current point in the format used by SV
G. |
| 518 * The center of the ellipse is computed to satisfy the constraints below. |
| 519 * |
| 520 * @param rx,ry The radii in the x and y directions respectively. |
| 521 * @param xAxisRotate The angle in degrees relative to the x-axis. |
| 522 * @param largeArc Determines whether the smallest or largest arc possible |
| 523 * is drawn. |
| 524 * @param sweep Determines if the arc should be swept in an anti-clockwise
or |
| 525 * clockwise direction. Note that this enum value is opposite the SV
G |
| 526 * arc sweep value. |
| 527 * @param x,y The destination coordinates. |
| 528 */ |
| 529 void arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, |
| 530 Direction sweep, SkScalar x, SkScalar y); |
| 531 |
| 532 void arcTo(const SkPoint r, SkScalar xAxisRotate, ArcSize largeArc, Directio
n sweep, |
| 533 const SkPoint xy) { |
| 534 this->arcTo(r.fX, r.fY, xAxisRotate, largeArc, sweep, xy.fX, xy.fY); |
| 535 } |
| 536 |
| 537 /** Same as arcTo format used by SVG, but the destination coordinate is rela
tive to the |
| 538 * last point on this contour. If there is no previous point, then a |
| 539 * moveTo(0,0) is inserted automatically. |
| 540 * |
| 541 * @param rx,ry The radii in the x and y directions respectively. |
| 542 * @param xAxisRotate The angle in degrees relative to the x-axis. |
| 543 * @param largeArc Determines whether the smallest or largest arc possible |
| 544 * is drawn. |
| 545 * @param sweep Determines if the arc should be swept in an anti-clockwise
or |
| 546 * clockwise direction. Note that this enum value is opposite the SV
G |
| 547 * arc sweep value. |
| 548 * @param dx,dy The destination coordinates relative to the last point. |
| 549 */ |
| 550 void rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc
, |
| 551 Direction sweep, SkScalar dx, SkScalar dy); |
| 552 |
| 553 /** Close the current contour. If the current point is not equal to the |
| 554 first point of the contour, a line segment is automatically added. |
| 555 */ |
| 556 void close(); |
| 557 |
| 558 /** |
515 * Returns whether or not a fill type is inverted | 559 * Returns whether or not a fill type is inverted |
516 * | 560 * |
517 * kWinding_FillType -> false | 561 * kWinding_FillType -> false |
518 * kEvenOdd_FillType -> false | 562 * kEvenOdd_FillType -> false |
519 * kInverseWinding_FillType -> true | 563 * kInverseWinding_FillType -> true |
520 * kInverseEvenOdd_FillType -> true | 564 * kInverseEvenOdd_FillType -> true |
521 */ | 565 */ |
522 static bool IsInverseFillType(FillType fill) { | 566 static bool IsInverseFillType(FillType fill) { |
523 static_assert(0 == kWinding_FillType, "fill_type_mismatch"); | 567 static_assert(0 == kWinding_FillType, "fill_type_mismatch"); |
524 static_assert(1 == kEvenOdd_FillType, "fill_type_mismatch"); | 568 static_assert(1 == kEvenOdd_FillType, "fill_type_mismatch"); |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 | 1143 |
1100 friend class SkAutoPathBoundsUpdate; | 1144 friend class SkAutoPathBoundsUpdate; |
1101 friend class SkAutoDisableOvalCheck; | 1145 friend class SkAutoDisableOvalCheck; |
1102 friend class SkAutoDisableDirectionCheck; | 1146 friend class SkAutoDisableDirectionCheck; |
1103 friend class SkBench_AddPathTest; // perf test reversePathTo | 1147 friend class SkBench_AddPathTest; // perf test reversePathTo |
1104 friend class PathTest_Private; // unit test reversePathTo | 1148 friend class PathTest_Private; // unit test reversePathTo |
1105 friend class ForceIsRRect_Private; // unit test isRRect | 1149 friend class ForceIsRRect_Private; // unit test isRRect |
1106 }; | 1150 }; |
1107 | 1151 |
1108 #endif | 1152 #endif |
OLD | NEW |