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 |
(...skipping 19 matching lines...) Expand all Loading... |
30 /** mask for all blur flags */ | 30 /** mask for all blur flags */ |
31 kAll_BlurFlag = 0x03 | 31 kAll_BlurFlag = 0x03 |
32 }; | 32 }; |
33 | 33 |
34 /** Create a blur maskfilter. | 34 /** Create a blur maskfilter. |
35 * @param style The SkBlurStyle to use | 35 * @param style The SkBlurStyle to use |
36 * @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. |
37 * @param flags Flags to use - defaults to none | 37 * @param flags Flags to use - defaults to none |
38 * @return The new blur maskfilter | 38 * @return The new blur maskfilter |
39 */ | 39 */ |
40 static SkMaskFilter* Create(SkBlurStyle style, SkScalar sigma, uint32_t flag
s = kNone_BlurFlag); | 40 static sk_sp<SkMaskFilter> Make(SkBlurStyle style, SkScalar sigma, |
| 41 uint32_t flags = kNone_BlurFlag); |
41 | 42 |
42 /** Create an emboss maskfilter | 43 /** Create an emboss maskfilter |
43 @param blurSigma standard deviation of the Gaussian blur to apply | 44 @param blurSigma standard deviation of the Gaussian blur to apply |
44 before applying lighting (e.g. 3) | 45 before applying lighting (e.g. 3) |
45 @param direction array of 3 scalars [x, y, z] specifying the directio
n of the light source | 46 @param direction array of 3 scalars [x, y, z] specifying the directio
n of the light source |
46 @param ambient 0...1 amount of ambient light | 47 @param ambient 0...1 amount of ambient light |
47 @param specular coefficient for specular highlights (e.g. 8) | 48 @param specular coefficient for specular highlights (e.g. 8) |
48 @return the emboss maskfilter | 49 @return the emboss maskfilter |
49 */ | 50 */ |
| 51 static sk_sp<SkMaskFilter> MakeEmboss(SkScalar blurSigma, const SkScalar dir
ection[3], |
| 52 SkScalar ambient, SkScalar specular); |
| 53 |
| 54 #ifdef SK_SUPPORT_LEGACY_MASKFILTER_PTR |
| 55 static SkMaskFilter* Create(SkBlurStyle style, SkScalar sigma, uint32_t flag
s = kNone_BlurFlag){ |
| 56 return Make(style, sigma, flags).release(); |
| 57 } |
50 static SkMaskFilter* CreateEmboss(SkScalar blurSigma, const SkScalar directi
on[3], | 58 static SkMaskFilter* CreateEmboss(SkScalar blurSigma, const SkScalar directi
on[3], |
51 SkScalar ambient, SkScalar specular); | 59 SkScalar ambient, SkScalar specular) { |
52 | 60 return MakeEmboss(blurSigma, direction, ambient, specular).release(); |
| 61 } |
53 SK_ATTR_DEPRECATED("use sigma version") | 62 SK_ATTR_DEPRECATED("use sigma version") |
54 static SkMaskFilter* CreateEmboss(const SkScalar direction[3], | 63 static SkMaskFilter* CreateEmboss(const SkScalar direction[3], |
55 SkScalar ambient, SkScalar specular, | 64 SkScalar ambient, SkScalar specular, |
56 SkScalar blurRadius); | 65 SkScalar blurRadius); |
| 66 #endif |
57 | 67 |
58 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() | 68 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
59 | 69 |
60 private: | 70 private: |
61 SkBlurMaskFilter(); // can't be instantiated | 71 SkBlurMaskFilter(); // can't be instantiated |
62 }; | 72 }; |
63 | 73 |
64 #endif | 74 #endif |
OLD | NEW |