1 /* 2 * Copyright 2017 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 SkSVGRadialGradient_DEFINED 9 #define SkSVGRadialGradient_DEFINED 10 11 #include "SkSVGGradient.h" 12 #include "SkSVGTypes.h" 13 14 class SkSVGRadialGradient final : public SkSVGGradient { 15 public: 16 ~SkSVGRadialGradient() override = default; 17 static sk_sp<SkSVGRadialGradient> Make() { 18 return sk_sp<SkSVGRadialGradient>(new SkSVGRadialGradient()); 19 } 20 21 void setCx(const SkSVGLength&); 22 void setCy(const SkSVGLength&); 23 void setR(const SkSVGLength&); 24 void setFx(const SkSVGLength&); 25 void setFy(const SkSVGLength&); 26 27 protected: 28 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; 29 30 sk_sp<SkShader> onMakeShader(const SkSVGRenderContext&, 31 const SkColor*, const SkScalar*, int count, 32 SkShader::TileMode, const SkMatrix&) const override; 33 private: 34 SkSVGRadialGradient(); 35 36 SkSVGLength fCx = SkSVGLength(50, SkSVGLength::Unit::kPercentage); 37 SkSVGLength fCy = SkSVGLength(50, SkSVGLength::Unit::kPercentage); 38 SkSVGLength fR = SkSVGLength(50, SkSVGLength::Unit::kPercentage); 39 SkTLazy<SkSVGLength> fFx; 40 SkTLazy<SkSVGLength> fFy; 41 42 43 typedef SkSVGGradient INHERITED; 44 }; 45 46 #endif // SkSVGRadialGradient_DEFINED 47