Flutter Engine
The Flutter Engine
skpaint_compose_path_effect.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(skpaint_compose_path_effect, 256, 256, false, 0) {
5SkPath star() {
6 const SkScalar R = 115.2f, C = 128.0f;
8 path.moveTo(C + R, C);
9 for (int i = 1; i < 8; ++i) {
10 SkScalar a = 2.6927937f * i;
11 path.lineTo(C + R * cos(a), C + R * sin(a));
12 }
13 return path;
14}
15void draw(SkCanvas* canvas) {
16 const SkScalar intervals[] = {10.0f, 5.0f, 2.0f, 5.0f};
17 size_t count = sizeof(intervals) / sizeof(intervals[0]);
19 paint.setPathEffect(
21 SkDiscretePathEffect::Make(10.0f, 4.0f)));
23 paint.setStrokeWidth(2.0f);
24 paint.setAntiAlias(true);
25 canvas->clear(SK_ColorWHITE);
26 SkPath path(star());
27 canvas->drawPath(path, paint);
28}
29} // END FIDDLE
int count
Definition: FontMgrTest.cpp:50
constexpr SkColor SK_ColorWHITE
Definition: SkColor.h:122
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void clear(SkColor color)
Definition: SkCanvas.h:1199
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
static sk_sp< SkPathEffect > Make(const SkScalar intervals[], int count, SkScalar phase)
static sk_sp< SkPathEffect > Make(SkScalar segLength, SkScalar dev, uint32_t seedAssist=0)
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
static sk_sp< SkPathEffect > MakeCompose(sk_sp< SkPathEffect > outer, sk_sp< SkPathEffect > inner)
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
float SkScalar
Definition: extension.cpp:12
struct MyStruct a[10]
#define R(r)
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
REG_FIDDLE(skpaint_compose_path_effect, 256, 256, false, 0)