Skia
2D Graphics Library
SkSVGFeLighting.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 SkSVGFeLighting_DEFINED
9 #define SkSVGFeLighting_DEFINED
10 
13 
15 class SkSVGFePointLight;
16 class SkSVGFeSpotLight;
17 
18 class SK_API SkSVGFeLighting : public SkSVGFe {
19 public:
23  };
24 
25  SVG_ATTR(SurfaceScale, SkSVGNumberType, 1)
27 
28 protected:
29  explicit SkSVGFeLighting(SkSVGTag t) : INHERITED(t) {}
30 
31  std::vector<SkSVGFeInputType> getInputs() const final { return {this->getIn()}; }
32 
33  bool parseAndSetAttribute(const char*, const char*) override;
34 
36  const SkSVGFilterContext&) const final;
37 
39  const SkSVGFilterContext&,
40  const SkSVGFeDistantLight*) const = 0;
41 
43  const SkSVGFilterContext&,
44  const SkSVGFePointLight*) const = 0;
45 
47  const SkSVGFilterContext&,
48  const SkSVGFeSpotLight*) const = 0;
49 
51 
53  const SkSVGFilterContext&,
56  SkSVGNumberType) const;
57 
58 private:
59  using INHERITED = SkSVGFe;
60 };
61 
63 public:
66  }
67 
68  SVG_ATTR(SpecularConstant, SkSVGNumberType, 1)
69  SVG_ATTR(SpecularExponent, SkSVGNumberType, 1)
70 
71 protected:
72  bool parseAndSetAttribute(const char*, const char*) override;
73 
75  const SkSVGFilterContext&,
76  const SkSVGFeDistantLight*) const final;
77 
79  const SkSVGFilterContext&,
80  const SkSVGFePointLight*) const final;
81 
83  const SkSVGFilterContext&,
84  const SkSVGFeSpotLight*) const final;
85 
86 private:
88 
89  using INHERITED = SkSVGFeLighting;
90 };
91 
93 public:
96  }
97 
98  SVG_ATTR(DiffuseConstant, SkSVGNumberType, 1)
99 
100 protected:
101  bool parseAndSetAttribute(const char*, const char*) override;
102 
104  const SkSVGFilterContext&,
105  const SkSVGFeDistantLight*) const final;
106 
108  const SkSVGFilterContext&,
109  const SkSVGFePointLight*) const final;
110 
112  const SkSVGFilterContext&,
113  const SkSVGFeSpotLight*) const final;
114 
115 private:
117 
118  using INHERITED = SkSVGFeLighting;
119 };
120 
121 #endif // SkSVGFeLighting_DEFINED
uint32_t SkColor
32-bit ARGB color value, unpremultiplied.
Definition: SkColor.h:37
#define SVG_OPTIONAL_ATTR(attr_name, attr_type)
Definition: SkSVGNode.h:213
SkSVGTag
Definition: SkSVGNode.h:23
@ kFeSpecularLighting
@ kFeDiffuseLighting
#define SVG_ATTR(attr_name, attr_type, attr_default)
Definition: SkSVGNode.h:203
SkScalar SkSVGNumberType
Definition: SkSVGTypes.h:27
Base class for image filters.
Definition: SkImageFilter.h:35
Definition: SkSVGFeLighting.h:92
sk_sp< SkImageFilter > makeDistantLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFeDistantLight *) const final
static sk_sp< SkSVGFeDiffuseLighting > Make()
Definition: SkSVGFeLighting.h:94
bool parseAndSetAttribute(const char *, const char *) override
sk_sp< SkImageFilter > makeSpotLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFeSpotLight *) const final
sk_sp< SkImageFilter > makePointLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFePointLight *) const final
Definition: SkSVGFeLightSource.h:28
Definition: SkSVGFeLighting.h:18
std::vector< SkSVGFeInputType > getInputs() const final
Definition: SkSVGFeLighting.h:31
SkSVGFeLighting(SkSVGTag t)
Definition: SkSVGFeLighting.h:29
bool parseAndSetAttribute(const char *, const char *) override
virtual sk_sp< SkImageFilter > makeDistantLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFeDistantLight *) const =0
sk_sp< SkImageFilter > onMakeImageFilter(const SkSVGRenderContext &, const SkSVGFilterContext &) const final
virtual sk_sp< SkImageFilter > makePointLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFePointLight *) const =0
SkPoint3 resolveXYZ(const SkSVGRenderContext &, const SkSVGFilterContext &, SkSVGNumberType, SkSVGNumberType, SkSVGNumberType) const
SkColor resolveLightingColor(const SkSVGRenderContext &) const
virtual sk_sp< SkImageFilter > makeSpotLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFeSpotLight *) const =0
Definition: SkSVGFeLightSource.h:47
Definition: SkSVGFeLighting.h:62
bool parseAndSetAttribute(const char *, const char *) override
sk_sp< SkImageFilter > makePointLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFePointLight *) const final
sk_sp< SkImageFilter > makeDistantLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFeDistantLight *) const final
static sk_sp< SkSVGFeSpecularLighting > Make()
Definition: SkSVGFeLighting.h:64
sk_sp< SkImageFilter > makeSpotLight(const SkSVGRenderContext &, const SkSVGFilterContext &, const SkSVGFeSpotLight *) const final
Definition: SkSVGFeLightSource.h:65
Definition: SkSVGFe.h:18
SkSVGFe(SkSVGTag t)
Definition: SkSVGFe.h:65
Definition: SkSVGFilterContext.h:21
Definition: SkSVGRenderContext.h:61
Definition: SkSVGTransformableNode.h:14
Definition: SkPoint3.h:14
Definition: SkSVGFeLighting.h:20
SkSVGNumberType fDx
Definition: SkSVGFeLighting.h:21
SkSVGNumberType fDy
Definition: SkSVGFeLighting.h:22