Skia
2D Graphics Library
SkSVGFeLightSource.h
Go to the documentation of this file.
1 /*
2  * Copyright 2021 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 SkSVGFeLightSource_DEFINED
9 #define SkSVGFeLightSource_DEFINED
10 
11 #include "include/core/SkPoint3.h"
14 
16 public:
18  SkDebugf("cannot append child nodes to an SVG light source.\n");
19  }
20 
21 protected:
22  explicit SkSVGFeLightSource(SkSVGTag tag) : INHERITED(tag) {}
23 
24 private:
25  using INHERITED = SkSVGHiddenContainer;
26 };
27 
29 public:
32  }
33 
35 
36  SVG_ATTR(Azimuth , SkSVGNumberType, 0)
37  SVG_ATTR(Elevation, SkSVGNumberType, 0)
38 
39 private:
41 
42  bool parseAndSetAttribute(const char*, const char*) override;
43 
44  using INHERITED = SkSVGFeLightSource;
45 };
46 
47 class SkSVGFePointLight final : public SkSVGFeLightSource {
48 public:
51  }
52 
56 
57 private:
58  SkSVGFePointLight() : INHERITED(SkSVGTag::kFePointLight) {}
59 
60  bool parseAndSetAttribute(const char*, const char*) override;
61 
62  using INHERITED = SkSVGFeLightSource;
63 };
64 
65 class SkSVGFeSpotLight final : public SkSVGFeLightSource {
66 public:
69  }
70 
74  SVG_ATTR(PointsAtX , SkSVGNumberType, 0)
75  SVG_ATTR(PointsAtY , SkSVGNumberType, 0)
76  SVG_ATTR(PointsAtZ , SkSVGNumberType, 0)
77  SVG_ATTR(SpecularExponent, SkSVGNumberType, 1)
78 
79  SVG_OPTIONAL_ATTR(LimitingConeAngle, SkSVGNumberType)
80 
81 private:
82  SkSVGFeSpotLight() : INHERITED(SkSVGTag::kFeSpotLight) {}
83 
84  bool parseAndSetAttribute(const char*, const char*) override;
85 
86  using INHERITED = SkSVGFeLightSource;
87 };
88 
89 #endif // SkSVGFeLightSource_DEFINED
#define SVG_OPTIONAL_ATTR(attr_name, attr_type)
Definition: SkSVGNode.h:213
SkSVGTag
Definition: SkSVGNode.h:23
@ kFeDistantLight
#define SVG_ATTR(attr_name, attr_type, attr_default)
Definition: SkSVGNode.h:203
SkScalar SkSVGNumberType
Definition: SkSVGTypes.h:27
Definition: SkSVGFeLightSource.h:28
SkPoint3 computeDirection() const
static sk_sp< SkSVGFeDistantLight > Make()
Definition: SkSVGFeLightSource.h:30
Definition: SkSVGFeLightSource.h:15
SkSVGFeLightSource(SkSVGTag tag)
Definition: SkSVGFeLightSource.h:22
void appendChild(sk_sp< SkSVGNode >) final
Definition: SkSVGFeLightSource.h:17
Definition: SkSVGFeLightSource.h:47
static sk_sp< SkSVGFePointLight > Make()
Definition: SkSVGFeLightSource.h:49
Definition: SkSVGFeLightSource.h:65
static sk_sp< SkSVGFeSpotLight > Make()
Definition: SkSVGFeLightSource.h:67
Definition: SkSVGHiddenContainer.h:13
SkSVGHiddenContainer(SkSVGTag t)
Definition: SkSVGHiddenContainer.h:15
Definition: SkSVGTransformableNode.h:14
Definition: SkPoint3.h:14