2016-09-13 00:06:47 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2016 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkSVGLinearGradient_DEFINED
|
|
|
|
#define SkSVGLinearGradient_DEFINED
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "experimental/svg/model/SkSVGGradient.h"
|
|
|
|
#include "experimental/svg/model/SkSVGTypes.h"
|
2016-09-13 00:06:47 +00:00
|
|
|
|
2017-10-09 19:14:13 +00:00
|
|
|
class SkSVGLinearGradient final : public SkSVGGradient {
|
2016-09-13 00:06:47 +00:00
|
|
|
public:
|
2017-03-22 16:05:03 +00:00
|
|
|
~SkSVGLinearGradient() override = default;
|
2016-09-13 00:06:47 +00:00
|
|
|
static sk_sp<SkSVGLinearGradient> Make() {
|
|
|
|
return sk_sp<SkSVGLinearGradient>(new SkSVGLinearGradient());
|
|
|
|
}
|
|
|
|
|
|
|
|
void setX1(const SkSVGLength&);
|
|
|
|
void setY1(const SkSVGLength&);
|
|
|
|
void setX2(const SkSVGLength&);
|
|
|
|
void setY2(const SkSVGLength&);
|
|
|
|
|
|
|
|
protected:
|
2020-04-10 14:14:04 +00:00
|
|
|
void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
|
2016-09-13 00:06:47 +00:00
|
|
|
|
2017-10-09 19:14:13 +00:00
|
|
|
sk_sp<SkShader> onMakeShader(const SkSVGRenderContext&,
|
|
|
|
const SkColor*, const SkScalar*, int count,
|
2019-04-03 14:27:45 +00:00
|
|
|
SkTileMode, const SkMatrix&) const override;
|
2016-09-13 00:06:47 +00:00
|
|
|
private:
|
|
|
|
SkSVGLinearGradient();
|
|
|
|
|
|
|
|
SkSVGLength fX1 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage);
|
|
|
|
SkSVGLength fY1 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage);
|
|
|
|
SkSVGLength fX2 = SkSVGLength(100, SkSVGLength::Unit::kPercentage);
|
|
|
|
SkSVGLength fY2 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage);
|
|
|
|
|
2020-09-03 02:42:33 +00:00
|
|
|
using INHERITED = SkSVGGradient;
|
2016-09-13 00:06:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SkSVGLinearGradient_DEFINED
|