Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
zero_off_dashing.cpp
Go to the documentation of this file.
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.
4REG_FIDDLE(zero_off_dashing, 256, 256, false, 0) {
5static constexpr float kPi = 3.14159265358979323846f;
6void draw(SkCanvas* canvas) {
7 SkPaint p;
8 canvas->drawCircle(128, 128, 60, p);
9
10 p.setColor(0x88FF0000);
11 p.setAntiAlias(true);
12 p.setStyle(SkPaint::kStroke_Style);
13 p.setStrokeCap(SkPaint::kSquare_Cap);
14 p.setStrokeWidth(80);
15 SkScalar interv[2] = {120 * kPi / 6 - 0.05f, 0.0000f};
16 p.setPathEffect(SkDashPathEffect::Make(interv, 2, 0.5));
17
18 SkPath path, path2;
19 path.addCircle(128, 128, 60);
20 canvas->drawPath(path, p);
21
22 p.setColor(0x8800FF00);
23 SkScalar interv2[2] = {120 * kPi / 6 - 0.05f, 10000.0000f};
24 p.setPathEffect(SkDashPathEffect::Make(interv2, 2, 0));
25 canvas->drawPath(path, p);
26
28 p.setColor(0xFF000000);
29 p.setStrokeWidth(0);
30 p.setPathEffect(nullptr);
31 canvas->drawPath(path2, p);
32}
33} // END FIDDLE
static SkPath path2()
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void drawPath(const SkPath &path, const SkPaint &paint)
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
@ kSquare_Cap
adds square
Definition SkPaint.h:336
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60
float SkScalar
Definition extension.cpp:12
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)