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"
4 REG_FIDDLE(SkParsePath_FromSVGString, 256, 256, false, 0) {
draw(SkCanvas * canvas)5 void draw(SkCanvas* canvas) {
6     const char pathString[] =
7             "M 243 128 "
8             "L 24 178 "
9             "L 200 38 "
10             "L 102 240 "
11             "L 102 16 "
12             "L 200 218 "
13             "L 24 78 "
14             "Z";
15     SkPath path;
16     SkParsePath::FromSVGString(pathString, &path);
17     SkPaint paint;
18     paint.setAntiAlias(true);
19     paint.setStyle(SkPaint::kStroke_Style);
20     paint.setStrokeCap(SkPaint::kRound_Cap);
21     paint.setStrokeWidth(2);
22     canvas->drawPath(path, paint);
23 }
24 }  // END FIDDLE
25