blob: 39b1717617a24c7bc4d8ab195a4c605ad9cdf75c [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@android.com8a1c16f2008-12-17 15:59:43 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * Copyright 2011 The Android Open Source Project
reed@android.com8a1c16f2008-12-17 15:59:43 +00004 *
epoger@google.comec3ed6a2011-07-28 14:26:00 +00005 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
reed@android.com8a1c16f2008-12-17 15:59:43 +00007 */
8
epoger@google.comec3ed6a2011-07-28 14:26:00 +00009
reed@android.com8a1c16f2008-12-17 15:59:43 +000010#ifndef SkDrawFilter_DEFINED
11#define SkDrawFilter_DEFINED
12
13#include "SkRefCnt.h"
14
reed@android.com8a1c16f2008-12-17 15:59:43 +000015class SkCanvas;
16class SkPaint;
17
reed@google.com4e2b3d32011-04-07 14:18:59 +000018/**
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.com8a1c16f2008-12-17 15:59:43 +000024class SkDrawFilter : public SkRefCnt {
25public:
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.com4e2b3d32011-04-07 14:18:59 +000036 /**
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.com15e9d3e2012-06-21 20:25:03 +000041
42private:
43 typedef SkRefCnt INHERITED;
reed@android.com8a1c16f2008-12-17 15:59:43 +000044};
45
46#endif