1 2 /* 3 * Copyright 2006 The Android Open Source Project 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9 10 #ifndef SkBlurMaskFilter_DEFINED 11 #define SkBlurMaskFilter_DEFINED 12 13 // we include this since our callers will need to at least be able to ref/unref 14 #include "SkMaskFilter.h" 15 #include "SkScalar.h" 16 17 class SK_API SkBlurMaskFilter { 18 public: 19 enum BlurStyle { 20 kNormal_BlurStyle, //!< fuzzy inside and outside 21 kSolid_BlurStyle, //!< solid inside, fuzzy outside 22 kOuter_BlurStyle, //!< nothing inside, fuzzy outside 23 kInner_BlurStyle, //!< fuzzy inside, nothing outside 24 25 kBlurStyleCount 26 }; 27 28 enum BlurFlags { 29 kNone_BlurFlag = 0x00, 30 /** The blur layer's radius is not affected by transforms */ 31 kIgnoreTransform_BlurFlag = 0x01, 32 /** Use a smother, higher qulity blur algorithm */ 33 kHighQuality_BlurFlag = 0x02, 34 /** mask for all blur flags */ 35 kAll_BlurFlag = 0x03 36 }; 37 38 /** Create a blur maskfilter. 39 @param radius The radius to extend the blur from the original mask. Must be > 0. 40 @param style The BlurStyle to use 41 @param flags Flags to use - defaults to none 42 @return The new blur maskfilter 43 */ 44 static SkMaskFilter* Create(SkScalar radius, BlurStyle style, 45 uint32_t flags = kNone_BlurFlag); 46 47 /** Create an emboss maskfilter 48 @param direction array of 3 scalars [x, y, z] specifying the direction of the light source 49 @param ambient 0...1 amount of ambient light 50 @param specular coefficient for specular highlights (e.g. 8) 51 @param blurRadius amount to blur before applying lighting (e.g. 3) 52 @return the emboss maskfilter 53 */ 54 static SkMaskFilter* CreateEmboss( const SkScalar direction[3], 55 SkScalar ambient, SkScalar specular, 56 SkScalar blurRadius); 57 58 SK_DECLARE_FLATTENABLE_REGISTRAR() 59 60 private: 61 SkBlurMaskFilter(); // can't be instantiated 62 }; 63 64 #endif 65 66