Debian Codegraph @

modules/svg/include/SkSVGCircle.h

raw
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 SkSVGCircle_DEFINED
9 #define SkSVGCircle_DEFINED
10
11 #include "include/core/SkPath.h"
12 #include "include/core/SkPathTypes.h"
13 #include "include/core/SkRect.h"
14 #include "include/core/SkRefCnt.h"
15 #include "include/core/SkScalar.h"
16 #include "include/private/base/SkAPI.h"
17 #include "modules/svg/include/SkSVGNode.h"
18 #include "modules/svg/include/SkSVGShape.h"
19 #include "modules/svg/include/SkSVGTypes.h"
20
21 #include <tuple>
22
23 class SkCanvas;
24 class SkPaint;
25 class SkSVGLengthContext;
26 class SkSVGRenderContext;
27 struct SkPoint;
28
29 class SK_API SkSVGCircle final : public SkSVGShape {
30 public:
31 static sk_sp<SkSVGCircle> Make() { return sk_sp<SkSVGCircle>(new SkSVGCircle()); }
32
33 SVG_ATTR(Cx, SkSVGLength, SkSVGLength(0))
34 SVG_ATTR(Cy, SkSVGLength, SkSVGLength(0))
35 SVG_ATTR(R , SkSVGLength, SkSVGLength(0))
36
37 protected:
38 bool parseAndSetAttribute(const char*, const char*) override;
39
40 void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&,
41 SkPathFillType) const override;
42
43 SkPath onAsPath(const SkSVGRenderContext&) const override;
44
45 SkRect onTransformableObjectBoundingBox(const SkSVGRenderContext&) const override;
46
47 private:
48 SkSVGCircle();
49
50 // resolve and return the center and radius values
51 std::tuple<SkPoint, SkScalar> resolve(const SkSVGLengthContext&) const;
52
53 using INHERITED = SkSVGShape;
54 };
55
56 #endif // SkSVGCircle_DEFINED