epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2011 The Android Open Source Project |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 4 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 9 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 10 | #ifndef SkDrawFilter_DEFINED |
| 11 | #define SkDrawFilter_DEFINED |
| 12 | |
| 13 | #include "SkRefCnt.h" |
| 14 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 15 | class SkCanvas; |
| 16 | class SkPaint; |
| 17 | |
reed@google.com | 4e2b3d3 | 2011-04-07 14:18:59 +0000 | [diff] [blame] | 18 | /** |
| 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 |
| 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. |
| 23 | */ |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 24 | class SkDrawFilter : public SkRefCnt { |
| 25 | public: |
| 26 | enum Type { |
| 27 | kPaint_Type, |
| 28 | kPoint_Type, |
| 29 | kLine_Type, |
| 30 | kBitmap_Type, |
| 31 | kRect_Type, |
| 32 | kPath_Type, |
| 33 | kText_Type |
| 34 | }; |
| 35 | |
reed@google.com | 4e2b3d3 | 2011-04-07 14:18:59 +0000 | [diff] [blame] | 36 | /** |
| 37 | * Called with the paint that will be used to draw the specified type. |
| 38 | * The implementation may modify the paint as they wish. |
| 39 | */ |
| 40 | virtual void filter(SkPaint*, Type) = 0; |
robertphillips@google.com | 15e9d3e | 2012-06-21 20:25:03 +0000 | [diff] [blame^] | 41 | |
| 42 | private: |
| 43 | typedef SkRefCnt INHERITED; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 44 | }; |
| 45 | |
| 46 | #endif |