Debian Codegraph @

docs/examples/SkParsePath_FromSVGString.cpp

raw
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) {
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 = SkParsePath::FromSVGString(pathString).value_or(SkPath());
16 SkPaint paint;
17 paint.setAntiAlias(true);
18 paint.setStyle(SkPaint::kStroke_Style);
19 paint.setStrokeCap(SkPaint::kRound_Cap);
20 paint.setStrokeWidth(2);
21 canvas->drawPath(path, paint);
22 }
23 } // END FIDDLE