OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkMaskFilter_DEFINED | 10 #ifndef SkMaskFilter_DEFINED |
11 #define SkMaskFilter_DEFINED | 11 #define SkMaskFilter_DEFINED |
12 | 12 |
13 #include "SkFlattenable.h" | 13 #include "SkFlattenable.h" |
14 #include "SkMask.h" | 14 #include "SkMask.h" |
15 #include "SkPaint.h" | 15 #include "SkPaint.h" |
16 | 16 |
17 class GrContext; | 17 class GrContext; |
18 class SkBitmap; | 18 class SkBitmap; |
19 class SkBlitter; | 19 class SkBlitter; |
20 class SkBounder; | 20 class SkBounder; |
21 class SkMatrix; | 21 class SkMatrix; |
22 class SkPath; | 22 class SkPath; |
23 class SkRasterClip; | 23 class SkRasterClip; |
| 24 class SkRRect; |
24 | 25 |
25 /** \class SkMaskFilter | 26 /** \class SkMaskFilter |
26 | 27 |
27 SkMaskFilter is the base class for object that perform transformations on | 28 SkMaskFilter is the base class for object that perform transformations on |
28 an alpha-channel mask before drawing it. A subclass of SkMaskFilter may be | 29 an alpha-channel mask before drawing it. A subclass of SkMaskFilter may be |
29 installed into a SkPaint. Once there, each time a primitive is drawn, it | 30 installed into a SkPaint. Once there, each time a primitive is drawn, it |
30 is first scan converted into a SkMask::kA8_Format mask, and handed to the | 31 is first scan converted into a SkMask::kA8_Format mask, and handed to the |
31 filter, calling its filterMask() method. If this returns true, then the | 32 filter, calling its filterMask() method. If this returns true, then the |
32 new mask is used to render into the device. | 33 new mask is used to render into the device. |
33 | 34 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 * stretch the mask to fit inside outerRect. It is an error for outerRect | 156 * stretch the mask to fit inside outerRect. It is an error for outerRect |
156 * to be smaller than the mask's bounds. This would imply that the width | 157 * to be smaller than the mask's bounds. This would imply that the width |
157 * and height of the mask should be odd. This is not required, just that | 158 * and height of the mask should be odd. This is not required, just that |
158 * the caller will call mask.fBounds.centerX() and centerY() to find the | 159 * the caller will call mask.fBounds.centerX() and centerY() to find the |
159 * strips that will be replicated. | 160 * strips that will be replicated. |
160 */ | 161 */ |
161 virtual FilterReturn filterRectsToNine(const SkRect[], int count, | 162 virtual FilterReturn filterRectsToNine(const SkRect[], int count, |
162 const SkMatrix&, | 163 const SkMatrix&, |
163 const SkIRect& clipBounds, | 164 const SkIRect& clipBounds, |
164 NinePatch*) const; | 165 NinePatch*) const; |
| 166 /** |
| 167 * Similar to filterRectsToNine, except it performs the work on a round rec
t. |
| 168 */ |
| 169 virtual FilterReturn filterRRectToNine(const SkRRect&, const SkMatrix&, |
| 170 const SkIRect& clipBounds, |
| 171 NinePatch*) const; |
165 | 172 |
166 private: | 173 private: |
167 friend class SkDraw; | 174 friend class SkDraw; |
168 | 175 |
169 /** Helper method that, given a path in device space, will rasterize it into
a kA8_Format mask | 176 /** Helper method that, given a path in device space, will rasterize it into
a kA8_Format mask |
170 and then call filterMask(). If this returns true, the specified blitter wil
l be called | 177 and then call filterMask(). If this returns true, the specified blitter wil
l be called |
171 to render that mask. Returns false if filterMask() returned false. | 178 to render that mask. Returns false if filterMask() returned false. |
172 This method is not exported to java. | 179 This method is not exported to java. |
173 */ | 180 */ |
174 bool filterPath(const SkPath& devPath, const SkMatrix& devMatrix, | 181 bool filterPath(const SkPath& devPath, const SkMatrix& devMatrix, |
175 const SkRasterClip&, SkBounder*, SkBlitter* blitter, | 182 const SkRasterClip&, SkBounder*, SkBlitter* blitter, |
176 SkPaint::Style style) const; | 183 SkPaint::Style style) const; |
177 | 184 |
| 185 /** Helper method that, given a roundRect in device space, will rasterize it
into a kA8_Format |
| 186 mask and then call filterMask(). If this returns true, the specified blitte
r will be called |
| 187 to render that mask. Returns false if filterMask() returned false. |
| 188 */ |
| 189 bool filterRRect(const SkRRect& devRRect, const SkMatrix& devMatrix, |
| 190 const SkRasterClip&, SkBounder*, SkBlitter* blitter, |
| 191 SkPaint::Style style) const; |
| 192 |
178 typedef SkFlattenable INHERITED; | 193 typedef SkFlattenable INHERITED; |
179 }; | 194 }; |
180 | 195 |
181 #endif | 196 #endif |
OLD | NEW |