blob: 75f0074d2f770e849f96f694069a6976c678a7ec [file] [log] [blame]
Tyler Denniston32b30892021-01-26 14:36:32 -05001/*
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 "modules/svg/include/SkSVGHiddenContainer.h"
12#include "modules/svg/include/SkSVGTypes.h"
13
14class SkSVGFeLightSource : public SkSVGHiddenContainer {
15public:
16 void appendChild(sk_sp<SkSVGNode>) final {
17 SkDebugf("cannot append child nodes to an SVG light source.\n");
18 }
19
20protected:
21 explicit SkSVGFeLightSource(SkSVGTag tag) : INHERITED(tag) {}
22
23private:
24 using INHERITED = SkSVGHiddenContainer;
25};
26
27class SkSVGFeDistantLight final : public SkSVGFeLightSource {
28public:
29 static sk_sp<SkSVGFeDistantLight> Make() {
30 return sk_sp<SkSVGFeDistantLight>(new SkSVGFeDistantLight());
31 }
32
33 SVG_ATTR(Azimuth , SkSVGNumberType, 0)
34 SVG_ATTR(Elevation, SkSVGNumberType, 0)
35
36private:
37 SkSVGFeDistantLight() : INHERITED(SkSVGTag::kFeDistantLight) {}
38
39 bool parseAndSetAttribute(const char*, const char*) override;
40
41 using INHERITED = SkSVGFeLightSource;
42};
43
44class SkSVGFePointLight final : public SkSVGFeLightSource {
45public:
46 static sk_sp<SkSVGFePointLight> Make() {
47 return sk_sp<SkSVGFePointLight>(new SkSVGFePointLight());
48 }
49
50 SVG_ATTR(X, SkSVGNumberType, 0)
51 SVG_ATTR(Y, SkSVGNumberType, 0)
52 SVG_ATTR(Z, SkSVGNumberType, 0)
53
54private:
55 SkSVGFePointLight() : INHERITED(SkSVGTag::kFePointLight) {}
56
57 bool parseAndSetAttribute(const char*, const char*) override;
58
59 using INHERITED = SkSVGFeLightSource;
60};
61
62class SkSVGFeSpotLight final : public SkSVGFeLightSource {
63public:
64 static sk_sp<SkSVGFeSpotLight> Make() {
65 return sk_sp<SkSVGFeSpotLight>(new SkSVGFeSpotLight());
66 }
67
68 SVG_ATTR(X , SkSVGNumberType, 0)
69 SVG_ATTR(Y , SkSVGNumberType, 0)
70 SVG_ATTR(Z , SkSVGNumberType, 0)
71 SVG_ATTR(PointsAtX , SkSVGNumberType, 0)
72 SVG_ATTR(PointsAtY , SkSVGNumberType, 0)
73 SVG_ATTR(PointsAtZ , SkSVGNumberType, 0)
74 SVG_ATTR(SpecularExponent, SkSVGNumberType, 1)
75
76 SVG_OPTIONAL_ATTR(LimitingConeAngle, SkSVGNumberType)
77
78private:
79 SkSVGFeSpotLight() : INHERITED(SkSVGTag::kFeSpotLight) {}
80
81 bool parseAndSetAttribute(const char*, const char*) override;
82
83 using INHERITED = SkSVGFeLightSource;
84};
85
86#endif // SkSVGFeLightSource_DEFINED