blob: 16ee54d280bb1dd1ab8cf1dba336f73f033bfce5 [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 SkSVGCircle_DEFINED
9#define SkSVGCircle_DEFINED
10
11#include "SkSVGShape.h"
12#include "SkSVGTypes.h"
13
Florin Malitace8840e2016-12-08 09:26:47 -050014struct SkPoint;
15
fmalitadc4c2a92016-08-16 15:38:51 -070016class SkSVGCircle final : public SkSVGShape {
17public:
18 virtual ~SkSVGCircle() = default;
19 static sk_sp<SkSVGCircle> Make() { return sk_sp<SkSVGCircle>(new SkSVGCircle()); }
20
21 void setCx(const SkSVGLength&);
22 void setCy(const SkSVGLength&);
23 void setR(const SkSVGLength&);
24
25protected:
26 void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override;
27
Florin Malitae932d4b2016-12-01 13:35:11 -050028 void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
29 SkPath::FillType) const override;
fmalitadc4c2a92016-08-16 15:38:51 -070030
Florin Malitace8840e2016-12-08 09:26:47 -050031 SkPath onAsPath(const SkSVGRenderContext&) const override;
32
fmalitadc4c2a92016-08-16 15:38:51 -070033private:
34 SkSVGCircle();
35
Florin Malitace8840e2016-12-08 09:26:47 -050036 // resolve and return the center and radius values
37 std::tuple<SkPoint, SkScalar> resolve(const SkSVGLengthContext&) const;
38
fmalitadc4c2a92016-08-16 15:38:51 -070039 SkSVGLength fCx = SkSVGLength(0);
40 SkSVGLength fCy = SkSVGLength(0);
41 SkSVGLength fR = SkSVGLength(0);
42
43 typedef SkSVGShape INHERITED;
44};
45
46#endif // SkSVGCircle_DEFINED