Debian Codegraph @

docs/examples/convex_overstroke_quad.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(convex_overstroke_quad, 256, 256, false, 0) {
5 void draw(SkCanvas* canvas) {
6 const float SCALE = 1;
7 const int WIDTH = 100;
8
9 canvas->scale(SCALE, SCALE);
10 canvas->translate(30, 30);
11
12 SkPoint p1 = SkPoint::Make(50, 50);
13 SkPoint p2 = SkPoint::Make(80, 50);
14
15 SkPoint p3 = SkPoint::Make(65, 30);
16
17 SkPath path = SkPathBuilder()
18 .moveTo(p1)
19 .lineTo(p2)
20 .quadTo(p3, p1)
21 //.close();
22 .detach();
23
24 SkPaint p;
25 p.setColor(SK_ColorRED);
26 p.setAntiAlias(true);
27 p.setStyle(SkPaint::kStroke_Style);
28 p.setStrokeWidth(WIDTH);
29
30 SkPath fillpath = skpathutils::FillPathWithPaint(path, p);
31
32 SkPaint fillp;
33 fillp.setColor(SK_ColorBLACK);
34 fillp.setAntiAlias(true);
35 fillp.setStyle(SkPaint::kStroke_Style);
36
37 canvas->drawPath(path, p);
38 canvas->drawPath(fillpath, fillp);
39 }
40 } // END FIDDLE