| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkImageFilter_DEFINED | 8 #ifndef SkImageFilter_DEFINED |
| 9 #define SkImageFilter_DEFINED | 9 #define SkImageFilter_DEFINED |
| 10 | 10 |
| 11 #include "SkFlattenable.h" | 11 #include "SkFlattenable.h" |
| 12 #include "SkRect.h" | 12 #include "SkRect.h" |
| 13 | 13 |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 class SkColorFilter; | 15 class SkColorFilter; |
| 16 class SkDevice; | 16 class SkBaseDevice; |
| 17 class SkMatrix; | 17 class SkMatrix; |
| 18 struct SkIPoint; | 18 struct SkIPoint; |
| 19 class SkShader; | 19 class SkShader; |
| 20 class GrEffectRef; | 20 class GrEffectRef; |
| 21 class GrTexture; | 21 class GrTexture; |
| 22 | 22 |
| 23 /** | 23 /** |
| 24 * Base class for image filters. If one is installed in the paint, then | 24 * Base class for image filters. If one is installed in the paint, then |
| 25 * all drawing occurs as usual, but it is as if the drawing happened into an | 25 * all drawing occurs as usual, but it is as if the drawing happened into an |
| 26 * offscreen (before the xfermode is applied). This offscreen bitmap will | 26 * offscreen (before the xfermode is applied). This offscreen bitmap will |
| 27 * then be handed to the imagefilter, who in turn creates a new bitmap which | 27 * then be handed to the imagefilter, who in turn creates a new bitmap which |
| 28 * is what will finally be drawn to the device (using the original xfermode). | 28 * is what will finally be drawn to the device (using the original xfermode). |
| 29 */ | 29 */ |
| 30 class SK_API SkImageFilter : public SkFlattenable { | 30 class SK_API SkImageFilter : public SkFlattenable { |
| 31 public: | 31 public: |
| 32 SK_DECLARE_INST_COUNT(SkImageFilter) | 32 SK_DECLARE_INST_COUNT(SkImageFilter) |
| 33 | 33 |
| 34 class Proxy { | 34 class Proxy { |
| 35 public: | 35 public: |
| 36 virtual ~Proxy() {}; | 36 virtual ~Proxy() {}; |
| 37 | 37 |
| 38 virtual SkDevice* createDevice(int width, int height) = 0; | 38 virtual SkBaseDevice* createDevice(int width, int height) = 0; |
| 39 // returns true if the proxy can handle this filter natively | 39 // returns true if the proxy can handle this filter natively |
| 40 virtual bool canHandleImageFilter(SkImageFilter*) = 0; | 40 virtual bool canHandleImageFilter(SkImageFilter*) = 0; |
| 41 // returns true if the proxy handled the filter itself. if this returns | 41 // returns true if the proxy handled the filter itself. if this returns |
| 42 // false then the filter's code will be called. | 42 // false then the filter's code will be called. |
| 43 virtual bool filterImage(SkImageFilter*, const SkBitmap& src, | 43 virtual bool filterImage(SkImageFilter*, const SkBitmap& src, |
| 44 const SkMatrix& ctm, | 44 const SkMatrix& ctm, |
| 45 SkBitmap* result, SkIPoint* offset) = 0; | 45 SkBitmap* result, SkIPoint* offset) = 0; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 /** | 48 /** |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const; | 167 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const; |
| 168 | 168 |
| 169 private: | 169 private: |
| 170 typedef SkFlattenable INHERITED; | 170 typedef SkFlattenable INHERITED; |
| 171 int fInputCount; | 171 int fInputCount; |
| 172 SkImageFilter** fInputs; | 172 SkImageFilter** fInputs; |
| 173 SkIRect fCropRect; | 173 SkIRect fCropRect; |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 #endif | 176 #endif |
| OLD | NEW |