blob: f6ae5b3469765f16fe32ce8e11f82db37553f5ce [file] [log] [blame]
fmalita28d5b722016-09-12 17:06:47 -07001/*
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
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "experimental/svg/model/SkSVGGradient.h"
12#include "experimental/svg/model/SkSVGTypes.h"
fmalita28d5b722016-09-12 17:06:47 -070013
Florin Malitadf007e12017-10-09 15:14:13 -040014class SkSVGLinearGradient final : public SkSVGGradient {
fmalita28d5b722016-09-12 17:06:47 -070015public:
Brian Salomond3b65972017-03-22 12:05:03 -040016 ~SkSVGLinearGradient() override = default;
fmalita28d5b722016-09-12 17:06:47 -070017 static sk_sp<SkSVGLinearGradient> Make() {
18 return sk_sp<SkSVGLinearGradient>(new SkSVGLinearGradient());
19 }
20
fmalita28d5b722016-09-12 17:06:47 -070021 void setX1(const SkSVGLength&);
22 void setY1(const SkSVGLength&);
23 void setX2(const SkSVGLength&);
24 void setY2(const SkSVGLength&);
25
26protected:
fmalita28d5b722016-09-12 17:06:47 -070027 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
28
Florin Malitadf007e12017-10-09 15:14:13 -040029 sk_sp<SkShader> onMakeShader(const SkSVGRenderContext&,
30 const SkColor*, const SkScalar*, int count,
Mike Reedfae8fce2019-04-03 10:27:45 -040031 SkTileMode, const SkMatrix&) const override;
fmalita28d5b722016-09-12 17:06:47 -070032private:
33 SkSVGLinearGradient();
34
fmalita28d5b722016-09-12 17:06:47 -070035 SkSVGLength fX1 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage);
36 SkSVGLength fY1 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage);
37 SkSVGLength fX2 = SkSVGLength(100, SkSVGLength::Unit::kPercentage);
38 SkSVGLength fY2 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage);
39
Florin Malitadf007e12017-10-09 15:14:13 -040040 typedef SkSVGGradient INHERITED;
fmalita28d5b722016-09-12 17:06:47 -070041};
42
43#endif // SkSVGLinearGradient_DEFINED