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