| 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_getLastPt, 256, 256, true, 0) { |
| 5 |
void draw(SkCanvas* canvas) { |
| 6 |
SkPath path = SkPathBuilder() |
| 7 |
.moveTo(100, 100) |
| 8 |
.quadTo(100, 20, 20, 100) |
| 9 |
.detach(); |
| 10 |
SkMatrix matrix; |
| 11 |
matrix.setRotate(36, 100, 100); |
| 12 |
path = path.makeTransform(matrix); |
| 13 |
SkPoint last = path.getLastPt().value_or(SkPoint{0, 0}); |
| 14 |
SkDebugf("last point: %g, %g\n", last.fX, last.fY); |
| 15 |
} |
| 16 |
} // END FIDDLE |