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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 @param rect If not null, returns the path as a pair of nested rectangles | 556 @param rect If not null, returns the path as a pair of nested rectangles |
557 @param dirs If not null, returns the direction of the rects | 557 @param dirs If not null, returns the direction of the rects |
558 @return true if the path describes a pair of nested rectangles | 558 @return true if the path describes a pair of nested rectangles |
559 */ | 559 */ |
560 bool isNestedFillRects(SkRect rect[2], Direction dirs[2] = NULL) const; | 560 bool isNestedFillRects(SkRect rect[2], Direction dirs[2] = NULL) const; |
561 | 561 |
562 /** | 562 /** |
563 * Add a closed rectangle contour to the path | 563 * Add a closed rectangle contour to the path |
564 * @param rect The rectangle to add as a closed contour to the path | 564 * @param rect The rectangle to add as a closed contour to the path |
565 * @param dir The direction to wind the rectangle's contour. | 565 * @param dir The direction to wind the rectangle's contour. |
| 566 * |
| 567 * Note: the contour initial point index is 0 (as defined below). |
566 */ | 568 */ |
567 void addRect(const SkRect& rect, Direction dir = kCW_Direction); | 569 void addRect(const SkRect& rect, Direction dir = kCW_Direction); |
568 | 570 |
569 /** | 571 /** |
570 * Add a closed rectangle contour to the path | 572 * Add a closed rectangle contour to the path |
| 573 * @param rect The rectangle to add as a closed contour to the path |
| 574 * @param dir The direction to wind the rectangle's contour. |
| 575 * @param start Initial point of the contour (initial moveTo), expressed as |
| 576 * a corner index, starting in the upper-left position, clock-
wise: |
| 577 * |
| 578 * 0 1 |
| 579 * *-------* |
| 580 * | | |
| 581 * *-------* |
| 582 * 3 2 |
| 583 */ |
| 584 void addRect(const SkRect& rect, Direction dir, unsigned start); |
| 585 |
| 586 /** |
| 587 * Add a closed rectangle contour to the path |
571 * | 588 * |
572 * @param left The left side of a rectangle to add as a closed contour | 589 * @param left The left side of a rectangle to add as a closed contour |
573 * to the path | 590 * to the path |
574 * @param top The top of a rectangle to add as a closed contour to the | 591 * @param top The top of a rectangle to add as a closed contour to the |
575 * path | 592 * path |
576 * @param right The right side of a rectangle to add as a closed contour | 593 * @param right The right side of a rectangle to add as a closed contour |
577 * to the path | 594 * to the path |
578 * @param bottom The bottom of a rectangle to add as a closed contour to | 595 * @param bottom The bottom of a rectangle to add as a closed contour to |
579 * the path | 596 * the path |
580 * @param dir The direction to wind the rectangle's contour. | 597 * @param dir The direction to wind the rectangle's contour. |
| 598 * |
| 599 * Note: the contour initial point index is 0 (as defined above). |
581 */ | 600 */ |
582 void addRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom, | 601 void addRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom, |
583 Direction dir = kCW_Direction); | 602 Direction dir = kCW_Direction); |
584 | 603 |
585 /** | 604 /** |
586 * Add a closed oval contour to the path | 605 * Add a closed oval contour to the path |
587 * | 606 * |
588 * @param oval The bounding oval to add as a closed contour to the path | 607 * @param oval The bounding oval to add as a closed contour to the path |
589 * @param dir The direction to wind the oval's contour. | 608 * @param dir The direction to wind the oval's contour. |
| 609 * |
| 610 * Note: the contour initial point index is 1 (as defined below). |
590 */ | 611 */ |
591 void addOval(const SkRect& oval, Direction dir = kCW_Direction); | 612 void addOval(const SkRect& oval, Direction dir = kCW_Direction); |
592 | 613 |
593 /** | 614 /** |
| 615 * Add a closed oval contour to the path |
| 616 * |
| 617 * @param oval The bounding oval to add as a closed contour to the path |
| 618 * @param dir The direction to wind the oval's contour. |
| 619 * @param start Initial point of the contour (initial moveTo), expressed |
| 620 * as an ellipse vertex index, starting at the top, clock-wise |
| 621 * (90/0/270/180deg order): |
| 622 * |
| 623 * 0 |
| 624 * -*- |
| 625 * | | |
| 626 * 3 * * 1 |
| 627 * | | |
| 628 * -*- |
| 629 * 2 |
| 630 */ |
| 631 void addOval(const SkRect& oval, Direction dir, unsigned start); |
| 632 |
| 633 /** |
594 * Add a closed circle contour to the path | 634 * Add a closed circle contour to the path |
595 * | 635 * |
596 * @param x The x-coordinate of the center of a circle to add as a | 636 * @param x The x-coordinate of the center of a circle to add as a |
597 * closed contour to the path | 637 * closed contour to the path |
598 * @param y The y-coordinate of the center of a circle to add as a | 638 * @param y The y-coordinate of the center of a circle to add as a |
599 * closed contour to the path | 639 * closed contour to the path |
600 * @param radius The radius of a circle to add as a closed contour to the | 640 * @param radius The radius of a circle to add as a closed contour to the |
601 * path | 641 * path |
602 * @param dir The direction to wind the circle's contour. | 642 * @param dir The direction to wind the circle's contour. |
603 */ | 643 */ |
(...skipping 29 matching lines...) Expand all Loading... |
633 * SkRRect radii (i.e., either radii at a corner being 0 implies a | 673 * SkRRect radii (i.e., either radii at a corner being 0 implies a |
634 * sqaure corner and oversized radii are proportionally scaled down). | 674 * sqaure corner and oversized radii are proportionally scaled down). |
635 */ | 675 */ |
636 void addRoundRect(const SkRect& rect, const SkScalar radii[], | 676 void addRoundRect(const SkRect& rect, const SkScalar radii[], |
637 Direction dir = kCW_Direction); | 677 Direction dir = kCW_Direction); |
638 | 678 |
639 /** | 679 /** |
640 * Add an SkRRect contour to the path | 680 * Add an SkRRect contour to the path |
641 * @param rrect The rounded rect to add as a closed contour | 681 * @param rrect The rounded rect to add as a closed contour |
642 * @param dir The winding direction for the new contour. | 682 * @param dir The winding direction for the new contour. |
| 683 * |
| 684 * Note: the contour initial point index is either 6 (for dir == kCW_Direct
ion) |
| 685 * or 7 (for dir == kCCW_Direction), as defined below. |
| 686 * |
643 */ | 687 */ |
644 void addRRect(const SkRRect& rrect, Direction dir = kCW_Direction); | 688 void addRRect(const SkRRect& rrect, Direction dir = kCW_Direction); |
645 | 689 |
646 /** | 690 /** |
| 691 * Add an SkRRect contour to the path |
| 692 * @param rrect The rounded rect to add as a closed contour |
| 693 * @param dir The winding direction for the new contour. |
| 694 * @param start Initial point of the contour (initial moveTo), expressed as |
| 695 * an index of the radii minor/major points, ordered clock-wis
e: |
| 696 * |
| 697 * 0 1 |
| 698 * *----* |
| 699 * 7 * * 2 |
| 700 * | | |
| 701 * 6 * * 3 |
| 702 * *----* |
| 703 * 5 4 |
| 704 */ |
| 705 void addRRect(const SkRRect& rrect, Direction dir, unsigned start); |
| 706 |
| 707 /** |
647 * Add a new contour made of just lines. This is just a fast version of | 708 * Add a new contour made of just lines. This is just a fast version of |
648 * the following: | 709 * the following: |
649 * this->moveTo(pts[0]); | 710 * this->moveTo(pts[0]); |
650 * for (int i = 1; i < count; ++i) { | 711 * for (int i = 1; i < count; ++i) { |
651 * this->lineTo(pts[i]); | 712 * this->lineTo(pts[i]); |
652 * } | 713 * } |
653 * if (close) { | 714 * if (close) { |
654 * this->close(); | 715 * this->close(); |
655 * } | 716 * } |
656 */ | 717 */ |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 void setPt(int index, SkScalar x, SkScalar y); | 1062 void setPt(int index, SkScalar x, SkScalar y); |
1002 | 1063 |
1003 friend class SkAutoPathBoundsUpdate; | 1064 friend class SkAutoPathBoundsUpdate; |
1004 friend class SkAutoDisableOvalCheck; | 1065 friend class SkAutoDisableOvalCheck; |
1005 friend class SkAutoDisableDirectionCheck; | 1066 friend class SkAutoDisableDirectionCheck; |
1006 friend class SkBench_AddPathTest; // perf test reversePathTo | 1067 friend class SkBench_AddPathTest; // perf test reversePathTo |
1007 friend class PathTest_Private; // unit test reversePathTo | 1068 friend class PathTest_Private; // unit test reversePathTo |
1008 }; | 1069 }; |
1009 | 1070 |
1010 #endif | 1071 #endif |
OLD | NEW |