1 // Copyright 2020 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 #include "tools/fiddle/examples.h"
REG_FIDDLE(SkParsePath_ToSVGString, 256, 256, true, 0)4 REG_FIDDLE(SkParsePath_ToSVGString, 256, 256, true, 0) {
5 SkPath star() {
6 const SkScalar R = 115.2f, C = 128.0f;
7 SkPath path;
8 path.moveTo(sk_float_round(C + R), sk_float_round(C));
9 for (int i = 1; i < 8; ++i) {
10 SkScalar a = 2.6927937f * i;
11 path.lineTo(sk_float_round(C + R * cos(a)), sk_float_round(C + R * sin(a)));
12 }
13 return path;
14 }
15
16 void draw(SkCanvas* canvas) {
17 SkString s;
18 SkParsePath::ToSVGString(star(), &s);
19 SkDebugf("%s\n", s.c_str());
20 }
21 } // END FIDDLE
22