/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 "modules/svg/include/SkSVGHiddenContainer.h" |
13 | | #include "modules/svg/include/SkSVGTypes.h" |
14 | | |
15 | | class SK_API SkSVGFeLightSource : public SkSVGHiddenContainer { |
16 | | public: |
17 | 0 | void appendChild(sk_sp<SkSVGNode>) final { |
18 | 0 | SkDebugf("cannot append child nodes to an SVG light source.\n"); |
19 | 0 | } |
20 | | |
21 | | protected: |
22 | 0 | explicit SkSVGFeLightSource(SkSVGTag tag) : INHERITED(tag) {} |
23 | | |
24 | | private: |
25 | | using INHERITED = SkSVGHiddenContainer; |
26 | | }; |
27 | | |
28 | | class SkSVGFeDistantLight final : public SkSVGFeLightSource { |
29 | | public: |
30 | 0 | static sk_sp<SkSVGFeDistantLight> Make() { |
31 | 0 | return sk_sp<SkSVGFeDistantLight>(new SkSVGFeDistantLight()); |
32 | 0 | } |
33 | | |
34 | | SkPoint3 computeDirection() const; |
35 | | |
36 | | SVG_ATTR(Azimuth , SkSVGNumberType, 0) |
37 | | SVG_ATTR(Elevation, SkSVGNumberType, 0) |
38 | | |
39 | | private: |
40 | 0 | SkSVGFeDistantLight() : INHERITED(SkSVGTag::kFeDistantLight) {} |
41 | | |
42 | | bool parseAndSetAttribute(const char*, const char*) override; |
43 | | |
44 | | using INHERITED = SkSVGFeLightSource; |
45 | | }; |
46 | | |
47 | | class SkSVGFePointLight final : public SkSVGFeLightSource { |
48 | | public: |
49 | 0 | static sk_sp<SkSVGFePointLight> Make() { |
50 | 0 | return sk_sp<SkSVGFePointLight>(new SkSVGFePointLight()); |
51 | 0 | } |
52 | | |
53 | | SVG_ATTR(X, SkSVGNumberType, 0) |
54 | | SVG_ATTR(Y, SkSVGNumberType, 0) |
55 | | SVG_ATTR(Z, SkSVGNumberType, 0) |
56 | | |
57 | | private: |
58 | 0 | 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: |
67 | 0 | static sk_sp<SkSVGFeSpotLight> Make() { |
68 | 0 | return sk_sp<SkSVGFeSpotLight>(new SkSVGFeSpotLight()); |
69 | 0 | } |
70 | | |
71 | | SVG_ATTR(X , SkSVGNumberType, 0) |
72 | | SVG_ATTR(Y , SkSVGNumberType, 0) |
73 | | SVG_ATTR(Z , SkSVGNumberType, 0) |
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 | 0 | SkSVGFeSpotLight() : INHERITED(SkSVGTag::kFeSpotLight) {} |
83 | | |
84 | | bool parseAndSetAttribute(const char*, const char*) override; |
85 | | |
86 | | using INHERITED = SkSVGFeLightSource; |
87 | | }; |
88 | | |
89 | | #endif // SkSVGFeLightSource_DEFINED |