1 2 /* 3 * Copyright 2011 The Android Open Source Project 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10 #ifndef SkDrawFilter_DEFINED 11 #define SkDrawFilter_DEFINED 12 13 #include "SkRefCnt.h" 14 15 class SkCanvas; 16 class SkPaint; 17 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 */ 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 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; 41 }; 42 43 #endif 44