/src/skia/modules/svg/include/SkSVGLinearGradient.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2016 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 SkSVGLinearGradient_DEFINED |
9 | | #define SkSVGLinearGradient_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 | | |
19 | | class SkMatrix; |
20 | | class SkSVGRenderContext; |
21 | | class SkShader; |
22 | | enum class SkTileMode; |
23 | | |
24 | | class SK_API SkSVGLinearGradient final : public SkSVGGradient { |
25 | | public: |
26 | 1 | static sk_sp<SkSVGLinearGradient> Make() { |
27 | 1 | return sk_sp<SkSVGLinearGradient>(new SkSVGLinearGradient()); |
28 | 1 | } |
29 | | |
30 | | SVG_ATTR(X1, SkSVGLength, SkSVGLength(0 , SkSVGLength::Unit::kPercentage)) |
31 | | SVG_ATTR(Y1, SkSVGLength, SkSVGLength(0 , SkSVGLength::Unit::kPercentage)) |
32 | | SVG_ATTR(X2, SkSVGLength, SkSVGLength(100, SkSVGLength::Unit::kPercentage)) |
33 | | SVG_ATTR(Y2, SkSVGLength, SkSVGLength(0 , SkSVGLength::Unit::kPercentage)) |
34 | | |
35 | | protected: |
36 | | bool parseAndSetAttribute(const char*, const char*) override; |
37 | | |
38 | | sk_sp<SkShader> onMakeShader(const SkSVGRenderContext&, |
39 | | const SkColor4f*, const SkScalar*, int count, |
40 | | SkTileMode, const SkMatrix&) const override; |
41 | | private: |
42 | | SkSVGLinearGradient(); |
43 | | |
44 | | using INHERITED = SkSVGGradient; |
45 | | }; |
46 | | |
47 | | #endif // SkSVGLinearGradient_DEFINED |