Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: include/effects/SkBlurMaskFilter.h

Issue 253833002: move common blur types into central header (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkBlurTypes.h ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15
15 class SK_API SkBlurMaskFilter { 16 class SK_API SkBlurMaskFilter {
16 public: 17 public:
18 #ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE
17 enum BlurStyle { 19 enum BlurStyle {
18 kNormal_BlurStyle, //!< fuzzy inside and outside 20 kNormal_BlurStyle = kNormal_SkBlurStyle, //!< fuzzy inside and outside
19 kSolid_BlurStyle, //!< solid inside, fuzzy outside 21 kSolid_BlurStyle = kSolid_SkBlurStyle, //!< solid inside, fuzzy outsid e
20 kOuter_BlurStyle, //!< nothing inside, fuzzy outside 22 kOuter_BlurStyle = kOuter_SkBlurStyle, //!< nothing inside, fuzzy outs ide
21 kInner_BlurStyle, //!< fuzzy inside, nothing outside 23 kInner_BlurStyle = kInner_SkBlurStyle, //!< fuzzy inside, nothing outs ide
22 24
23 kBlurStyleCount 25 kBlurStyleCount
24 }; 26 };
27 #endif
25 28
26 enum BlurFlags { 29 enum BlurFlags {
27 kNone_BlurFlag = 0x00, 30 kNone_BlurFlag = 0x00,
28 /** The blur layer's radius is not affected by transforms */ 31 /** The blur layer's radius is not affected by transforms */
29 kIgnoreTransform_BlurFlag = 0x01, 32 kIgnoreTransform_BlurFlag = 0x01,
30 /** Use a smother, higher qulity blur algorithm */ 33 /** Use a smother, higher qulity blur algorithm */
31 kHighQuality_BlurFlag = 0x02, 34 kHighQuality_BlurFlag = 0x02,
32 /** mask for all blur flags */ 35 /** mask for all blur flags */
33 kAll_BlurFlag = 0x03 36 kAll_BlurFlag = 0x03
34 }; 37 };
35 38
39 #ifdef SK_SUPPORT_LEGACY_BLURMASKFILTER_STYLE
36 SK_ATTR_DEPRECATED("use sigma version") 40 SK_ATTR_DEPRECATED("use sigma version")
37 static SkMaskFilter* Create(SkScalar radius, BlurStyle style, 41 static SkMaskFilter* Create(SkScalar radius, BlurStyle style,
38 uint32_t flags = kNone_BlurFlag); 42 uint32_t flags = kNone_BlurFlag);
39 43
40 /** Create a blur maskfilter. 44 /** Create a blur maskfilter.
41 @param style The BlurStyle to use 45 @param style The BlurStyle to use
42 @param sigma Standard deviation of the Gaussian blur to apply. Must b e > 0. 46 @param sigma Standard deviation of the Gaussian blur to apply. Must b e > 0.
43 @param flags Flags to use - defaults to none 47 @param flags Flags to use - defaults to none
44 @return The new blur maskfilter 48 @return The new blur maskfilter
45 */ 49 */
46 static SkMaskFilter* Create(BlurStyle style, SkScalar sigma, 50 static SkMaskFilter* Create(BlurStyle style, SkScalar sigma,
47 uint32_t flags = kNone_BlurFlag); 51 uint32_t flags = kNone_BlurFlag);
52 #endif
53
54 /** Create a blur maskfilter.
55 * @param style The SkBlurStyle to use
56 * @param sigma Standard deviation of the Gaussian blur to apply. Must b e > 0.
57 * @param flags Flags to use - defaults to none
58 * @return The new blur maskfilter
59 */
60 static SkMaskFilter* Create(SkBlurStyle style, SkScalar sigma, uint32_t flag s = kNone_BlurFlag);
48 61
49 /** Create an emboss maskfilter 62 /** Create an emboss maskfilter
50 @param blurSigma standard deviation of the Gaussian blur to apply 63 @param blurSigma standard deviation of the Gaussian blur to apply
51 before applying lighting (e.g. 3) 64 before applying lighting (e.g. 3)
52 @param direction array of 3 scalars [x, y, z] specifying the directio n of the light source 65 @param direction array of 3 scalars [x, y, z] specifying the directio n of the light source
53 @param ambient 0...1 amount of ambient light 66 @param ambient 0...1 amount of ambient light
54 @param specular coefficient for specular highlights (e.g. 8) 67 @param specular coefficient for specular highlights (e.g. 8)
55 @return the emboss maskfilter 68 @return the emboss maskfilter
56 */ 69 */
57 static SkMaskFilter* CreateEmboss(SkScalar blurSigma, const SkScalar directi on[3], 70 static SkMaskFilter* CreateEmboss(SkScalar blurSigma, const SkScalar directi on[3],
58 SkScalar ambient, SkScalar specular); 71 SkScalar ambient, SkScalar specular);
59 72
60 SK_ATTR_DEPRECATED("use sigma version") 73 SK_ATTR_DEPRECATED("use sigma version")
61 static SkMaskFilter* CreateEmboss(const SkScalar direction[3], 74 static SkMaskFilter* CreateEmboss(const SkScalar direction[3],
62 SkScalar ambient, SkScalar specular, 75 SkScalar ambient, SkScalar specular,
63 SkScalar blurRadius); 76 SkScalar blurRadius);
64 77
65 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() 78 SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP()
66 79
67 private: 80 private:
68 SkBlurMaskFilter(); // can't be instantiated 81 SkBlurMaskFilter(); // can't be instantiated
69 }; 82 };
70 83
71 #endif 84 #endif
OLDNEW
« no previous file with comments | « include/core/SkBlurTypes.h ('k') | samplecode/SampleAll.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698