/src/skia/modules/svg/include/SkSVGRadialGradient.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2017 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 SkSVGRadialGradient_DEFINED |
9 | | #define SkSVGRadialGradient_DEFINED |
10 | | |
11 | | #include "include/core/SkColor.h" |
12 | | #include "include/core/SkRefCnt.h" |
13 | | #include "include/core/SkScalar.h" |
14 | | #include "include/private/base/SkAPI.h" |
15 | | #include "modules/svg/include/SkSVGGradient.h" |
16 | | #include "modules/svg/include/SkSVGNode.h" |
17 | | #include "modules/svg/include/SkSVGTypes.h" |
18 | | #include "src/base/SkTLazy.h" |
19 | | |
20 | | class SkMatrix; |
21 | | class SkSVGRenderContext; |
22 | | class SkShader; |
23 | | enum class SkTileMode; |
24 | | |
25 | | class SK_API SkSVGRadialGradient final : public SkSVGGradient { |
26 | | public: |
27 | 73 | static sk_sp<SkSVGRadialGradient> Make() { |
28 | 73 | return sk_sp<SkSVGRadialGradient>(new SkSVGRadialGradient()); |
29 | 73 | } |
30 | | |
31 | | SVG_ATTR(Cx, SkSVGLength, SkSVGLength(50, SkSVGLength::Unit::kPercentage)) |
32 | | SVG_ATTR(Cy, SkSVGLength, SkSVGLength(50, SkSVGLength::Unit::kPercentage)) |
33 | | SVG_ATTR(R, SkSVGLength, SkSVGLength(50, SkSVGLength::Unit::kPercentage)) |
34 | | SVG_OPTIONAL_ATTR(Fx, SkSVGLength) |
35 | | SVG_OPTIONAL_ATTR(Fy, SkSVGLength) |
36 | | |
37 | | protected: |
38 | | bool parseAndSetAttribute(const char*, const char*) override; |
39 | | |
40 | | sk_sp<SkShader> onMakeShader(const SkSVGRenderContext&, |
41 | | const SkColor4f*, const SkScalar*, int count, |
42 | | SkTileMode, const SkMatrix&) const override; |
43 | | private: |
44 | | SkSVGRadialGradient(); |
45 | | |
46 | | using INHERITED = SkSVGGradient; |
47 | | }; |
48 | | |
49 | | #endif // SkSVGRadialGradient_DEFINED |