| 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; | |
| 26 class SkDraw; | 25 class SkDraw; |
| 27 class SkDrawable; | 26 class SkDrawable; |
| 28 class SkDrawFilter; | 27 class SkDrawFilter; |
| 29 class SkImage; | 28 class SkImage; |
| 30 class SkImageFilter; | 29 class SkImageFilter; |
| 31 class SkMetaData; | 30 class SkMetaData; |
| 32 class SkPath; | 31 class SkPath; |
| 33 class SkPicture; | 32 class SkPicture; |
| 34 class SkPixmap; | 33 class SkPixmap; |
| 35 class SkRRect; | 34 class SkRRect; |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1066 * Draw the contents of this drawable into the canvas. If the canvas is asy
nc | 1065 * Draw the contents of this drawable into the canvas. If the canvas is asy
nc |
| 1067 * (e.g. it is recording into a picture) then the drawable will be referenc
ed instead, | 1066 * (e.g. it is recording into a picture) then the drawable will be referenc
ed instead, |
| 1068 * to have its draw() method called when the picture is finalized. | 1067 * to have its draw() method called when the picture is finalized. |
| 1069 * | 1068 * |
| 1070 * If the intent is to force the contents of the drawable into this canvas
immediately, | 1069 * If the intent is to force the contents of the drawable into this canvas
immediately, |
| 1071 * then drawable->draw(canvas) may be called. | 1070 * then drawable->draw(canvas) may be called. |
| 1072 */ | 1071 */ |
| 1073 void drawDrawable(SkDrawable* drawable, const SkMatrix* = NULL); | 1072 void drawDrawable(SkDrawable* drawable, const SkMatrix* = NULL); |
| 1074 void drawDrawable(SkDrawable*, SkScalar x, SkScalar y); | 1073 void drawDrawable(SkDrawable*, SkScalar x, SkScalar y); |
| 1075 | 1074 |
| 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 | |
| 1088 ////////////////////////////////////////////////////////////////////////// | 1075 ////////////////////////////////////////////////////////////////////////// |
| 1089 #ifdef SK_INTERNAL | 1076 #ifdef SK_INTERNAL |
| 1090 #ifndef SK_SUPPORT_LEGACY_DRAWFILTER | 1077 #ifndef SK_SUPPORT_LEGACY_DRAWFILTER |
| 1091 #define SK_SUPPORT_LEGACY_DRAWFILTER | 1078 #define SK_SUPPORT_LEGACY_DRAWFILTER |
| 1092 #endif | 1079 #endif |
| 1093 #endif | 1080 #endif |
| 1094 | 1081 |
| 1095 #ifdef SK_SUPPORT_LEGACY_DRAWFILTER | 1082 #ifdef SK_SUPPORT_LEGACY_DRAWFILTER |
| 1096 /** Get the current filter object. The filter's reference count is not | 1083 /** Get the current filter object. The filter's reference count is not |
| 1097 affected. The filter is saved/restored, just like the matrix and clip. | 1084 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... |
| 1227 virtual void willSave() {} | 1214 virtual void willSave() {} |
| 1228 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. | 1215 // Overriders should call the corresponding INHERITED method up the inherita
nce chain. |
| 1229 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { | 1216 virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) { |
| 1230 return kFullLayer_SaveLayerStrategy; | 1217 return kFullLayer_SaveLayerStrategy; |
| 1231 } | 1218 } |
| 1232 virtual void willRestore() {} | 1219 virtual void willRestore() {} |
| 1233 virtual void didRestore() {} | 1220 virtual void didRestore() {} |
| 1234 virtual void didConcat(const SkMatrix&) {} | 1221 virtual void didConcat(const SkMatrix&) {} |
| 1235 virtual void didSetMatrix(const SkMatrix&) {} | 1222 virtual void didSetMatrix(const SkMatrix&) {} |
| 1236 | 1223 |
| 1237 virtual void onDrawAnnotation(const SkRect&, const char key[], SkData* value
); | |
| 1238 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); | 1224 virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&); |
| 1239 | 1225 |
| 1240 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, | 1226 virtual void onDrawText(const void* text, size_t byteLength, SkScalar x, |
| 1241 SkScalar y, const SkPaint& paint); | 1227 SkScalar y, const SkPaint& paint); |
| 1242 | 1228 |
| 1243 virtual void onDrawPosText(const void* text, size_t byteLength, | 1229 virtual void onDrawPosText(const void* text, size_t byteLength, |
| 1244 const SkPoint pos[], const SkPaint& paint); | 1230 const SkPoint pos[], const SkPaint& paint); |
| 1245 | 1231 |
| 1246 virtual void onDrawPosTextH(const void* text, size_t byteLength, | 1232 virtual void onDrawPosTextH(const void* text, size_t byteLength, |
| 1247 const SkScalar xpos[], SkScalar constY, | 1233 const SkScalar xpos[], SkScalar constY, |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 | 1495 |
| 1510 class SkCanvasClipVisitor { | 1496 class SkCanvasClipVisitor { |
| 1511 public: | 1497 public: |
| 1512 virtual ~SkCanvasClipVisitor(); | 1498 virtual ~SkCanvasClipVisitor(); |
| 1513 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; | 1499 virtual void clipRect(const SkRect&, SkRegion::Op, bool antialias) = 0; |
| 1514 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; | 1500 virtual void clipRRect(const SkRRect&, SkRegion::Op, bool antialias) = 0; |
| 1515 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; | 1501 virtual void clipPath(const SkPath&, SkRegion::Op, bool antialias) = 0; |
| 1516 }; | 1502 }; |
| 1517 | 1503 |
| 1518 #endif | 1504 #endif |
| OLD | NEW |