OLD | NEW |
(Empty) | |
| 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 "SkSVGHiddenContainer.h" |
| 12 #include "SkSVGTypes.h" |
| 13 |
| 14 class SkSVGLinearGradient : public SkSVGHiddenContainer { |
| 15 public: |
| 16 virtual ~SkSVGLinearGradient() = default; |
| 17 static sk_sp<SkSVGLinearGradient> Make() { |
| 18 return sk_sp<SkSVGLinearGradient>(new SkSVGLinearGradient()); |
| 19 } |
| 20 |
| 21 void setHref(const SkSVGStringType&); |
| 22 void setX1(const SkSVGLength&); |
| 23 void setY1(const SkSVGLength&); |
| 24 void setX2(const SkSVGLength&); |
| 25 void setY2(const SkSVGLength&); |
| 26 |
| 27 protected: |
| 28 bool onAsPaint(const SkSVGRenderContext&, SkPaint*) const override; |
| 29 |
| 30 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; |
| 31 |
| 32 private: |
| 33 SkSVGLinearGradient(); |
| 34 |
| 35 void collectColorStops(const SkSVGRenderContext&, |
| 36 SkSTArray<2, SkScalar, true>*, |
| 37 SkSTArray<2, SkColor, true>*) const; |
| 38 |
| 39 SkSVGLength fX1 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage); |
| 40 SkSVGLength fY1 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage); |
| 41 SkSVGLength fX2 = SkSVGLength(100, SkSVGLength::Unit::kPercentage); |
| 42 SkSVGLength fY2 = SkSVGLength(0 , SkSVGLength::Unit::kPercentage); |
| 43 |
| 44 SkSVGStringType fHref; |
| 45 |
| 46 typedef SkSVGHiddenContainer INHERITED; |
| 47 }; |
| 48 |
| 49 #endif // SkSVGLinearGradient_DEFINED |
OLD | NEW |