| 1 |
/* |
| 2 |
* Copyright 2017 Google Inc. |
| 3 |
* |
| 4 |
* Use of this source code is governed by a BSD-style license that can be |
| 5 |
* found in the LICENSE file. |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef SkMaskBlurFilter_DEFINED |
| 9 |
#define SkMaskBlurFilter_DEFINED |
| 10 |
|
| 11 |
#include <algorithm> |
| 12 |
#include <memory> |
| 13 |
#include <tuple> |
| 14 |
|
| 15 |
#include "include/core/SkTypes.h" |
| 16 |
#include "src/core/SkMask.h" |
| 17 |
|
| 18 |
// Implement a single channel Gaussian blur. The specifics for implementation are taken from: |
| 19 |
// https://drafts.fxtf.org/filters/#feGaussianBlurElement |
| 20 |
class SkMaskBlurFilter { |
| 21 |
public: |
| 22 |
// Create an object suitable for filtering an SkMask using a filter with width sigmaW and |
| 23 |
// height sigmaH. |
| 24 |
SkMaskBlurFilter(double sigmaW, double sigmaH); |
| 25 |
|
| 26 |
// returns true iff the sigmas will result in an identity mask (no blurring) |
| 27 |
bool hasNoBlur() const; |
| 28 |
|
| 29 |
// Given a src SkMask, generate dst SkMask returning the border width and height. |
| 30 |
SkIPoint blur(const SkMask& src, SkMaskBuilder* dst) const; |
| 31 |
|
| 32 |
private: |
| 33 |
const double fSigmaW; |
| 34 |
const double fSigmaH; |
| 35 |
}; |
| 36 |
|
| 37 |
#endif // SkBlurMaskFilter_DEFINED |