1 // Copyright 2019 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 // HASH=fe2294131f422b8d6752f6a880f98ad9
5 REG_FIDDLE(Canvas_drawPath, 256, 256, false, 0) {
6 void draw(SkCanvas* canvas) {
9 path.quadTo(60, 20, 60, 60);
12 path.quadTo(60, 60, 20, 60);
14 paint.setStrokeWidth(10);
15 paint.setAntiAlias(true);
16 paint.setStyle(SkPaint::kStroke_Style);
17 for (auto join: { SkPaint::kBevel_Join, SkPaint::kRound_Join, SkPaint::kMiter_Join } ) {
18 paint.setStrokeJoin(join);
19 for (auto cap: { SkPaint::kButt_Cap, SkPaint::kSquare_Cap, SkPaint::kRound_Cap } ) {
20 paint.setStrokeCap(cap);
21 canvas->drawPath(path, paint);
22 canvas->translate(80, 0);
24 canvas->translate(-240, 60);
26 paint.setStyle(SkPaint::kFill_Style);
27 for (auto fill : { SkPathFillType::kWinding,
28 SkPathFillType::kEvenOdd,
29 SkPathFillType::kInverseWinding } ) {
30 path.setFillType(fill);
32 canvas->clipRect({0, 10, 80, 70});
33 canvas->drawPath(path, paint);
35 canvas->translate(80, 0);