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 |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 /** | 25 /** |
26 * Base class for image filters. If one is installed in the paint, then | 26 * Base class for image filters. If one is installed in the paint, then |
27 * all drawing occurs as usual, but it is as if the drawing happened into an | 27 * all drawing occurs as usual, but it is as if the drawing happened into an |
28 * offscreen (before the xfermode is applied). This offscreen bitmap will | 28 * offscreen (before the xfermode is applied). This offscreen bitmap will |
29 * then be handed to the imagefilter, who in turn creates a new bitmap which | 29 * then be handed to the imagefilter, who in turn creates a new bitmap which |
30 * is what will finally be drawn to the device (using the original xfermode). | 30 * is what will finally be drawn to the device (using the original xfermode). |
31 */ | 31 */ |
32 class SK_API SkImageFilter : public SkFlattenable { | 32 class SK_API SkImageFilter : public SkFlattenable { |
33 public: | 33 public: |
34 SK_DECLARE_INST_COUNT(SkImageFilter) | |
35 | |
36 class CropRect { | 34 class CropRect { |
37 public: | 35 public: |
38 enum CropEdge { | 36 enum CropEdge { |
39 kHasLeft_CropEdge = 0x01, | 37 kHasLeft_CropEdge = 0x01, |
40 kHasTop_CropEdge = 0x02, | 38 kHasTop_CropEdge = 0x02, |
41 kHasRight_CropEdge = 0x04, | 39 kHasRight_CropEdge = 0x04, |
42 kHasBottom_CropEdge = 0x08, | 40 kHasBottom_CropEdge = 0x08, |
43 kHasAll_CropEdge = 0x0F, | 41 kHasAll_CropEdge = 0x0F, |
44 }; | 42 }; |
45 CropRect() {} | 43 CropRect() {} |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 Cache* cache() const { return fCache; } | 75 Cache* cache() const { return fCache; } |
78 private: | 76 private: |
79 SkMatrix fCTM; | 77 SkMatrix fCTM; |
80 SkIRect fClipBounds; | 78 SkIRect fClipBounds; |
81 Cache* fCache; | 79 Cache* fCache; |
82 }; | 80 }; |
83 | 81 |
84 class Proxy { | 82 class Proxy { |
85 public: | 83 public: |
86 Proxy(SkBaseDevice* device) : fDevice(device) { } | 84 Proxy(SkBaseDevice* device) : fDevice(device) { } |
87 | 85 |
88 SkBaseDevice* createDevice(int width, int height); | 86 SkBaseDevice* createDevice(int width, int height); |
89 | 87 |
90 // Returns true if the proxy handled the filter itself. If this returns | 88 // Returns true if the proxy handled the filter itself. If this returns |
91 // false then the filter's code will be called. | 89 // false then the filter's code will be called. |
92 bool filterImage(const SkImageFilter*, const SkBitmap& src, const SkImag
eFilter::Context&, | 90 bool filterImage(const SkImageFilter*, const SkBitmap& src, const SkImag
eFilter::Context&, |
93 SkBitmap* result, SkIPoint* offset); | 91 SkBitmap* result, SkIPoint* offset); |
94 | 92 |
95 private: | 93 private: |
96 SkBaseDevice* fDevice; | 94 SkBaseDevice* fDevice; |
97 }; | 95 }; |
98 | 96 |
99 | 97 |
100 /** | 98 /** |
101 * Request a new (result) image to be created from the src image. | 99 * Request a new (result) image to be created from the src image. |
102 * If the src has no pixels (isNull()) then the request just wants to | 100 * If the src has no pixels (isNull()) then the request just wants to |
103 * receive the config and width/height of the result. | 101 * receive the config and width/height of the result. |
104 * | 102 * |
105 * The matrix is the current matrix on the canvas. | 103 * The matrix is the current matrix on the canvas. |
106 * | 104 * |
107 * Offset is the amount to translate the resulting image relative to the | 105 * Offset is the amount to translate the resulting image relative to the |
108 * src when it is drawn. This is an out-param. | 106 * src when it is drawn. This is an out-param. |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 */ | 365 */ |
368 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ | 366 #define SK_IMAGEFILTER_UNFLATTEN_COMMON(localVar, expectedCount) \ |
369 Common localVar; \ | 367 Common localVar; \ |
370 do { \ | 368 do { \ |
371 if (!localVar.unflatten(buffer, expectedCount)) { \ | 369 if (!localVar.unflatten(buffer, expectedCount)) { \ |
372 return NULL; \ | 370 return NULL; \ |
373 } \ | 371 } \ |
374 } while (0) | 372 } while (0) |
375 | 373 |
376 #endif | 374 #endif |
OLD | NEW |