• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 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 SkSVGFilter_DEFINED
9 #define SkSVGFilter_DEFINED
10 
11 #include "modules/svg/include/SkSVGHiddenContainer.h"
12 #include "modules/svg/include/SkSVGTypes.h"
13 
14 class SkSVGFilter final : public SkSVGHiddenContainer {
15 public:
Make()16     static sk_sp<SkSVGFilter> Make() { return sk_sp<SkSVGFilter>(new SkSVGFilter()); }
17 
18     sk_sp<SkImageFilter> buildFilterDAG(const SkSVGRenderContext&) const;
19 
20     SVG_ATTR(X, SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage))
21     SVG_ATTR(Y, SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage))
22     SVG_ATTR(Width, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage))
23     SVG_ATTR(Height, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage))
SVG_ATTR(FilterUnits,SkSVGObjectBoundingBoxUnits,SkSVGObjectBoundingBoxUnits (SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox))24     SVG_ATTR(FilterUnits,
25              SkSVGObjectBoundingBoxUnits,
26              SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox))
27     SVG_ATTR(PrimitiveUnits,
28              SkSVGObjectBoundingBoxUnits,
29              SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse))
30 
31 private:
32     SkSVGFilter() : INHERITED(SkSVGTag::kFilter) {}
33 
34     bool parseAndSetAttribute(const char*, const char*) override;
35 
36     using INHERITED = SkSVGHiddenContainer;
37 };
38 
39 #endif  // SkSVGFilter_DEFINED
40