| 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 SkCanvas_DEFINED | 8 #ifndef SkCanvas_DEFINED |
| 9 #define SkCanvas_DEFINED | 9 #define SkCanvas_DEFINED |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class SkPicture; | 29 class SkPicture; |
| 30 class SkRRect; | 30 class SkRRect; |
| 31 class SkSurface; | 31 class SkSurface; |
| 32 class SkSurface_Base; | 32 class SkSurface_Base; |
| 33 class SkTextBlob; | 33 class SkTextBlob; |
| 34 class GrContext; | 34 class GrContext; |
| 35 class GrRenderTarget; | 35 class GrRenderTarget; |
| 36 | 36 |
| 37 class SkCanvasState; | 37 class SkCanvasState; |
| 38 | 38 |
| 39 #ifdef SK_SUPPORT_LEGACY_CANVAS_VIRTUAL | |
| 40 #define SK_LEGACY_CANVAS_VIRTUAL virtual | |
| 41 #else | |
| 42 #define SK_LEGACY_CANVAS_VIRTUAL | |
| 43 #endif | |
| 44 | |
| 45 /** \class SkCanvas | 39 /** \class SkCanvas |
| 46 | 40 |
| 47 A Canvas encapsulates all of the state about drawing into a device (bitmap). | 41 A Canvas encapsulates all of the state about drawing into a device (bitmap). |
| 48 This includes a reference to the device itself, and a stack of matrix/clip | 42 This includes a reference to the device itself, and a stack of matrix/clip |
| 49 values. For any given draw call (e.g. drawRect), the geometry of the object | 43 values. For any given draw call (e.g. drawRect), the geometry of the object |
| 50 being drawn is transformed by the concatenation of all the matrices in the | 44 being drawn is transformed by the concatenation of all the matrices in the |
| 51 stack. The transformed geometry is clipped by the intersection of all of | 45 stack. The transformed geometry is clipped by the intersection of all of |
| 52 the clips in the stack. | 46 the clips in the stack. |
| 53 | 47 |
| 54 While the Canvas holds the state of the drawing device, the state (style) | 48 While the Canvas holds the state of the drawing device, the state (style) |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 * to optimize performance on subsequent draws. Thus, if you call this and t
hen | 601 * to optimize performance on subsequent draws. Thus, if you call this and t
hen |
| 608 * never draw to the canvas subsequently you may pay a perfomance penalty. | 602 * never draw to the canvas subsequently you may pay a perfomance penalty. |
| 609 */ | 603 */ |
| 610 void discard() { this->onDiscard(); } | 604 void discard() { this->onDiscard(); } |
| 611 | 605 |
| 612 /** | 606 /** |
| 613 * Fill the entire canvas' bitmap (restricted to the current clip) with the | 607 * Fill the entire canvas' bitmap (restricted to the current clip) with the |
| 614 * specified paint. | 608 * specified paint. |
| 615 * @param paint The paint used to fill the canvas | 609 * @param paint The paint used to fill the canvas |
| 616 */ | 610 */ |
| 617 SK_LEGACY_CANVAS_VIRTUAL void drawPaint(const SkPaint& paint); | 611 void drawPaint(const SkPaint& paint); |
| 618 | 612 |
| 619 enum PointMode { | 613 enum PointMode { |
| 620 /** drawPoints draws each point separately */ | 614 /** drawPoints draws each point separately */ |
| 621 kPoints_PointMode, | 615 kPoints_PointMode, |
| 622 /** drawPoints draws each pair of points as a line segment */ | 616 /** drawPoints draws each pair of points as a line segment */ |
| 623 kLines_PointMode, | 617 kLines_PointMode, |
| 624 /** drawPoints draws the array of points as a polygon */ | 618 /** drawPoints draws the array of points as a polygon */ |
| 625 kPolygon_PointMode | 619 kPolygon_PointMode |
| 626 }; | 620 }; |
| 627 | 621 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 639 Note that, while similar, kLine and kPolygon modes draw slightly | 633 Note that, while similar, kLine and kPolygon modes draw slightly |
| 640 differently than the equivalent path built with a series of moveto, | 634 differently than the equivalent path built with a series of moveto, |
| 641 lineto calls, in that the path will draw all of its contours at once, | 635 lineto calls, in that the path will draw all of its contours at once, |
| 642 with no interactions if contours intersect each other (think XOR | 636 with no interactions if contours intersect each other (think XOR |
| 643 xfermode). drawPoints always draws each element one at a time. | 637 xfermode). drawPoints always draws each element one at a time. |
| 644 @param mode PointMode specifying how to draw the array of points. | 638 @param mode PointMode specifying how to draw the array of points. |
| 645 @param count The number of points in the array | 639 @param count The number of points in the array |
| 646 @param pts Array of points to draw | 640 @param pts Array of points to draw |
| 647 @param paint The paint used to draw the points | 641 @param paint The paint used to draw the points |
| 648 */ | 642 */ |
| 649 SK_LEGACY_CANVAS_VIRTUAL void drawPoints(PointMode mode, size_t count, const
SkPoint pts[], | 643 void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkP
aint& paint); |
| 650 const SkPaint& paint); | |
| 651 | 644 |
| 652 /** Helper method for drawing a single point. See drawPoints() for a more | 645 /** Helper method for drawing a single point. See drawPoints() for a more |
| 653 details. | 646 details. |
| 654 */ | 647 */ |
| 655 void drawPoint(SkScalar x, SkScalar y, const SkPaint& paint); | 648 void drawPoint(SkScalar x, SkScalar y, const SkPaint& paint); |
| 656 | 649 |
| 657 /** Draws a single pixel in the specified color. | 650 /** Draws a single pixel in the specified color. |
| 658 @param x The X coordinate of which pixel to draw | 651 @param x The X coordinate of which pixel to draw |
| 659 @param y The Y coordiante of which pixel to draw | 652 @param y The Y coordiante of which pixel to draw |
| 660 @param color The color to draw | 653 @param color The color to draw |
| (...skipping 10 matching lines...) Expand all Loading... |
| 671 @param paint The paint used to draw the line | 664 @param paint The paint used to draw the line |
| 672 */ | 665 */ |
| 673 void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, | 666 void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, |
| 674 const SkPaint& paint); | 667 const SkPaint& paint); |
| 675 | 668 |
| 676 /** Draw the specified rectangle using the specified paint. The rectangle | 669 /** Draw the specified rectangle using the specified paint. The rectangle |
| 677 will be filled or stroked based on the Style in the paint. | 670 will be filled or stroked based on the Style in the paint. |
| 678 @param rect The rect to be drawn | 671 @param rect The rect to be drawn |
| 679 @param paint The paint used to draw the rect | 672 @param paint The paint used to draw the rect |
| 680 */ | 673 */ |
| 681 SK_LEGACY_CANVAS_VIRTUAL void drawRect(const SkRect& rect, const SkPaint& pa
int); | 674 void drawRect(const SkRect& rect, const SkPaint& paint); |
| 682 | 675 |
| 683 /** Draw the specified rectangle using the specified paint. The rectangle | 676 /** Draw the specified rectangle using the specified paint. The rectangle |
| 684 will be filled or framed based on the Style in the paint. | 677 will be filled or framed based on the Style in the paint. |
| 685 @param rect The rect to be drawn | 678 @param rect The rect to be drawn |
| 686 @param paint The paint used to draw the rect | 679 @param paint The paint used to draw the rect |
| 687 */ | 680 */ |
| 688 void drawIRect(const SkIRect& rect, const SkPaint& paint) { | 681 void drawIRect(const SkIRect& rect, const SkPaint& paint) { |
| 689 SkRect r; | 682 SkRect r; |
| 690 r.set(rect); // promotes the ints to scalars | 683 r.set(rect); // promotes the ints to scalars |
| 691 this->drawRect(r, paint); | 684 this->drawRect(r, paint); |
| 692 } | 685 } |
| 693 | 686 |
| 694 /** Draw the specified rectangle using the specified paint. The rectangle | 687 /** Draw the specified rectangle using the specified paint. The rectangle |
| 695 will be filled or framed based on the Style in the paint. | 688 will be filled or framed based on the Style in the paint. |
| 696 @param left The left side of the rectangle to be drawn | 689 @param left The left side of the rectangle to be drawn |
| 697 @param top The top side of the rectangle to be drawn | 690 @param top The top side of the rectangle to be drawn |
| 698 @param right The right side of the rectangle to be drawn | 691 @param right The right side of the rectangle to be drawn |
| 699 @param bottom The bottom side of the rectangle to be drawn | 692 @param bottom The bottom side of the rectangle to be drawn |
| 700 @param paint The paint used to draw the rect | 693 @param paint The paint used to draw the rect |
| 701 */ | 694 */ |
| 702 void drawRectCoords(SkScalar left, SkScalar top, SkScalar right, | 695 void drawRectCoords(SkScalar left, SkScalar top, SkScalar right, |
| 703 SkScalar bottom, const SkPaint& paint); | 696 SkScalar bottom, const SkPaint& paint); |
| 704 | 697 |
| 705 /** Draw the specified oval using the specified paint. The oval will be | 698 /** Draw the specified oval using the specified paint. The oval will be |
| 706 filled or framed based on the Style in the paint. | 699 filled or framed based on the Style in the paint. |
| 707 @param oval The rectangle bounds of the oval to be drawn | 700 @param oval The rectangle bounds of the oval to be drawn |
| 708 @param paint The paint used to draw the oval | 701 @param paint The paint used to draw the oval |
| 709 */ | 702 */ |
| 710 SK_LEGACY_CANVAS_VIRTUAL void drawOval(const SkRect& oval, const SkPaint&); | 703 void drawOval(const SkRect& oval, const SkPaint&); |
| 711 | 704 |
| 712 /** | 705 /** |
| 713 * Draw the specified RRect using the specified paint The rrect will be fil
led or stroked | 706 * Draw the specified RRect using the specified paint The rrect will be fil
led or stroked |
| 714 * based on the Style in the paint. | 707 * based on the Style in the paint. |
| 715 * | 708 * |
| 716 * @param rrect The round-rect to draw | 709 * @param rrect The round-rect to draw |
| 717 * @param paint The paint used to draw the round-rect | 710 * @param paint The paint used to draw the round-rect |
| 718 */ | 711 */ |
| 719 SK_LEGACY_CANVAS_VIRTUAL void drawRRect(const SkRRect& rrect, const SkPaint&
paint); | 712 void drawRRect(const SkRRect& rrect, const SkPaint& paint); |
| 720 | 713 |
| 721 /** | 714 /** |
| 722 * Draw the annulus formed by the outer and inner rrects. The results | 715 * Draw the annulus formed by the outer and inner rrects. The results |
| 723 * are undefined if the outer does not contain the inner. | 716 * are undefined if the outer does not contain the inner. |
| 724 */ | 717 */ |
| 725 void drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint&); | 718 void drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint&); |
| 726 | 719 |
| 727 /** Draw the specified circle using the specified paint. If radius is <= 0, | 720 /** Draw the specified circle using the specified paint. If radius is <= 0, |
| 728 then nothing will be drawn. The circle will be filled | 721 then nothing will be drawn. The circle will be filled |
| 729 or framed based on the Style in the paint. | 722 or framed based on the Style in the paint. |
| (...skipping 27 matching lines...) Expand all Loading... |
| 757 @param paint The paint used to draw the roundRect | 750 @param paint The paint used to draw the roundRect |
| 758 */ | 751 */ |
| 759 void drawRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, | 752 void drawRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, |
| 760 const SkPaint& paint); | 753 const SkPaint& paint); |
| 761 | 754 |
| 762 /** Draw the specified path using the specified paint. The path will be | 755 /** Draw the specified path using the specified paint. The path will be |
| 763 filled or framed based on the Style in the paint. | 756 filled or framed based on the Style in the paint. |
| 764 @param path The path to be drawn | 757 @param path The path to be drawn |
| 765 @param paint The paint used to draw the path | 758 @param paint The paint used to draw the path |
| 766 */ | 759 */ |
| 767 SK_LEGACY_CANVAS_VIRTUAL void drawPath(const SkPath& path, const SkPaint& pa
int); | 760 void drawPath(const SkPath& path, const SkPaint& paint); |
| 768 | 761 |
| 769 /** Draw the specified image, with its top/left corner at (x,y), using the | 762 /** Draw the specified image, with its top/left corner at (x,y), using the |
| 770 specified paint, transformed by the current matrix. | 763 specified paint, transformed by the current matrix. |
| 771 | 764 |
| 772 @param image The image to be drawn | 765 @param image The image to be drawn |
| 773 @param left The position of the left side of the image being drawn | 766 @param left The position of the left side of the image being drawn |
| 774 @param top The position of the top side of the image being drawn | 767 @param top The position of the top side of the image being drawn |
| 775 @param paint The paint used to draw the image, or NULL | 768 @param paint The paint used to draw the image, or NULL |
| 776 */ | 769 */ |
| 777 SK_LEGACY_CANVAS_VIRTUAL void drawImage(const SkImage* image, SkScalar left,
SkScalar top, | 770 void drawImage(const SkImage* image, SkScalar left, SkScalar top, const SkPa
int* paint = NULL); |
| 778 const SkPaint* paint = NULL); | |
| 779 /** Draw the specified image, with the specified matrix applied (before the | 771 /** Draw the specified image, with the specified matrix applied (before the |
| 780 canvas' matrix is applied). | 772 canvas' matrix is applied). |
| 781 | 773 |
| 782 @param image The image to be drawn | 774 @param image The image to be drawn |
| 783 @param src Optional: specify the subset of the image to be drawn | 775 @param src Optional: specify the subset of the image to be drawn |
| 784 @param dst The destination rectangle where the scaled/translated | 776 @param dst The destination rectangle where the scaled/translated |
| 785 image will be drawn | 777 image will be drawn |
| 786 @param paint The paint used to draw the image, or NULL | 778 @param paint The paint used to draw the image, or NULL |
| 787 */ | 779 */ |
| 788 SK_LEGACY_CANVAS_VIRTUAL void drawImageRect(const SkImage* image, const SkRe
ct* src, | 780 void drawImageRect(const SkImage* image, const SkRect* src, const SkRect& ds
t, |
| 789 const SkRect& dst, | 781 const SkPaint* paint = NULL); |
| 790 const SkPaint* paint = NULL); | |
| 791 | 782 |
| 792 /** Draw the specified bitmap, with its top/left corner at (x,y), using the | 783 /** Draw the specified bitmap, with its top/left corner at (x,y), using the |
| 793 specified paint, transformed by the current matrix. Note: if the paint | 784 specified paint, transformed by the current matrix. Note: if the paint |
| 794 contains a maskfilter that generates a mask which extends beyond the | 785 contains a maskfilter that generates a mask which extends beyond the |
| 795 bitmap's original width/height, then the bitmap will be drawn as if it | 786 bitmap's original width/height, then the bitmap will be drawn as if it |
| 796 were in a Shader with CLAMP mode. Thus the color outside of the original | 787 were in a Shader with CLAMP mode. Thus the color outside of the original |
| 797 width/height will be the edge color replicated. | 788 width/height will be the edge color replicated. |
| 798 | 789 |
| 799 If a shader is present on the paint it will be ignored, except in the | 790 If a shader is present on the paint it will be ignored, except in the |
| 800 case where the bitmap is kAlpha_8_SkColorType. In that case, the color i
s | 791 case where the bitmap is kAlpha_8_SkColorType. In that case, the color i
s |
| 801 generated by the shader. | 792 generated by the shader. |
| 802 | 793 |
| 803 @param bitmap The bitmap to be drawn | 794 @param bitmap The bitmap to be drawn |
| 804 @param left The position of the left side of the bitmap being drawn | 795 @param left The position of the left side of the bitmap being drawn |
| 805 @param top The position of the top side of the bitmap being drawn | 796 @param top The position of the top side of the bitmap being drawn |
| 806 @param paint The paint used to draw the bitmap, or NULL | 797 @param paint The paint used to draw the bitmap, or NULL |
| 807 */ | 798 */ |
| 808 SK_LEGACY_CANVAS_VIRTUAL void drawBitmap(const SkBitmap& bitmap, SkScalar le
ft, SkScalar top, | 799 void drawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, |
| 809 const SkPaint* paint = NULL); | 800 const SkPaint* paint = NULL); |
| 810 | 801 |
| 811 enum DrawBitmapRectFlags { | 802 enum DrawBitmapRectFlags { |
| 812 kNone_DrawBitmapRectFlag = 0x0, | 803 kNone_DrawBitmapRectFlag = 0x0, |
| 813 /** | 804 /** |
| 814 * When filtering is enabled, allow the color samples outside of | 805 * When filtering is enabled, allow the color samples outside of |
| 815 * the src rect (but still in the src bitmap) to bleed into the | 806 * the src rect (but still in the src bitmap) to bleed into the |
| 816 * drawn portion | 807 * drawn portion |
| 817 */ | 808 */ |
| 818 kBleed_DrawBitmapRectFlag = 0x1, | 809 kBleed_DrawBitmapRectFlag = 0x1, |
| 819 }; | 810 }; |
| 820 | 811 |
| 821 /** Draw the specified bitmap, with the specified matrix applied (before the | 812 /** Draw the specified bitmap, with the specified matrix applied (before the |
| 822 canvas' matrix is applied). | 813 canvas' matrix is applied). |
| 823 @param bitmap The bitmap to be drawn | 814 @param bitmap The bitmap to be drawn |
| 824 @param src Optional: specify the subset of the bitmap to be drawn | 815 @param src Optional: specify the subset of the bitmap to be drawn |
| 825 @param dst The destination rectangle where the scaled/translated | 816 @param dst The destination rectangle where the scaled/translated |
| 826 image will be drawn | 817 image will be drawn |
| 827 @param paint The paint used to draw the bitmap, or NULL | 818 @param paint The paint used to draw the bitmap, or NULL |
| 828 */ | 819 */ |
| 829 SK_LEGACY_CANVAS_VIRTUAL void drawBitmapRectToRect(const SkBitmap& bitmap, c
onst SkRect* src, | 820 void drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, const S
kRect& dst, |
| 830 const SkRect& dst, | 821 const SkPaint* paint = NULL, |
| 831 const SkPaint* paint = NULL, | 822 DrawBitmapRectFlags flags = kNone_DrawBitmapRectFl
ag); |
| 832 DrawBitmapRectFlags flags = kNone_DrawBitm
apRectFlag); | |
| 833 | 823 |
| 834 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, | 824 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, |
| 835 const SkPaint* paint = NULL) { | 825 const SkPaint* paint = NULL) { |
| 836 this->drawBitmapRectToRect(bitmap, NULL, dst, paint, kNone_DrawBitmapRec
tFlag); | 826 this->drawBitmapRectToRect(bitmap, NULL, dst, paint, kNone_DrawBitmapRec
tFlag); |
| 837 } | 827 } |
| 838 | 828 |
| 839 void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* isrc, | 829 void drawBitmapRect(const SkBitmap& bitmap, const SkIRect* isrc, |
| 840 const SkRect& dst, const SkPaint* paint = NULL, | 830 const SkRect& dst, const SkPaint* paint = NULL, |
| 841 DrawBitmapRectFlags flags = kNone_DrawBitmapRectFlag) { | 831 DrawBitmapRectFlags flags = kNone_DrawBitmapRectFlag) { |
| 842 SkRect realSrcStorage; | 832 SkRect realSrcStorage; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 855 * bitmap is the "center", then the center-rect should be [2, 2, 3, 3]. | 845 * bitmap is the "center", then the center-rect should be [2, 2, 3, 3]. |
| 856 * | 846 * |
| 857 * If the dst is >= the bitmap size, then... | 847 * If the dst is >= the bitmap size, then... |
| 858 * - The 4 corners are not stretched at all. | 848 * - The 4 corners are not stretched at all. |
| 859 * - The sides are stretched in only one axis. | 849 * - The sides are stretched in only one axis. |
| 860 * - The center is stretched in both axes. | 850 * - The center is stretched in both axes. |
| 861 * Else, for each axis where dst < bitmap, | 851 * Else, for each axis where dst < bitmap, |
| 862 * - The corners shrink proportionally | 852 * - The corners shrink proportionally |
| 863 * - The sides (along the shrink axis) and center are not drawn | 853 * - The sides (along the shrink axis) and center are not drawn |
| 864 */ | 854 */ |
| 865 SK_LEGACY_CANVAS_VIRTUAL void drawBitmapNine(const SkBitmap& bitmap, const S
kIRect& center, | 855 void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkR
ect& dst, |
| 866 const SkRect& dst, const SkPaint* paint = NULL); | 856 const SkPaint* paint = NULL); |
| 867 | 857 |
| 868 /** Draw the specified bitmap, with its top/left corner at (x,y), | 858 /** Draw the specified bitmap, with its top/left corner at (x,y), |
| 869 NOT transformed by the current matrix. Note: if the paint | 859 NOT transformed by the current matrix. Note: if the paint |
| 870 contains a maskfilter that generates a mask which extends beyond the | 860 contains a maskfilter that generates a mask which extends beyond the |
| 871 bitmap's original width/height, then the bitmap will be drawn as if it | 861 bitmap's original width/height, then the bitmap will be drawn as if it |
| 872 were in a Shader with CLAMP mode. Thus the color outside of the original | 862 were in a Shader with CLAMP mode. Thus the color outside of the original |
| 873 width/height will be the edge color replicated. | 863 width/height will be the edge color replicated. |
| 874 @param bitmap The bitmap to be drawn | 864 @param bitmap The bitmap to be drawn |
| 875 @param left The position of the left side of the bitmap being drawn | 865 @param left The position of the left side of the bitmap being drawn |
| 876 @param top The position of the top side of the bitmap being drawn | 866 @param top The position of the top side of the bitmap being drawn |
| 877 @param paint The paint used to draw the bitmap, or NULL | 867 @param paint The paint used to draw the bitmap, or NULL |
| 878 */ | 868 */ |
| 879 SK_LEGACY_CANVAS_VIRTUAL void drawSprite(const SkBitmap& bitmap, int left, i
nt top, | 869 void drawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* pa
int = NULL); |
| 880 const SkPaint* paint = NULL); | |
| 881 | 870 |
| 882 /** Draw the text, with origin at (x,y), using the specified paint. | 871 /** Draw the text, with origin at (x,y), using the specified paint. |
| 883 The origin is interpreted based on the Align setting in the paint. | 872 The origin is interpreted based on the Align setting in the paint. |
| 884 @param text The text to be drawn | 873 @param text The text to be drawn |
| 885 @param byteLength The number of bytes to read from the text parameter | 874 @param byteLength The number of bytes to read from the text parameter |
| 886 @param x The x-coordinate of the origin of the text being drawn | 875 @param x The x-coordinate of the origin of the text being drawn |
| 887 @param y The y-coordinate of the origin of the text being drawn | 876 @param y The y-coordinate of the origin of the text being drawn |
| 888 @param paint The paint used for the text (e.g. color, size, style) | 877 @param paint The paint used for the text (e.g. color, size, style) |
| 889 */ | 878 */ |
| 890 void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, | 879 void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 vertex, to be interpolated across the triangle. | 981 vertex, to be interpolated across the triangle. |
| 993 @param xmode Used if both texs and colors are present. In this | 982 @param xmode Used if both texs and colors are present. In this |
| 994 case the colors are combined with the texture using mode, | 983 case the colors are combined with the texture using mode, |
| 995 before being drawn using the paint. If mode is null, then | 984 before being drawn using the paint. If mode is null, then |
| 996 kModulate_Mode is used. | 985 kModulate_Mode is used. |
| 997 @param indices If not null, array of indices to reference into the | 986 @param indices If not null, array of indices to reference into the |
| 998 vertex (texs, colors) array. | 987 vertex (texs, colors) array. |
| 999 @param indexCount number of entries in the indices array (if not null) | 988 @param indexCount number of entries in the indices array (if not null) |
| 1000 @param paint Specifies the shader/texture if present. | 989 @param paint Specifies the shader/texture if present. |
| 1001 */ | 990 */ |
| 1002 SK_LEGACY_CANVAS_VIRTUAL void drawVertices(VertexMode vmode, int vertexCount
, | 991 void drawVertices(VertexMode vmode, int vertexCount, |
| 1003 const SkPoint vertices[], const SkPoint texs[], | 992 const SkPoint vertices[], const SkPoint texs[], |
| 1004 const SkColor colors[], SkXfermode* xmode, | 993 const SkColor colors[], SkXfermode* xmode, |
| 1005 const uint16_t indices[], int indexCount, | 994 const uint16_t indices[], int indexCount, |
| 1006 const SkPaint& paint); | 995 const SkPaint& paint); |
| 1007 | 996 |
| 1008 /** | 997 /** |
| 1009 Draw a cubic coons patch | 998 Draw a cubic coons patch |
| 1010 | 999 |
| 1011 @param cubic specifies the 4 bounding cubic bezier curves of a patch with c
lockwise order | 1000 @param cubic specifies the 4 bounding cubic bezier curves of a patch with c
lockwise order |
| 1012 starting at the top left corner. | 1001 starting at the top left corner. |
| 1013 @param colors specifies the colors for the corners which will be bilerp acr
oss the patch, | 1002 @param colors specifies the colors for the corners which will be bilerp acr
oss the patch, |
| 1014 their order is clockwise starting at the top left corner. | 1003 their order is clockwise starting at the top left corner. |
| 1015 @param texCoords specifies the texture coordinates that will be bilerp acro
ss the patch, | 1004 @param texCoords specifies the texture coordinates that will be bilerp acro
ss the patch, |
| 1016 their order is the same as the colors. | 1005 their order is the same as the colors. |
| 1017 @param xmode specifies how are the colors and the textures combined if both
of them are | 1006 @param xmode specifies how are the colors and the textures combined if both
of them are |
| 1018 present. | 1007 present. |
| 1019 @param paint Specifies the shader/texture if present. | 1008 @param paint Specifies the shader/texture if present. |
| 1020 */ | 1009 */ |
| 1021 void drawPatch(const SkPoint cubics[12], const SkColor colors[4], | 1010 void drawPatch(const SkPoint cubics[12], const SkColor colors[4], |
| 1022 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint&
paint); | 1011 const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint&
paint); |
| 1023 | 1012 |
| 1024 void EXPERIMENTAL_drawDrawable(SkCanvasDrawable*); | 1013 void EXPERIMENTAL_drawDrawable(SkCanvasDrawable*); |
| 1025 | 1014 |
| 1026 #ifdef SK_SUPPORT_LEGACY_DRAWDATA | |
| 1027 /** Send a blob of data to the canvas. | |
| 1028 For canvases that draw, this call is effectively a no-op, as the data | |
| 1029 is not parsed, but just ignored. However, this call exists for | |
| 1030 subclasses like SkPicture's recording canvas, that can store the data | |
| 1031 and then play it back later (via another call to drawData). | |
| 1032 */ | |
| 1033 virtual void drawData(const void* /*data*/, size_t /*length*/) {} | |
| 1034 #endif | |
| 1035 | |
| 1036 /** Add comments. beginCommentGroup/endCommentGroup open/close a new group. | 1015 /** Add comments. beginCommentGroup/endCommentGroup open/close a new group. |
| 1037 Each comment added via addComment is notionally attached to its | 1016 Each comment added via addComment is notionally attached to its |
| 1038 enclosing group. Top-level comments simply belong to no group. | 1017 enclosing group. Top-level comments simply belong to no group. |
| 1039 */ | 1018 */ |
| 1040 virtual void beginCommentGroup(const char* /*description*/) { | 1019 virtual void beginCommentGroup(const char* /*description*/) { |
| 1041 // do nothing. Subclasses may do something | 1020 // do nothing. Subclasses may do something |
| 1042 } | 1021 } |
| 1043 virtual void addComment(const char* /*kywd*/, const char* /*value*/) { | 1022 virtual void addComment(const char* /*kywd*/, const char* /*value*/) { |
| 1044 // do nothing. Subclasses may do something | 1023 // do nothing. Subclasses may do something |
| 1045 } | 1024 } |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1506 | 1485 |
| 1507 class SkCanvasClipVisitor { | 1486 class SkCanvasClipVisitor { |
| 1508 public: | 1487 public: |
| 1509 virtual ~SkCanvasClipVisitor(); | 1488 virtual ~SkCanvasClipVisitor(); |
| 1510 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1489 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
| 1511 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1490 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
| 1512 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1491 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
| 1513 }; | 1492 }; |
| 1514 | 1493 |
| 1515 #endif | 1494 #endif |
| OLD | NEW |