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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 }; | 64 }; |
65 | 65 |
66 /** | 66 /** |
67 * Request a new (result) image to be created from the src image. | 67 * Request a new (result) image to be created from the src image. |
68 * If the src has no pixels (isNull()) then the request just wants to | 68 * If the src has no pixels (isNull()) then the request just wants to |
69 * receive the config and width/height of the result. | 69 * receive the config and width/height of the result. |
70 * | 70 * |
71 * The matrix is the current matrix on the canvas. | 71 * The matrix is the current matrix on the canvas. |
72 * | 72 * |
73 * Offset is the amount to translate the resulting image relative to the | 73 * Offset is the amount to translate the resulting image relative to the |
74 * src when it is drawn. | 74 * src when it is drawn. This is an out-param. |
75 * | 75 * |
76 * If the result image cannot be created, return false, in which case both | 76 * If the result image cannot be created, return false, in which case both |
77 * the result and offset parameters will be ignored by the caller. | 77 * the result and offset parameters will be ignored by the caller. |
78 */ | 78 */ |
79 bool filterImage(Proxy*, const SkBitmap& src, const SkMatrix& ctm, | 79 bool filterImage(Proxy*, const SkBitmap& src, const SkMatrix& ctm, |
80 SkBitmap* result, SkIPoint* offset); | 80 SkBitmap* result, SkIPoint* offset); |
81 | 81 |
82 /** | 82 /** |
83 * Given the src bounds of an image, this returns the bounds of the result | 83 * Given the src bounds of an image, this returns the bounds of the result |
84 * image after the filter has been applied. | 84 * image after the filter has been applied. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 * Constructs a new SkImageFilter read from an SkFlattenableReadBuffer obje
ct. | 160 * Constructs a new SkImageFilter read from an SkFlattenableReadBuffer obje
ct. |
161 * | 161 * |
162 * @param inputCount The exact number of inputs expected for this SkImag
eFilter object. | 162 * @param inputCount The exact number of inputs expected for this SkImag
eFilter object. |
163 * -1 can be used if the filter accepts any number of
inputs. | 163 * -1 can be used if the filter accepts any number of
inputs. |
164 * @param rb SkFlattenableReadBuffer object from which the SkIma
geFilter is read. | 164 * @param rb SkFlattenableReadBuffer object from which the SkIma
geFilter is read. |
165 */ | 165 */ |
166 explicit SkImageFilter(int inputCount, SkFlattenableReadBuffer& rb); | 166 explicit SkImageFilter(int inputCount, SkFlattenableReadBuffer& rb); |
167 | 167 |
168 virtual void flatten(SkFlattenableWriteBuffer& wb) const SK_OVERRIDE; | 168 virtual void flatten(SkFlattenableWriteBuffer& wb) const SK_OVERRIDE; |
169 | 169 |
170 // Default impl returns false | 170 /** |
| 171 * This is the virtual which should be overridden by the derived class |
| 172 * to perform image filtering. |
| 173 * |
| 174 * src is the original primitive bitmap. If the filter has a connected |
| 175 * input, it should recurse on that input and use that in place of src. |
| 176 * |
| 177 * The matrix is the current matrix on the canvas. |
| 178 * |
| 179 * Offset is the amount to translate the resulting image relative to the |
| 180 * src when it is drawn. This is an out-param. |
| 181 * |
| 182 * If the result image cannot be created, this should false, in which |
| 183 * case both the result and offset parameters will be ignored by the |
| 184 * caller. |
| 185 */ |
171 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 186 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
172 SkBitmap* result, SkIPoint* offset); | 187 SkBitmap* result, SkIPoint* offset); |
173 // Default impl copies src into dst and returns true | 188 // Default impl copies src into dst and returns true |
174 virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*); | 189 virtual bool onFilterBounds(const SkIRect&, const SkMatrix&, SkIRect*); |
175 | 190 |
176 // Applies "matrix" to the crop rect, and sets "rect" to the intersection of | 191 // Applies "matrix" to the crop rect, and sets "rect" to the intersection of |
177 // "rect" and the transformed crop rect. If there is no overlap, returns | 192 // "rect" and the transformed crop rect. If there is no overlap, returns |
178 // false and leaves "rect" unchanged. | 193 // false and leaves "rect" unchanged. |
179 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const; | 194 bool applyCropRect(SkIRect* rect, const SkMatrix& matrix) const; |
180 | 195 |
(...skipping 18 matching lines...) Expand all Loading... |
199 const SkIRect& bounds) const; | 214 const SkIRect& bounds) const; |
200 | 215 |
201 private: | 216 private: |
202 typedef SkFlattenable INHERITED; | 217 typedef SkFlattenable INHERITED; |
203 int fInputCount; | 218 int fInputCount; |
204 SkImageFilter** fInputs; | 219 SkImageFilter** fInputs; |
205 CropRect fCropRect; | 220 CropRect fCropRect; |
206 }; | 221 }; |
207 | 222 |
208 #endif | 223 #endif |
OLD | NEW |