Debian Codegraph @

docs/examples/cubics_are_horrible.cpp

raw
1 // Copyright 2020 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(cubics_are_horrible, 256, 256, false, 0) {
5 void draw(SkCanvas* canvas) {
6 canvas->scale(0.4, 0.4);
7 canvas->translate(175, 175);
8
9 SkPaint p;
10 p.setColor(SK_ColorBLACK);
11 p.setAntiAlias(true);
12 p.setStyle(SkPaint::kStroke_Style);
13 p.setStrokeWidth(400);
14
15 SkPoint p1 = SkPoint::Make(60, -40);
16 SkPoint p2 = SkPoint::Make(120, 150);
17 SkPoint p3 = SkPoint::Make(180, 60);
18
19 SkPath path = SkPathBuilder()
20 .moveTo(20, 60)
21 .cubicTo(p1, p2, p3)
22 //.close();
23 .detach();
24
25 SkPath fillpath = skpathutils::FillPathWithPaint(path, p);
26 SkPaint fillp;
27 fillp.setColor(SK_ColorMAGENTA);
28 fillp.setAntiAlias(true);
29 fillp.setStyle(SkPaint::kStroke_Style);
30 fillp.setStrokeWidth(0);
31
32 canvas->drawPath(path, p);
33 canvas->drawPath(fillpath, fillp);
34 }
35 } // END FIDDLE