Flutter Engine
The Flutter Engine
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) {
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
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)
Definition: SkCanvas.cpp:1747
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
Definition: SkCanvas.cpp:2707
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
Definition: SkPath.h:59
float SkScalar
Definition: extension.cpp:12
constexpr float kPi
Definition: math.h:27
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
SK_API bool FillPathWithPaint(const SkPath &src, const SkPaint &paint, SkPath *dst, const SkRect *cullRect, SkScalar resScale=1)
Definition: SkPathUtils.cpp:23
REG_FIDDLE(zero_off_dashing, 256, 256, false, 0)