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