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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 * - The 4 corners are not stretched at all. | 904 * - The 4 corners are not stretched at all. |
905 * - The sides are stretched in only one axis. | 905 * - The sides are stretched in only one axis. |
906 * - The center is stretched in both axes. | 906 * - The center is stretched in both axes. |
907 * Else, for each axis where dst < bitmap, | 907 * Else, for each axis where dst < bitmap, |
908 * - The corners shrink proportionally | 908 * - The corners shrink proportionally |
909 * - The sides (along the shrink axis) and center are not drawn | 909 * - The sides (along the shrink axis) and center are not drawn |
910 */ | 910 */ |
911 void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkR
ect& dst, | 911 void drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkR
ect& dst, |
912 const SkPaint* paint = NULL); | 912 const SkPaint* paint = NULL); |
913 | 913 |
| 914 /** Draw the specified bitmap, with its top/left corner at (x,y), |
| 915 NOT transformed by the current matrix. Note: if the paint |
| 916 contains a maskfilter that generates a mask which extends beyond the |
| 917 bitmap's original width/height, then the bitmap will be drawn as if it |
| 918 were in a Shader with CLAMP mode. Thus the color outside of the original |
| 919 width/height will be the edge color replicated. |
| 920 @param bitmap The bitmap to be drawn |
| 921 @param left The position of the left side of the bitmap being drawn |
| 922 @param top The position of the top side of the bitmap being drawn |
| 923 @param paint The paint used to draw the bitmap, or NULL |
| 924 */ |
| 925 void drawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* pa
int = NULL); |
| 926 |
914 /** Draw the text, with origin at (x,y), using the specified paint. | 927 /** Draw the text, with origin at (x,y), using the specified paint. |
915 The origin is interpreted based on the Align setting in the paint. | 928 The origin is interpreted based on the Align setting in the paint. |
916 @param text The text to be drawn | 929 @param text The text to be drawn |
917 @param byteLength The number of bytes to read from the text parameter | 930 @param byteLength The number of bytes to read from the text parameter |
918 @param x The x-coordinate of the origin of the text being drawn | 931 @param x The x-coordinate of the origin of the text being drawn |
919 @param y The y-coordinate of the origin of the text being drawn | 932 @param y The y-coordinate of the origin of the text being drawn |
920 @param paint The paint used for the text (e.g. color, size, style) | 933 @param paint The paint used for the text (e.g. color, size, style) |
921 */ | 934 */ |
922 void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, | 935 void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, |
923 const SkPaint& paint); | 936 const SkPaint& paint); |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1272 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c
onst SkPaint*, | 1285 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c
onst SkPaint*, |
1273 SrcRectConstraint); | 1286 SrcRectConstraint); |
1274 virtual void onDrawImageNine(const SkImage*, const SkIRect& center, const Sk
Rect& dst, | 1287 virtual void onDrawImageNine(const SkImage*, const SkIRect& center, const Sk
Rect& dst, |
1275 const SkPaint*); | 1288 const SkPaint*); |
1276 | 1289 |
1277 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S
kPaint*); | 1290 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S
kPaint*); |
1278 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&,
const SkPaint*, | 1291 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&,
const SkPaint*, |
1279 SrcRectConstraint); | 1292 SrcRectConstraint); |
1280 virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const
SkRect& dst, | 1293 virtual void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const
SkRect& dst, |
1281 const SkPaint*); | 1294 const SkPaint*); |
1282 #ifdef SK_SUPPORT_LEGACY_ONDRAWSPRITE | 1295 virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*
); |
1283 virtual void onDrawSprite(const SkBitmap&, int left, int top, const SkPaint*
) {} | |
1284 #endif | |
1285 | 1296 |
1286 enum ClipEdgeStyle { | 1297 enum ClipEdgeStyle { |
1287 kHard_ClipEdgeStyle, | 1298 kHard_ClipEdgeStyle, |
1288 kSoft_ClipEdgeStyle | 1299 kSoft_ClipEdgeStyle |
1289 }; | 1300 }; |
1290 | 1301 |
1291 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); | 1302 virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); |
1292 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle); | 1303 virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyl
e edgeStyle); |
1293 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); | 1304 virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle e
dgeStyle); |
1294 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); | 1305 virtual void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op); |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 | 1577 |
1567 class SkCanvasClipVisitor { | 1578 class SkCanvasClipVisitor { |
1568 public: | 1579 public: |
1569 virtual ~SkCanvasClipVisitor(); | 1580 virtual ~SkCanvasClipVisitor(); |
1570 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1581 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1571 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1582 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1572 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1583 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1573 }; | 1584 }; |
1574 | 1585 |
1575 #endif | 1586 #endif |
OLD | NEW |