OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 The Android Open Source Project | 3 * Copyright 2011 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkDrawFilter_DEFINED | 10 #ifndef SkDrawFilter_DEFINED |
11 #define SkDrawFilter_DEFINED | 11 #define SkDrawFilter_DEFINED |
12 | 12 |
13 #include "SkRefCnt.h" | 13 #include "SkRefCnt.h" |
14 | 14 |
15 class SkCanvas; | 15 class SkCanvas; |
16 class SkPaint; | 16 class SkPaint; |
17 | 17 |
18 /** | 18 /** |
19 * Right before something is being draw, filter() is called with the | 19 * Right before something is being draw, filter() is called with the |
20 * paint. The filter may modify the paint as it wishes, which will then be | 20 * paint. The filter may modify the paint as it wishes, which will then be |
21 * used for the actual drawing. Note: this modification only lasts for the | 21 * used for the actual drawing. Note: this modification only lasts for the |
22 * current draw, as a temporary copy of the paint is used. | 22 * current draw, as a temporary copy of the paint is used. |
23 */ | 23 */ |
24 class SK_API SkDrawFilter : public SkRefCnt { | 24 class SK_API SkDrawFilter : public SkRefCnt { |
25 public: | 25 public: |
26 SK_DECLARE_INST_COUNT(SkDrawFilter) | |
27 | |
28 enum Type { | 26 enum Type { |
29 kPaint_Type, | 27 kPaint_Type, |
30 kPoint_Type, | 28 kPoint_Type, |
31 kLine_Type, | 29 kLine_Type, |
32 kBitmap_Type, | 30 kBitmap_Type, |
33 kRect_Type, | 31 kRect_Type, |
34 kRRect_Type, | 32 kRRect_Type, |
35 kOval_Type, | 33 kOval_Type, |
36 kPath_Type, | 34 kPath_Type, |
37 kText_Type, | 35 kText_Type, |
38 }; | 36 }; |
39 | 37 |
40 enum { | 38 enum { |
41 kTypeCount = kText_Type + 1 | 39 kTypeCount = kText_Type + 1 |
42 }; | 40 }; |
43 | 41 |
44 /** | 42 /** |
45 * Called with the paint that will be used to draw the specified type. | 43 * Called with the paint that will be used to draw the specified type. |
46 * The implementation may modify the paint as they wish. If filter() | 44 * The implementation may modify the paint as they wish. If filter() |
47 * returns false, the draw will be skipped. | 45 * returns false, the draw will be skipped. |
48 */ | 46 */ |
49 virtual bool filter(SkPaint*, Type) = 0; | 47 virtual bool filter(SkPaint*, Type) = 0; |
50 | 48 |
51 private: | 49 private: |
52 typedef SkRefCnt INHERITED; | 50 typedef SkRefCnt INHERITED; |
53 }; | 51 }; |
54 | 52 |
55 #endif | 53 #endif |
OLD | NEW |