| 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_cubicTo, 256, 256, false, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
SkPaint paint; |
| 7 |
paint.setAntiAlias(true); |
| 8 |
paint.setStyle(SkPaint::kStroke_Style); |
| 9 |
SkPathBuilder path; |
| 10 |
path.moveTo(0, -10); |
| 11 |
for (int i = 0; i < 128; i += 16) { |
| 12 |
SkScalar c = i * 0.5f; |
| 13 |
path.cubicTo( 10 + c, -10 - i, 10 + i, -10 - c, 10 + i, 0); |
| 14 |
path.cubicTo( 14 + i, 14 + c, 14 + c, 14 + i, 0, 14 + i); |
| 15 |
path.cubicTo(-18 - c, 18 + i, -18 - i, 18 + c, -18 - i, 0); |
| 16 |
path.cubicTo(-22 - i, -22 - c, -22 - c, -22 - i, 0, -22 - i); |
| 17 |
} |
| 18 |
path.offset(128, 128); |
| 19 |
canvas->drawPath(path.detach(), paint); |
| 20 |
} |
| 21 |
} // END FIDDLE |