| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 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 SkBlurMaskFilter_DEFINED | 8 #ifndef SkBlurMaskFilter_DEFINED |
| 9 #define SkBlurMaskFilter_DEFINED | 9 #define SkBlurMaskFilter_DEFINED |
| 10 | 10 |
| 11 // we include this since our callers will need to at least be able to ref/unref | 11 // we include this since our callers will need to at least be able to ref/unref |
| 12 #include "SkMaskFilter.h" | 12 #include "SkMaskFilter.h" |
| 13 #include "SkScalar.h" | 13 #include "SkScalar.h" |
| 14 #include "SkBlurTypes.h" | 14 #include "SkBlurTypes.h" |
| 15 | 15 |
| 16 class SK_API SkBlurMaskFilter { | 16 class SK_API SkBlurMaskFilter { |
| 17 public: | 17 public: |
| 18 #ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE | |
| 19 enum BlurStyle { | |
| 20 kNormal_BlurStyle = kNormal_SkBlurStyle, //!< fuzzy inside and outside | |
| 21 kSolid_BlurStyle = kSolid_SkBlurStyle, //!< solid inside, fuzzy outsid
e | |
| 22 kOuter_BlurStyle = kOuter_SkBlurStyle, //!< nothing inside, fuzzy outs
ide | |
| 23 kInner_BlurStyle = kInner_SkBlurStyle, //!< fuzzy inside, nothing outs
ide | |
| 24 | |
| 25 kBlurStyleCount | |
| 26 }; | |
| 27 #endif | |
| 28 | |
| 29 /** | 18 /** |
| 30 * If radius > 0, return the corresponding sigma, else return 0. Use this t
o convert from the | 19 * If radius > 0, return the corresponding sigma, else return 0. Use this t
o convert from the |
| 31 * (legacy) idea of specify the blur "radius" to the standard notion of spe
cifying its sigma. | 20 * (legacy) idea of specify the blur "radius" to the standard notion of spe
cifying its sigma. |
| 32 */ | 21 */ |
| 33 static SkScalar ConvertRadiusToSigma(SkScalar radius); | 22 static SkScalar ConvertRadiusToSigma(SkScalar radius); |
| 34 | 23 |
| 35 enum BlurFlags { | 24 enum BlurFlags { |
| 36 kNone_BlurFlag = 0x00, | 25 kNone_BlurFlag = 0x00, |
| 37 /** The blur layer's radius is not affected by transforms */ | 26 /** The blur layer's radius is not affected by transforms */ |
| 38 kIgnoreTransform_BlurFlag = 0x01, | 27 kIgnoreTransform_BlurFlag = 0x01, |
| 39 /** Use a smother, higher qulity blur algorithm */ | 28 /** Use a smother, higher qulity blur algorithm */ |
| 40 kHighQuality_BlurFlag = 0x02, | 29 kHighQuality_BlurFlag = 0x02, |
| 41 /** mask for all blur flags */ | 30 /** mask for all blur flags */ |
| 42 kAll_BlurFlag = 0x03 | 31 kAll_BlurFlag = 0x03 |
| 43 }; | 32 }; |
| 44 | 33 |
| 45 #ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE | |
| 46 SK_ATTR_DEPRECATED("use sigma version") | |
| 47 static SkMaskFilter* Create(SkScalar radius, BlurStyle style, | |
| 48 uint32_t flags = kNone_BlurFlag); | |
| 49 | |
| 50 /** Create a blur maskfilter. | |
| 51 @param style The BlurStyle to use | |
| 52 @param sigma Standard deviation of the Gaussian blur to apply. Must b
e > 0. | |
| 53 @param flags Flags to use - defaults to none | |
| 54 @return The new blur maskfilter | |
| 55 */ | |
| 56 static SkMaskFilter* Create(BlurStyle style, SkScalar sigma, | |
| 57 uint32_t flags = kNone_BlurFlag); | |
| 58 #endif | |
| 59 | |
| 60 /** Create a blur maskfilter. | 34 /** Create a blur maskfilter. |
| 61 * @param style The SkBlurStyle to use | 35 * @param style The SkBlurStyle to use |
| 62 * @param sigma Standard deviation of the Gaussian blur to apply. Must b
e > 0. | 36 * @param sigma Standard deviation of the Gaussian blur to apply. Must b
e > 0. |
| 63 * @param flags Flags to use - defaults to none | 37 * @param flags Flags to use - defaults to none |
| 64 * @return The new blur maskfilter | 38 * @return The new blur maskfilter |
| 65 */ | 39 */ |
| 66 static SkMaskFilter* Create(SkBlurStyle style, SkScalar sigma, uint32_t flag
s = kNone_BlurFlag); | 40 static SkMaskFilter* Create(SkBlurStyle style, SkScalar sigma, uint32_t flag
s = kNone_BlurFlag); |
| 67 | 41 |
| 68 /** Create an emboss maskfilter | 42 /** Create an emboss maskfilter |
| 69 @param blurSigma standard deviation of the Gaussian blur to apply | 43 @param blurSigma standard deviation of the Gaussian blur to apply |
| (...skipping 11 matching lines...) Expand all Loading... |
| 81 SkScalar ambient, SkScalar specular, | 55 SkScalar ambient, SkScalar specular, |
| 82 SkScalar blurRadius); | 56 SkScalar blurRadius); |
| 83 | 57 |
| 84 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 58 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
| 85 | 59 |
| 86 private: | 60 private: |
| 87 SkBlurMaskFilter(); // can't be instantiated | 61 SkBlurMaskFilter(); // can't be instantiated |
| 88 }; | 62 }; |
| 89 | 63 |
| 90 #endif | 64 #endif |
| OLD | NEW |