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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 the clips in the stack. | 47 the clips in the stack. |
48 | 48 |
49 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) |
50 of the object being drawn is held by the Paint, which is provided as a | 50 of the object being drawn is held by the Paint, which is provided as a |
51 parameter to each of the draw() methods. The Paint holds attributes such as | 51 parameter to each of the draw() methods. The Paint holds attributes such as |
52 color, typeface, textSize, strokeWidth, shader (e.g. gradients, patterns), | 52 color, typeface, textSize, strokeWidth, shader (e.g. gradients, patterns), |
53 etc. | 53 etc. |
54 */ | 54 */ |
55 class SK_API SkCanvas : public SkRefCnt { | 55 class SK_API SkCanvas : public SkRefCnt { |
56 public: | 56 public: |
57 SK_DECLARE_INST_COUNT(SkCanvas) | |
58 | |
59 /** | 57 /** |
60 * Attempt to allocate raster canvas, matching the ImageInfo, that will dra
w directly into the | 58 * Attempt to allocate raster canvas, matching the ImageInfo, that will dra
w directly into the |
61 * specified pixels. To access the pixels after drawing to them, the caller
should call | 59 * specified pixels. To access the pixels after drawing to them, the caller
should call |
62 * flush() or call peekPixels(...). | 60 * flush() or call peekPixels(...). |
63 * | 61 * |
64 * On failure, return NULL. This can fail for several reasons: | 62 * On failure, return NULL. This can fail for several reasons: |
65 * 1. invalid ImageInfo (e.g. negative dimensions) | 63 * 1. invalid ImageInfo (e.g. negative dimensions) |
66 * 2. unsupported ImageInfo for a canvas | 64 * 2. unsupported ImageInfo for a canvas |
67 * - kUnknown_SkColorType, kIndex_8_SkColorType | 65 * - kUnknown_SkColorType, kIndex_8_SkColorType |
68 * - kUnknown_SkAlphaType | 66 * - kUnknown_SkAlphaType |
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 virtual void onDrawDrawable(SkDrawable*); | 1232 virtual void onDrawDrawable(SkDrawable*); |
1235 | 1233 |
1236 virtual void onDrawPaint(const SkPaint&); | 1234 virtual void onDrawPaint(const SkPaint&); |
1237 virtual void onDrawRect(const SkRect&, const SkPaint&); | 1235 virtual void onDrawRect(const SkRect&, const SkPaint&); |
1238 virtual void onDrawOval(const SkRect&, const SkPaint&); | 1236 virtual void onDrawOval(const SkRect&, const SkPaint&); |
1239 virtual void onDrawRRect(const SkRRect&, const SkPaint&); | 1237 virtual void onDrawRRect(const SkRRect&, const SkPaint&); |
1240 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons
t SkPaint&); | 1238 virtual void onDrawPoints(PointMode, size_t count, const SkPoint pts[], cons
t SkPaint&); |
1241 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti
ces[], | 1239 virtual void onDrawVertices(VertexMode, int vertexCount, const SkPoint verti
ces[], |
1242 const SkPoint texs[], const SkColor colors[], Sk
Xfermode*, | 1240 const SkPoint texs[], const SkColor colors[], Sk
Xfermode*, |
1243 const uint16_t indices[], int indexCount, const
SkPaint&); | 1241 const uint16_t indices[], int indexCount, const
SkPaint&); |
1244 | 1242 |
1245 virtual void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[],
const SkColor[], | 1243 virtual void onDrawAtlas(const SkImage*, const SkRSXform[], const SkRect[],
const SkColor[], |
1246 int count, SkXfermode::Mode, const SkRect* cull, co
nst SkPaint*); | 1244 int count, SkXfermode::Mode, const SkRect* cull, co
nst SkPaint*); |
1247 virtual void onDrawPath(const SkPath&, const SkPaint&); | 1245 virtual void onDrawPath(const SkPath&, const SkPaint&); |
1248 virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkP
aint*); | 1246 virtual void onDrawImage(const SkImage*, SkScalar dx, SkScalar dy, const SkP
aint*); |
1249 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c
onst SkPaint*); | 1247 virtual void onDrawImageRect(const SkImage*, const SkRect*, const SkRect&, c
onst SkPaint*); |
1250 virtual void onDrawImageNine(const SkImage*, const SkIRect& center, const Sk
Rect& dst, | 1248 virtual void onDrawImageNine(const SkImage*, const SkIRect& center, const Sk
Rect& dst, |
1251 const SkPaint*); | 1249 const SkPaint*); |
1252 | 1250 |
1253 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S
kPaint*); | 1251 virtual void onDrawBitmap(const SkBitmap&, SkScalar dx, SkScalar dy, const S
kPaint*); |
1254 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&,
const SkPaint*, | 1252 virtual void onDrawBitmapRect(const SkBitmap&, const SkRect*, const SkRect&,
const SkPaint*, |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 | 1513 |
1516 class SkCanvasClipVisitor { | 1514 class SkCanvasClipVisitor { |
1517 public: | 1515 public: |
1518 virtual ~SkCanvasClipVisitor(); | 1516 virtual ~SkCanvasClipVisitor(); |
1519 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1517 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1520 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1518 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1521 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1519 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1522 }; | 1520 }; |
1523 | 1521 |
1524 #endif | 1522 #endif |
OLD | NEW |