blob: 880dc799996c0928bcb078a12dbe9e8504e99a9c [file] [log] [blame]
Hal Canary83c2f702019-03-07 14:53:03 -05001// 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 "fiddle/examples.h"
4// HASH=cedd6233848198e1fca4d1e14816baaf
5REG_FIDDLE(Paint_060, 256, 192, false, 0) {
6void draw(SkCanvas* canvas) {
7 SkPaint strokePaint;
8 strokePaint.setAntiAlias(true);
9 strokePaint.setStyle(SkPaint::kStroke_Style);
10 strokePaint.setStrokeWidth(.1f);
11 SkPath strokePath;
12 strokePath.moveTo(.08f, .08f);
13 strokePath.quadTo(.09f, .08f, .17f, .17f);
14 SkPath fillPath;
15 SkPaint outlinePaint(strokePaint);
16 outlinePaint.setStrokeWidth(2);
17 SkMatrix scale = SkMatrix::MakeScale(300, 300);
18 for (SkScalar precision : { 0.01f, .1f, 1.f, 10.f, 100.f } ) {
19 strokePaint.getFillPath(strokePath, &fillPath, nullptr, precision);
20 fillPath.transform(scale);
21 canvas->drawPath(fillPath, outlinePaint);
22 canvas->translate(60, 0);
23 if (1.f == precision) canvas->translate(-180, 100);
24 }
25 strokePath.transform(scale);
26 strokePaint.setStrokeWidth(30);
27 canvas->drawPath(strokePath, strokePaint);
28}
29} // END FIDDLE