blob: 57ef10a6dbe1d1ca26088ff80ea40fad8705a535 [file] [log] [blame]
Florin Malitab3418102020-10-15 18:10:29 -04001/*
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 "modules/svg/include/SkSVGGradient.h"
12#include "modules/svg/include/SkSVGTypes.h"
13
14class SkSVGLinearGradient final : public SkSVGGradient {
15public:
Florin Malitab3418102020-10-15 18:10:29 -040016 static sk_sp<SkSVGLinearGradient> Make() {
17 return sk_sp<SkSVGLinearGradient>(new SkSVGLinearGradient());
18 }
19
Tyler Dennistona0a51462020-11-10 13:13:28 -050020 SVG_ATTR(X1, SkSVGLength, SkSVGLength(0 , SkSVGLength::Unit::kPercentage))
21 SVG_ATTR(Y1, SkSVGLength, SkSVGLength(0 , SkSVGLength::Unit::kPercentage))
22 SVG_ATTR(X2, SkSVGLength, SkSVGLength(100, SkSVGLength::Unit::kPercentage))
23 SVG_ATTR(Y2, SkSVGLength, SkSVGLength(0 , SkSVGLength::Unit::kPercentage))
Florin Malitab3418102020-10-15 18:10:29 -040024
25protected:
Tyler Dennistona0a51462020-11-10 13:13:28 -050026 bool parseAndSetAttribute(const char*, const char*) override;
Florin Malitab3418102020-10-15 18:10:29 -040027
28 sk_sp<SkShader> onMakeShader(const SkSVGRenderContext&,
Florin Malitaea27de52021-01-19 12:51:12 -050029 const SkColor4f*, const SkScalar*, int count,
Florin Malitab3418102020-10-15 18:10:29 -040030 SkTileMode, const SkMatrix&) const override;
31private:
32 SkSVGLinearGradient();
33
Florin Malitab3418102020-10-15 18:10:29 -040034 using INHERITED = SkSVGGradient;
35};
36
37#endif // SkSVGLinearGradient_DEFINED