Skia
2D Graphics Library
SkSVGFe.h
Go to the documentation of this file.
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 SkSVGFe_DEFINED
9 #define SkSVGFe_DEFINED
10 
11 #include <vector>
12 
14 
15 class SkImageFilter;
16 class SkSVGFilterContext;
17 
18 class SK_API SkSVGFe : public SkSVGHiddenContainer {
19 public:
20  static bool IsFilterEffect(const sk_sp<SkSVGNode>& node) {
21  switch (node->tag()) {
22  case SkSVGTag::kFeBlend:
27  case SkSVGTag::kFeFlood:
29  case SkSVGTag::kFeImage:
34  return true;
35  default:
36  return false;
37  }
38  }
39 
41  const SkSVGFilterContext& fctx) const;
42 
43  // https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveSubRegion
45 
52  const SkSVGFilterContext&) const;
53 
56 
63 
64 protected:
65  explicit SkSVGFe(SkSVGTag t) : INHERITED(t) {}
66 
68  const SkSVGFilterContext&) const = 0;
69 
70  virtual std::vector<SkSVGFeInputType> getInputs() const = 0;
71 
72  bool parseAndSetAttribute(const char*, const char*) override;
73 
74 private:
80  SkRect resolveBoundaries(const SkSVGRenderContext&, const SkSVGFilterContext&) const;
81 
83 };
84 
85 #endif // SkSVGFe_DEFINED
#define SVG_OPTIONAL_ATTR(attr_name, attr_type)
Definition: SkSVGNode.h:213
SkSVGTag
Definition: SkSVGNode.h:23
@ kFeColorMatrix
@ kFeSpecularLighting
@ kFeDisplacementMap
@ kFeGaussianBlur
@ kFeDiffuseLighting
#define SVG_ATTR(attr_name, attr_type, attr_default)
Definition: SkSVGNode.h:203
SkSVGColorspace
Definition: SkSVGTypes.h:719
Base class for image filters.
Definition: SkImageFilter.h:35
Definition: SkSVGTypes.h:635
Definition: SkSVGFe.h:18
SkRect resolveFilterSubregion(const SkSVGRenderContext &, const SkSVGFilterContext &) const
virtual sk_sp< SkImageFilter > onMakeImageFilter(const SkSVGRenderContext &, const SkSVGFilterContext &) const =0
bool parseAndSetAttribute(const char *, const char *) override
virtual SkSVGColorspace resolveColorspace(const SkSVGRenderContext &, const SkSVGFilterContext &) const
Resolves the colorspace within which this filter effect should be applied.
virtual std::vector< SkSVGFeInputType > getInputs() const =0
void applyProperties(SkSVGRenderContext *) const
Propagates any inherited presentation attributes in the given context.
sk_sp< SkImageFilter > makeImageFilter(const SkSVGRenderContext &ctx, const SkSVGFilterContext &fctx) const
static bool IsFilterEffect(const sk_sp< SkSVGNode > &node)
Definition: SkSVGFe.h:20
Definition: SkSVGFilterContext.h:21
Definition: SkSVGHiddenContainer.h:13
SkSVGHiddenContainer(SkSVGTag t)
Definition: SkSVGHiddenContainer.h:15
Definition: SkSVGTypes.h:116
SkSVGTag tag() const
Definition: SkSVGNode.h:99
Definition: SkSVGRenderContext.h:61
Definition: SkSVGTransformableNode.h:14
Light weight class for managing strings.
Definition: SkString.h:118
SkRect holds four float coordinates describing the upper and lower bounds of a rectangle.
Definition: SkRect.h:582