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 |
11 #include "SkTypes.h" | 11 #include "SkTypes.h" |
12 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
13 #include "SkDeque.h" | 13 #include "SkDeque.h" |
14 #include "SkPaint.h" | 14 #include "SkPaint.h" |
15 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
16 #include "SkRegion.h" | 16 #include "SkRegion.h" |
17 #include "SkSurfaceProps.h" | 17 #include "SkSurfaceProps.h" |
18 #include "SkXfermode.h" | 18 #include "SkXfermode.h" |
19 | 19 |
20 class GrContext; | 20 class GrContext; |
21 class GrRenderTarget; | 21 class GrRenderTarget; |
22 class SkBaseDevice; | 22 class SkBaseDevice; |
23 class SkCanvasClipVisitor; | 23 class SkCanvasClipVisitor; |
24 class SkClipStack; | 24 class SkClipStack; |
| 25 class SkData; |
25 class SkDraw; | 26 class SkDraw; |
26 class SkDrawable; | 27 class SkDrawable; |
27 class SkDrawFilter; | 28 class SkDrawFilter; |
28 class SkImage; | 29 class SkImage; |
29 class SkImageFilter; | 30 class SkImageFilter; |
30 class SkMetaData; | 31 class SkMetaData; |
31 class SkPath; | 32 class SkPath; |
32 class SkPicture; | 33 class SkPicture; |
33 class SkPixmap; | 34 class SkPixmap; |
34 class SkRRect; | 35 class SkRRect; |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 * Draw the contents of this drawable into the canvas. If the canvas is asy
nc | 1066 * Draw the contents of this drawable into the canvas. If the canvas is asy
nc |
1066 * (e.g. it is recording into a picture) then the drawable will be referenc
ed instead, | 1067 * (e.g. it is recording into a picture) then the drawable will be referenc
ed instead, |
1067 * to have its draw() method called when the picture is finalized. | 1068 * to have its draw() method called when the picture is finalized. |
1068 * | 1069 * |
1069 * If the intent is to force the contents of the drawable into this canvas
immediately, | 1070 * If the intent is to force the contents of the drawable into this canvas
immediately, |
1070 * then drawable->draw(canvas) may be called. | 1071 * then drawable->draw(canvas) may be called. |
1071 */ | 1072 */ |
1072 void drawDrawable(SkDrawable* drawable, const SkMatrix* = NULL); | 1073 void drawDrawable(SkDrawable* drawable, const SkMatrix* = NULL); |
1073 void drawDrawable(SkDrawable*, SkScalar x, SkScalar y); | 1074 void drawDrawable(SkDrawable*, SkScalar x, SkScalar y); |
1074 | 1075 |
| 1076 /** |
| 1077 * Send an "annotation" to the canvas. The annotation is a key/value pair,
where the key is |
| 1078 * a null-terminated utf8 string, and the value is a blob of data stored in
an SkData |
| 1079 * (which may be null). The annotation is associated with the specified rec
tangle. |
| 1080 * |
| 1081 * The caller still retains its ownership of the data (if any). |
| 1082 * |
| 1083 * Note: on may canvas types, this information is ignored, but some canvase
s (e.g. recording |
| 1084 * a picture or drawing to a PDF document) will pass on this information. |
| 1085 */ |
| 1086 void drawAnnotation(const SkRect&, const char key[], SkData* value); |
| 1087 |
1075 ////////////////////////////////////////////////////////////////////////// | 1088 ////////////////////////////////////////////////////////////////////////// |
1076 #ifdef SK_INTERNAL | 1089 #ifdef SK_INTERNAL |
1077 #ifndef SK_SUPPORT_LEGACY_DRAWFILTER | 1090 #ifndef SK_SUPPORT_LEGACY_DRAWFILTER |
1078 #define SK_SUPPORT_LEGACY_DRAWFILTER | 1091 #define SK_SUPPORT_LEGACY_DRAWFILTER |
1079 #endif | 1092 #endif |
1080 #endif | 1093 #endif |
1081 | 1094 |
1082 #ifdef SK_SUPPORT_LEGACY_DRAWFILTER | 1095 #ifdef SK_SUPPORT_LEGACY_DRAWFILTER |
1083 /** Get the current filter object. The filter's reference count is not | 1096 /** Get the current filter object. The filter's reference count is not |
1084 affected. The filter is saved/restored, just like the matrix and clip. | 1097 affected. The filter is saved/restored, just like the matrix and clip. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 virtual void willSave() {} | 1227 virtual void willSave() {} |
1215 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. | 1228 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. |
1216 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { | 1229 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { |
1217 return kFullLayer_SaveLayerStrategy; | 1230 return kFullLayer_SaveLayerStrategy; |
1218 } | 1231 } |
1219 virtual void willRestore() {} | 1232 virtual void willRestore() {} |
1220 virtual void didRestore() {} | 1233 virtual void didRestore() {} |
1221 virtual void didConcat(const SkMatrix&) {} | 1234 virtual void didConcat(const SkMatrix&) {} |
1222 virtual void didSetMatrix(const SkMatrix&) {} | 1235 virtual void didSetMatrix(const SkMatrix&) {} |
1223 | 1236 |
| 1237 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value
); |
1224 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); | 1238 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); |
1225 | 1239 |
1226 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, | 1240 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, |
1227 SkScalar y, const SkPaint& paint); | 1241 SkScalar y, const SkPaint& paint); |
1228 | 1242 |
1229 virtual void onDrawPosText(const void* text, size_t byteLength, | 1243 virtual void onDrawPosText(const void* text, size_t byteLength, |
1230 const SkPoint pos[], const SkPaint& paint); | 1244 const SkPoint pos[], const SkPaint& paint); |
1231 | 1245 |
1232 virtual void onDrawPosTextH(const void* text, size_t byteLength, | 1246 virtual void onDrawPosTextH(const void* text, size_t byteLength, |
1233 const SkScalar xpos[], SkScalar constY, | 1247 const SkScalar xpos[], SkScalar constY, |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 | 1509 |
1496 class SkCanvasClipVisitor { | 1510 class SkCanvasClipVisitor { |
1497 public: | 1511 public: |
1498 virtual ~SkCanvasClipVisitor(); | 1512 virtual ~SkCanvasClipVisitor(); |
1499 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1513 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
1500 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1514 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
1501 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1515 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
1502 }; | 1516 }; |
1503 | 1517 |
1504 #endif | 1518 #endif |
OLD | NEW |