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
|
|
|
|
|
2017-10-09 19:14:13 +00:00
|
|
|
#include "SkSVGGradient.h"
|
2016-09-13 00:06:47 +00:00
|
|
|
#include "SkSVGTypes.h"
|
|
|
|
|
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:
|
|
|
|
void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
|
|
|
|
|
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);
|
|
|
|
|
2017-10-09 19:14:13 +00:00
|
|
|
typedef SkSVGGradient INHERITED;
|
2016-09-13 00:06:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SkSVGLinearGradient_DEFINED
|