1cb93a386Sopenharmony_ci// Copyright 2019 Google LLC.
2cb93a386Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3cb93a386Sopenharmony_ci#include "tools/fiddle/examples.h"
4cb93a386Sopenharmony_ci// HASH=635d54b4716e226e93dfbc21ad40e77d
5cb93a386Sopenharmony_ciREG_FIDDLE(Canvas_drawPoints, 256, 200, false, 0) {
6cb93a386Sopenharmony_civoid draw(SkCanvas* canvas) {
7cb93a386Sopenharmony_ci    SkPaint paint;
8cb93a386Sopenharmony_ci    paint.setAntiAlias(true);
9cb93a386Sopenharmony_ci    paint.setStyle(SkPaint::kStroke_Style);
10cb93a386Sopenharmony_ci    paint.setStrokeWidth(10);
11cb93a386Sopenharmony_ci    paint.setColor(0x80349a45);
12cb93a386Sopenharmony_ci    const SkPoint points[] = {{32, 16}, {48, 48}, {16, 32}};
13cb93a386Sopenharmony_ci    const SkPaint::Join join[] = { SkPaint::kRound_Join,
14cb93a386Sopenharmony_ci                                   SkPaint::kMiter_Join,
15cb93a386Sopenharmony_ci                                   SkPaint::kBevel_Join };
16cb93a386Sopenharmony_ci    int joinIndex = 0;
17cb93a386Sopenharmony_ci    SkPath path;
18cb93a386Sopenharmony_ci    path.addPoly(points, 3, false);
19cb93a386Sopenharmony_ci    for (const auto cap : { SkPaint::kRound_Cap, SkPaint::kSquare_Cap, SkPaint::kButt_Cap } ) {
20cb93a386Sopenharmony_ci        paint.setStrokeCap(cap);
21cb93a386Sopenharmony_ci        paint.setStrokeJoin(join[joinIndex++]);
22cb93a386Sopenharmony_ci        for (const auto mode : { SkCanvas::kPoints_PointMode,
23cb93a386Sopenharmony_ci                                 SkCanvas::kLines_PointMode,
24cb93a386Sopenharmony_ci                                 SkCanvas::kPolygon_PointMode } ) {
25cb93a386Sopenharmony_ci            canvas->drawPoints(mode, 3, points, paint);
26cb93a386Sopenharmony_ci            canvas->translate(64, 0);
27cb93a386Sopenharmony_ci        }
28cb93a386Sopenharmony_ci        canvas->drawPath(path, paint);
29cb93a386Sopenharmony_ci        canvas->translate(-192, 64);
30cb93a386Sopenharmony_ci    }
31cb93a386Sopenharmony_ci}
32cb93a386Sopenharmony_ci}  // END FIDDLE
33