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 SkBlurMask_DEFINED | 10 #ifndef SkBlurMask_DEFINED |
11 #define SkBlurMask_DEFINED | 11 #define SkBlurMask_DEFINED |
12 | 12 |
13 #include "SkShader.h" | 13 #include "SkShader.h" |
| 14 #include "SkMask.h" |
14 | 15 |
15 class SkBlurMask { | 16 class SkBlurMask { |
16 public: | 17 public: |
17 enum Style { | 18 enum Style { |
18 kNormal_Style, //!< fuzzy inside and outside | 19 kNormal_Style, //!< fuzzy inside and outside |
19 kSolid_Style, //!< solid inside, fuzzy outside | 20 kSolid_Style, //!< solid inside, fuzzy outside |
20 kOuter_Style, //!< nothing inside, fuzzy outside | 21 kOuter_Style, //!< nothing inside, fuzzy outside |
21 kInner_Style, //!< fuzzy inside, nothing outside | 22 kInner_Style, //!< fuzzy inside, nothing outside |
22 | 23 |
23 kStyleCount | 24 kStyleCount |
24 }; | 25 }; |
25 | 26 |
26 enum Quality { | 27 enum Quality { |
27 kLow_Quality, //!< box blur | 28 kLow_Quality, //!< box blur |
28 kHigh_Quality //!< three pass box blur (similar to gaussian) | 29 kHigh_Quality //!< three pass box blur (similar to gaussian) |
29 }; | 30 }; |
30 | 31 |
31 static bool BlurRect(SkMask *dst, const SkRect &src, | 32 static bool BlurRect(SkMask *dst, const SkRect &src, |
32 SkScalar radius, Style style, | 33 SkScalar radius, Style style, |
33 SkIPoint *margin = NULL); | 34 SkIPoint *margin = NULL, |
| 35 SkMask::CreateMode createMode=SkMask::kComputeBoundsAnd
RenderImage_CreateMode); |
34 static bool Blur(SkMask* dst, const SkMask& src, | 36 static bool Blur(SkMask* dst, const SkMask& src, |
35 SkScalar radius, Style style, Quality quality, | 37 SkScalar radius, Style style, Quality quality, |
36 SkIPoint* margin = NULL); | 38 SkIPoint* margin = NULL); |
37 static bool BlurSeparable(SkMask* dst, const SkMask& src, | 39 static bool BlurSeparable(SkMask* dst, const SkMask& src, |
38 SkScalar radius, Style style, Quality quality, | 40 SkScalar radius, Style style, Quality quality, |
39 SkIPoint* margin = NULL); | 41 SkIPoint* margin = NULL); |
40 | 42 |
41 | 43 |
42 // the "ground truth" blur does a gaussian convolution; it's slow | 44 // the "ground truth" blur does a gaussian convolution; it's slow |
43 // but useful for comparison purposes. | 45 // but useful for comparison purposes. |
44 | 46 |
45 static bool BlurGroundTruth(SkMask* dst, const SkMask& src, | 47 static bool BlurGroundTruth(SkMask* dst, const SkMask& src, |
46 SkScalar provided_radius, Style style, | 48 SkScalar provided_radius, Style style, |
47 SkIPoint* margin = NULL); | 49 SkIPoint* margin = NULL); |
48 | 50 |
49 private: | 51 private: |
50 static bool Blur(SkMask* dst, const SkMask& src, | 52 static bool Blur(SkMask* dst, const SkMask& src, |
51 SkScalar radius, Style style, Quality quality, | 53 SkScalar radius, Style style, Quality quality, |
52 SkIPoint* margin, bool separable); | 54 SkIPoint* margin, bool separable); |
53 }; | 55 }; |
54 | 56 |
55 #endif | 57 #endif |
OLD | NEW |