Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 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 "modules/svg/include/SkSVGShape.h" |
| 12 | #include "modules/svg/include/SkSVGTypes.h" |
| 13 | |
| 14 | struct SkPoint; |
| 15 | |
| 16 | class SkSVGCircle final : public SkSVGShape { |
| 17 | public: |
Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 18 | static sk_sp<SkSVGCircle> Make() { return sk_sp<SkSVGCircle>(new SkSVGCircle()); } |
| 19 | |
Tyler Denniston | 52d9475 | 2021-02-05 10:23:34 -0500 | [diff] [blame] | 20 | SVG_ATTR(Cx, SkSVGLength, SkSVGLength(0)) |
| 21 | SVG_ATTR(Cy, SkSVGLength, SkSVGLength(0)) |
| 22 | SVG_ATTR(R , SkSVGLength, SkSVGLength(0)) |
Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 23 | |
| 24 | protected: |
Tyler Denniston | 52d9475 | 2021-02-05 10:23:34 -0500 | [diff] [blame] | 25 | bool parseAndSetAttribute(const char*, const char*) override; |
Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 26 | |
| 27 | void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, |
| 28 | SkPathFillType) const override; |
| 29 | |
| 30 | SkPath onAsPath(const SkSVGRenderContext&) const override; |
| 31 | |
Tyler Denniston | 3a92f77 | 2021-01-12 09:28:22 -0500 | [diff] [blame] | 32 | SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; |
| 33 | |
Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 34 | private: |
| 35 | SkSVGCircle(); |
| 36 | |
| 37 | // resolve and return the center and radius values |
| 38 | std::tuple<SkPoint, SkScalar> resolve(const SkSVGLengthContext&) const; |
| 39 | |
Florin Malita | b341810 | 2020-10-15 18:10:29 -0400 | [diff] [blame] | 40 | using INHERITED = SkSVGShape; |
| 41 | }; |
| 42 | |
| 43 | #endif // SkSVGCircle_DEFINED |