2 * Copyright 2006 The Android Open Source Project
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkBlurMaskFilter_DEFINED
9 #define SkBlurMaskFilter_DEFINED
11 // we include this since our callers will need to at least be able to ref/unref
12 #include "SkMaskFilter.h"
15 class SK_API SkBlurMaskFilter {
18 kNormal_BlurStyle, //!< fuzzy inside and outside
19 kSolid_BlurStyle, //!< solid inside, fuzzy outside
20 kOuter_BlurStyle, //!< nothing inside, fuzzy outside
21 kInner_BlurStyle, //!< fuzzy inside, nothing outside
27 kNone_BlurFlag = 0x00,
28 /** The blur layer's radius is not affected by transforms */
29 kIgnoreTransform_BlurFlag = 0x01,
30 /** Use a smother, higher qulity blur algorithm */
31 kHighQuality_BlurFlag = 0x02,
32 /** mask for all blur flags */
36 SK_ATTR_DEPRECATED("use sigma version")
37 static SkMaskFilter* Create(SkScalar radius, BlurStyle style,
38 uint32_t flags = kNone_BlurFlag);
40 /** Create a blur maskfilter.
41 @param style The BlurStyle to use
42 @param sigma Standard deviation of the Gaussian blur to apply. Must be > 0.
43 @param flags Flags to use - defaults to none
44 @return The new blur maskfilter
46 static SkMaskFilter* Create(BlurStyle style, SkScalar sigma,
47 uint32_t flags = kNone_BlurFlag);
49 /** Create an emboss maskfilter
50 @param blurSigma standard deviation of the Gaussian blur to apply
51 before applying lighting (e.g. 3)
52 @param direction array of 3 scalars [x, y, z] specifying the direction of the light source
53 @param ambient 0...1 amount of ambient light
54 @param specular coefficient for specular highlights (e.g. 8)
55 @return the emboss maskfilter
57 static SkMaskFilter* CreateEmboss(SkScalar blurSigma, const SkScalar direction[3],
58 SkScalar ambient, SkScalar specular);
60 SK_ATTR_DEPRECATED("use sigma version")
61 static SkMaskFilter* CreateEmboss(const SkScalar direction[3],
62 SkScalar ambient, SkScalar specular,
65 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
68 SkBlurMaskFilter(); // can't be instantiated