SkMaskBlurFilter.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. #ifndef SkMaskBlurFilter_DEFINED
  8. #define SkMaskBlurFilter_DEFINED
  9. #include <algorithm>
  10. #include <memory>
  11. #include <tuple>
  12. #include "include/core/SkTypes.h"
  13. #include "src/core/SkMask.h"
  14. // Implement a single channel Gaussian blur. The specifics for implementation are taken from:
  15. // https://drafts.fxtf.org/filters/#feGaussianBlurElement
  16. class SkMaskBlurFilter {
  17. public:
  18. // Create an object suitable for filtering an SkMask using a filter with width sigmaW and
  19. // height sigmaH.
  20. SkMaskBlurFilter(double sigmaW, double sigmaH);
  21. // returns true iff the sigmas will result in an identity mask (no blurring)
  22. bool hasNoBlur() const;
  23. // Given a src SkMask, generate dst SkMask returning the border width and height.
  24. SkIPoint blur(const SkMask& src, SkMask* dst) const;
  25. private:
  26. const double fSigmaW;
  27. const double fSigmaH;
  28. };
  29. #endif // SkBlurMaskFilter_DEFINED