blob: ec0a753caaeb1052aeb55d8ec9e1336b0411f236 [file] [log] [blame]
fmalitadc4c2a92016-08-16 15:38:51 -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 SkSVGEllipse_DEFINED
9#define SkSVGEllipse_DEFINED
10
Mike Kleinc0bd9f92019-04-23 12:05:21 -050011#include "experimental/svg/model/SkSVGShape.h"
12#include "experimental/svg/model/SkSVGTypes.h"
fmalitadc4c2a92016-08-16 15:38:51 -070013
Florin Malitace8840e2016-12-08 09:26:47 -050014struct SkRect;
15
fmalitadc4c2a92016-08-16 15:38:51 -070016class SkSVGEllipse final : public SkSVGShape {
17public:
Brian Salomond3b65972017-03-22 12:05:03 -040018 ~SkSVGEllipse() override = default;
fmalitadc4c2a92016-08-16 15:38:51 -070019 static sk_sp<SkSVGEllipse> Make() { return sk_sp<SkSVGEllipse>(new SkSVGEllipse()); }
20
21 void setCx(const SkSVGLength&);
22 void setCy(const SkSVGLength&);
23 void setRx(const SkSVGLength&);
24 void setRy(const SkSVGLength&);
25
26protected:
Florin Malitaf4403e72020-04-10 14:14:04 +000027 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
fmalitadc4c2a92016-08-16 15:38:51 -070028
Florin Malitae932d4b2016-12-01 13:35:11 -050029 void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
Mike Reed7d34dc72019-11-26 12:17:17 -050030 SkPathFillType) const override;
fmalitadc4c2a92016-08-16 15:38:51 -070031
Florin Malitace8840e2016-12-08 09:26:47 -050032 SkPath onAsPath(const SkSVGRenderContext&) const override;
33
fmalitadc4c2a92016-08-16 15:38:51 -070034private:
35 SkSVGEllipse();
36
Florin Malitace8840e2016-12-08 09:26:47 -050037 SkRect resolve(const SkSVGLengthContext&) const;
38
fmalitadc4c2a92016-08-16 15:38:51 -070039 SkSVGLength fCx = SkSVGLength(0);
40 SkSVGLength fCy = SkSVGLength(0);
41 SkSVGLength fRx = SkSVGLength(0);
42 SkSVGLength fRy = SkSVGLength(0);
43
44 typedef SkSVGShape INHERITED;
45};
46
47#endif // SkSVGEllipse_DEFINED