reed@google.com | 894aa9a | 2011-09-23 14:49:49 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2011 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #ifndef SkImageFilter_DEFINED |
| 9 | #define SkImageFilter_DEFINED |
| 10 | |
| 11 | #include "SkFlattenable.h" |
| 12 | |
| 13 | class SkImageFilter : public SkFlattenable { |
| 14 | public: |
| 15 | |
| 16 | /** |
| 17 | * Request a new (result) image to be created from the src image. |
| 18 | * If the src has no pixels (isNull()) then the request just wants to |
| 19 | * receive the config and width/height of the result. |
| 20 | * |
| 21 | * The matrix is the current matrix on the canvas. |
| 22 | * |
| 23 | * Offset is the amount to translate the resulting image relative to the |
| 24 | * src when it is drawn. |
| 25 | * |
| 26 | * If the result image cannot be created, return false, in which case both |
| 27 | * the result and offset parameters will be ignored by the caller. |
| 28 | */ |
| 29 | bool filterImage(const SkBitmap& src, const SkMatrix&, |
| 30 | SkBitmap* result, SkPoint* offset); |
| 31 | |
| 32 | protected: |
| 33 | virtual bool onFilterImage(const SkBitmap& src, const SkMatrix& |
| 34 | SkBitmap* result, SkPoint* offset) = 0; |
| 35 | |
| 36 | private: |
| 37 | typedef SkFlattenable INHERITED; |
| 38 | }; |
| 39 | |
| 40 | #endif |