• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SkBlurMask_DEFINED
11 #define SkBlurMask_DEFINED
12 
13 #include "SkShader.h"
14 #include "SkMask.h"
15 
16 class SkBlurMask {
17 public:
18     enum Style {
19         kNormal_Style,  //!< fuzzy inside and outside
20         kSolid_Style,   //!< solid inside, fuzzy outside
21         kOuter_Style,   //!< nothing inside, fuzzy outside
22         kInner_Style,   //!< fuzzy inside, nothing outside
23 
24         kStyleCount
25     };
26 
27     enum Quality {
28         kLow_Quality,   //!< box blur
29         kHigh_Quality   //!< three pass box blur (similar to gaussian)
30     };
31 
32     static bool BlurRect(SkScalar sigma, SkMask *dst, const SkRect &src,
33                          Style style,
34                          SkIPoint *margin = NULL,
35                          SkMask::CreateMode createMode =
36                                                 SkMask::kComputeBoundsAndRenderImage_CreateMode);
37     static bool BoxBlur(SkMask* dst, const SkMask& src,
38                         SkScalar sigma, Style style, Quality quality,
39                         SkIPoint* margin = NULL);
40 
41     // the "ground truth" blur does a gaussian convolution; it's slow
42     // but useful for comparison purposes.
43     static bool BlurGroundTruth(SkScalar sigma, SkMask* dst, const SkMask& src,
44                                 Style style,
45                                 SkIPoint* margin = NULL);
46 
47     SK_ATTR_DEPRECATED("use sigma version")
48     static bool BlurRect(SkMask *dst, const SkRect &src,
49                          SkScalar radius, Style style,
50                          SkIPoint *margin = NULL,
51                          SkMask::CreateMode createMode =
52                                                 SkMask::kComputeBoundsAndRenderImage_CreateMode);
53 
54     SK_ATTR_DEPRECATED("use sigma version")
55     static bool Blur(SkMask* dst, const SkMask& src,
56                      SkScalar radius, Style style, Quality quality,
57                      SkIPoint* margin = NULL);
58 
59     SK_ATTR_DEPRECATED("use sigma version")
60     static bool BlurGroundTruth(SkMask* dst, const SkMask& src,
61                                 SkScalar radius, Style style,
62                                 SkIPoint* margin = NULL);
63 
64     static SkScalar ConvertRadiusToSigma(SkScalar radius);
65 };
66 
67 #endif
68