| 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 19 matching lines...) Expand all Loading... |
| 30 class SkMetaData; | 30 class SkMetaData; |
| 31 class SkPath; | 31 class SkPath; |
| 32 class SkPicture; | 32 class SkPicture; |
| 33 class SkPixmap; | 33 class SkPixmap; |
| 34 class SkRRect; | 34 class SkRRect; |
| 35 struct SkRSXform; | 35 struct SkRSXform; |
| 36 class SkSurface; | 36 class SkSurface; |
| 37 class SkSurface_Base; | 37 class SkSurface_Base; |
| 38 class SkTextBlob; | 38 class SkTextBlob; |
| 39 | 39 |
| 40 //#define SK_SUPPORT_LEGACY_SIMPLE_DRAWIMAGERECT | |
| 41 //#define SK_SUPPORT_LEGACY_SRCPTR_DRAWIMAGERECT | |
| 42 | |
| 43 /** \class SkCanvas | 40 /** \class SkCanvas |
| 44 | 41 |
| 45 A Canvas encapsulates all of the state about drawing into a device (bitmap). | 42 A Canvas encapsulates all of the state about drawing into a device (bitmap). |
| 46 This includes a reference to the device itself, and a stack of matrix/clip | 43 This includes a reference to the device itself, and a stack of matrix/clip |
| 47 values. For any given draw call (e.g. drawRect), the geometry of the object | 44 values. For any given draw call (e.g. drawRect), the geometry of the object |
| 48 being drawn is transformed by the concatenation of all the matrices in the | 45 being drawn is transformed by the concatenation of all the matrices in the |
| 49 stack. The transformed geometry is clipped by the intersection of all of | 46 stack. The transformed geometry is clipped by the intersection of all of |
| 50 the clips in the stack. | 47 the clips in the stack. |
| 51 | 48 |
| 52 While the Canvas holds the state of the drawing device, the state (style) | 49 While the Canvas holds the state of the drawing device, the state (style) |
| (...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 * @param paint The paint used to draw the image, or NULL | 819 * @param paint The paint used to draw the image, or NULL |
| 823 * @param constraint Control the tradeoff between speed and exactness w.r.t
. the src-rect. | 820 * @param constraint Control the tradeoff between speed and exactness w.r.t
. the src-rect. |
| 824 */ | 821 */ |
| 825 void drawImageRect(const SkImage* image, const SkRect& src, const SkRect& ds
t, | 822 void drawImageRect(const SkImage* image, const SkRect& src, const SkRect& ds
t, |
| 826 const SkPaint* paint, | 823 const SkPaint* paint, |
| 827 SrcRectConstraint constraint = kStrict_SrcRectConstraint)
; | 824 SrcRectConstraint constraint = kStrict_SrcRectConstraint)
; |
| 828 // variant that takes src SkIRect | 825 // variant that takes src SkIRect |
| 829 void drawImageRect(const SkImage* image, const SkIRect& isrc, const SkRect&
dst, | 826 void drawImageRect(const SkImage* image, const SkIRect& isrc, const SkRect&
dst, |
| 830 const SkPaint* paint, SrcRectConstraint = kStrict_SrcRect
Constraint); | 827 const SkPaint* paint, SrcRectConstraint = kStrict_SrcRect
Constraint); |
| 831 // variant that assumes src == image-bounds | 828 // variant that assumes src == image-bounds |
| 832 #ifdef SK_SUPPORT_LEGACY_SIMPLE_DRAWIMAGERECT | |
| 833 void drawImageRect(const SkImage* image, const SkRect& dst, const SkPaint* p
aint = NULL); | |
| 834 #else | |
| 835 void drawImageRect(const SkImage* image, const SkRect& dst, const SkPaint* p
aint, | 829 void drawImageRect(const SkImage* image, const SkRect& dst, const SkPaint* p
aint, |
| 836 SrcRectConstraint = kStrict_SrcRectConstraint); | 830 SrcRectConstraint = kStrict_SrcRectConstraint); |
| 837 #endif | |
| 838 | |
| 839 #ifdef SK_SUPPORT_LEGACY_SRCPTR_DRAWIMAGERECT | |
| 840 void drawImageRect(const SkImage* image, const SkRect* src, const SkRect& ds
t, | |
| 841 const SkPaint* paint, SrcRectConstraint = kStrict_SrcRect
Constraint); | |
| 842 | |
| 843 void drawImageRect(const SkImage* image, const SkRect* src, const SkRect& ds
t) { | |
| 844 this->drawImageRect(image, src, dst, NULL, kStrict_SrcRectConstraint); | |
| 845 } | |
| 846 #endif | |
| 847 | 831 |
| 848 /** | 832 /** |
| 849 * Draw the image stretched differentially to fit into dst. | 833 * Draw the image stretched differentially to fit into dst. |
| 850 * center is a rect within the image, and logically divides the image | 834 * center is a rect within the image, and logically divides the image |
| 851 * into 9 sections (3x3). For example, if the middle pixel of a [5x5] | 835 * into 9 sections (3x3). For example, if the middle pixel of a [5x5] |
| 852 * image is the "center", then the center-rect should be [2, 2, 3, 3]. | 836 * image is the "center", then the center-rect should be [2, 2, 3, 3]. |
| 853 * | 837 * |
| 854 * If the dst is >= the image size, then... | 838 * If the dst is >= the image size, then... |
| 855 * - The 4 corners are not stretched at all. | 839 * - The 4 corners are not stretched at all. |
| 856 * - The sides are stretched in only one axis. | 840 * - The sides are stretched in only one axis. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 * @param dst The destination rectangle where the scaled/translated | 874 * @param dst The destination rectangle where the scaled/translated |
| 891 * bitmap will be drawn | 875 * bitmap will be drawn |
| 892 * @param paint The paint used to draw the bitmap, or NULL | 876 * @param paint The paint used to draw the bitmap, or NULL |
| 893 * @param constraint Control the tradeoff between speed and exactness w.r.t
. the src-rect. | 877 * @param constraint Control the tradeoff between speed and exactness w.r.t
. the src-rect. |
| 894 */ | 878 */ |
| 895 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& src, const SkRect&
dst, | 879 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& src, const SkRect&
dst, |
| 896 const SkPaint* paint, SrcRectConstraint = kStrict_SrcRec
tConstraint); | 880 const SkPaint* paint, SrcRectConstraint = kStrict_SrcRec
tConstraint); |
| 897 // variant where src is SkIRect | 881 // variant where src is SkIRect |
| 898 void drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const SkRec
t& dst, | 882 void drawBitmapRect(const SkBitmap& bitmap, const SkIRect& isrc, const SkRec
t& dst, |
| 899 const SkPaint* paint, SrcRectConstraint = kStrict_SrcRec
tConstraint); | 883 const SkPaint* paint, SrcRectConstraint = kStrict_SrcRec
tConstraint); |
| 900 #ifdef SK_SUPPORT_LEGACY_SIMPLE_DRAWIMAGERECT | |
| 901 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, const SkPaint
* paint = NULL); | |
| 902 #else | |
| 903 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, const SkPaint
* paint, | 884 void drawBitmapRect(const SkBitmap& bitmap, const SkRect& dst, const SkPaint
* paint, |
| 904 SrcRectConstraint = kStrict_SrcRectConstraint); | 885 SrcRectConstraint = kStrict_SrcRectConstraint); |
| 905 #endif | |
| 906 | |
| 907 #ifdef SK_SUPPORT_LEGACY_SRCPTR_DRAWIMAGERECT | |
| 908 void drawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect&
dst, | |
| 909 const SkPaint* paint, SrcRectConstraint = kStrict_SrcRec
tConstraint); | |
| 910 #endif | |
| 911 | 886 |
| 912 /** | 887 /** |
| 913 * Draw the bitmap stretched differentially to fit into dst. | 888 * Draw the bitmap stretched differentially to fit into dst. |
| 914 * center is a rect within the bitmap, and logically divides the bitmap | 889 * center is a rect within the bitmap, and logically divides the bitmap |
| 915 * into 9 sections (3x3). For example, if the middle pixel of a [5x5] | 890 * into 9 sections (3x3). For example, if the middle pixel of a [5x5] |
| 916 * bitmap is the "center", then the center-rect should be [2, 2, 3, 3]. | 891 * bitmap is the "center", then the center-rect should be [2, 2, 3, 3]. |
| 917 * | 892 * |
| 918 * If the dst is >= the bitmap size, then... | 893 * If the dst is >= the bitmap size, then... |
| 919 * - The 4 corners are not stretched at all. | 894 * - The 4 corners are not stretched at all. |
| 920 * - The sides are stretched in only one axis. | 895 * - The sides are stretched in only one axis. |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1587 | 1562 |
| 1588 class SkCanvasClipVisitor { | 1563 class SkCanvasClipVisitor { |
| 1589 public: | 1564 public: |
| 1590 virtual ~SkCanvasClipVisitor(); | 1565 virtual ~SkCanvasClipVisitor(); |
| 1591 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1566 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
| 1592 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1567 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
| 1593 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1568 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
| 1594 }; | 1569 }; |
| 1595 | 1570 |
| 1596 #endif | 1571 #endif |
| OLD | NEW |