Debian Codegraph @

modules/svg/include/SkSVGFilter.h

raw
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 "include/core/SkRefCnt.h"
12 #include "include/private/base/SkAPI.h"
13 #include "modules/svg/include/SkSVGHiddenContainer.h"
14 #include "modules/svg/include/SkSVGNode.h"
15 #include "modules/svg/include/SkSVGTypes.h"
16
17 class SkImageFilter;
18 class SkSVGRenderContext;
19
20 class SK_API SkSVGFilter final : public SkSVGHiddenContainer {
21 public:
22 static sk_sp<SkSVGFilter> Make() { return sk_sp<SkSVGFilter>(new SkSVGFilter()); }
23
24 /** Propagates any inherited presentation attributes in the given context. */
25 void applyProperties(SkSVGRenderContext*) const;
26
27 sk_sp<SkImageFilter> buildFilterDAG(const SkSVGRenderContext&) const;
28
29 SVG_ATTR(X, SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage))
30 SVG_ATTR(Y, SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage))
31 SVG_ATTR(Width, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage))
32 SVG_ATTR(Height, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage))
33 SVG_ATTR(FilterUnits,
34 SkSVGObjectBoundingBoxUnits,
35 SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox))
36 SVG_ATTR(PrimitiveUnits,
37 SkSVGObjectBoundingBoxUnits,
38 SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse))
39
40 private:
41 SkSVGFilter() : INHERITED(SkSVGTag::kFilter) {}
42
43 bool parseAndSetAttribute(const char*, const char*) override;
44
45 using INHERITED = SkSVGHiddenContainer;
46 };
47
48 #endif // SkSVGFilter_DEFINED