blob: 64b630e4fd56dc0540af1f862934d47a2df0e77f [file] [log] [blame]
Hal Canary87515122019-03-15 14:22:51 -04001// 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.
Mike Kleinc0bd9f92019-04-23 12:05:21 -05003#include "tools/fiddle/examples.h"
Hal Canary87515122019-03-15 14:22:51 -04004// HASH=cedd6233848198e1fca4d1e14816baaf
Hal Canarya7181e7c2019-03-18 16:06:34 -04005REG_FIDDLE(Paint_getFillPath, 256, 192, false, 0) {
Hal Canary87515122019-03-15 14:22:51 -04006void 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);
Mike Reed1f607332020-05-21 12:11:27 -040017 SkMatrix scale = SkMatrix::Scale(300, 300);
Hal Canary87515122019-03-15 14:22:51 -040018 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