/**
* Draws onto the surface using {@link ShapeBuilder}.
*/
private void drawWithShapeBuilder(Surface surface) {
surface.strokeShape(new ShapeBuilder()
.drawLineSegment(40, 20, 180, 20)
.drawQuadraticCurveTo(200, 20, 200, 40)
.drawLineTo(200, 180)
.drawQuadraticCurveTo(200, 200, 180, 200)
.drawLineTo(40, 200)
.drawQuadraticCurveTo(20, 200, 20, 180)
.drawLineTo(20, 40)
.drawQuadraticCurveTo(20, 20, 40, 20)
.moveTo(50, 50)
.drawArc(50, 50, 15, (float) Math.toRadians(30), (float) Math.toRadians(-30), false)
.build());
surface.strokeShape(new ShapeBuilder()
.drawEllipse(20, 100, 180, 100)
.build());
ShapeBuilder dotShapeBuilder = new ShapeBuilder();
for (int i = 0; i < 8; i++) {
dotShapeBuilder.drawCircle(80 + i * 12, 50, 1);
}
surface.fillShape(dotShapeBuilder.build());
}