epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 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 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 9 | |
| 10 | #ifndef SkBlurMask_DEFINED |
| 11 | #define SkBlurMask_DEFINED |
| 12 | |
| 13 | #include "SkShader.h" |
humper@google.com | 7c5d7b7 | 2013-03-11 20:16:28 +0000 | [diff] [blame] | 14 | #include "SkMask.h" |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 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 | |
senorblanco@chromium.org | 4868e6b | 2011-02-18 19:03:01 +0000 | [diff] [blame] | 27 | enum Quality { |
| 28 | kLow_Quality, //!< box blur |
| 29 | kHigh_Quality //!< three pass box blur (similar to gaussian) |
| 30 | }; |
| 31 | |
skia.committer@gmail.com | 8ae714b | 2013-01-05 02:02:05 +0000 | [diff] [blame] | 32 | static bool BlurRect(SkMask *dst, const SkRect &src, |
humper@google.com | a99a92c | 2013-02-20 16:42:06 +0000 | [diff] [blame] | 33 | SkScalar radius, Style style, |
skia.committer@gmail.com | 2e71f16 | 2013-03-12 07:12:32 +0000 | [diff] [blame^] | 34 | SkIPoint *margin = NULL, |
humper@google.com | 7c5d7b7 | 2013-03-11 20:16:28 +0000 | [diff] [blame] | 35 | SkMask::CreateMode createMode=SkMask::kComputeBoundsAndRenderImage_CreateMode); |
bungeman@google.com | 5af16f8 | 2011-09-02 15:06:44 +0000 | [diff] [blame] | 36 | static bool Blur(SkMask* dst, const SkMask& src, |
| 37 | SkScalar radius, Style style, Quality quality, |
| 38 | SkIPoint* margin = NULL); |
senorblanco@chromium.org | 71f0f34 | 2012-11-13 20:35:21 +0000 | [diff] [blame] | 39 | static bool BlurSeparable(SkMask* dst, const SkMask& src, |
| 40 | SkScalar radius, Style style, Quality quality, |
| 41 | SkIPoint* margin = NULL); |
skia.committer@gmail.com | d454ec1 | 2013-02-21 07:15:03 +0000 | [diff] [blame] | 42 | |
humper@google.com | a99a92c | 2013-02-20 16:42:06 +0000 | [diff] [blame] | 43 | |
| 44 | // the "ground truth" blur does a gaussian convolution; it's slow |
| 45 | // but useful for comparison purposes. |
| 46 | |
skia.committer@gmail.com | d454ec1 | 2013-02-21 07:15:03 +0000 | [diff] [blame] | 47 | static bool BlurGroundTruth(SkMask* dst, const SkMask& src, |
| 48 | SkScalar provided_radius, Style style, |
humper@google.com | a99a92c | 2013-02-20 16:42:06 +0000 | [diff] [blame] | 49 | SkIPoint* margin = NULL); |
| 50 | |
senorblanco@chromium.org | 71f0f34 | 2012-11-13 20:35:21 +0000 | [diff] [blame] | 51 | private: |
| 52 | static bool Blur(SkMask* dst, const SkMask& src, |
| 53 | SkScalar radius, Style style, Quality quality, |
| 54 | SkIPoint* margin, bool separable); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 55 | }; |
| 56 | |
| 57 | #endif |