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=292b4b2008961b6f612434d3121fc4ce
5 REG_FIDDLE(Canvas_PointMode, 256, 256, false, 0) {
draw(SkCanvas * canvas)6 void draw(SkCanvas* canvas) {
7 SkPaint paint;
8 paint.setStyle(SkPaint::kStroke_Style);
9 paint.setStrokeWidth(10);
10 SkPoint points[] = {{64, 32}, {96, 96}, {32, 96}};
11 canvas->drawPoints(SkCanvas::kPoints_PointMode, 3, points, paint);
12 canvas->translate(128, 0);
13 canvas->drawPoints(SkCanvas::kLines_PointMode, 3, points, paint);
14 canvas->translate(0, 128);
15 canvas->drawPoints(SkCanvas::kPolygon_PointMode, 3, points, paint);
16 SkPath path;
17 path.addPoly(points, 3, false);
18 canvas->translate(-128, 0);
19 canvas->drawPath(path, paint);
20 }
21 } // END FIDDLE
22