| 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 |
REG_FIDDLE(Path_moveTo_2, 128, 128, false, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
SkPoint data[][3] = {{{30,40},{60,60},{90,30}}, {{30,120},{60,100},{90,120}}, |
| 7 |
{{60,100},{60,40},{70,30}}, {{60,40},{50,20},{70,30}}}; |
| 8 |
SkPathBuilder path; |
| 9 |
for (unsigned i = 0; i < std::size(data); ++i) { |
| 10 |
path.moveTo(data[i][0]); |
| 11 |
path.lineTo(data[i][1]); |
| 12 |
path.lineTo(data[i][2]); |
| 13 |
} |
| 14 |
SkPaint paint; |
| 15 |
paint.setStyle(SkPaint::kStroke_Style); |
| 16 |
canvas->drawPath(path.detach(), paint); |
| 17 |
} |
| 18 |
} // END FIDDLE |