Flutter Engine
The Flutter Engine
Canvas_drawPath.cpp
Go to the documentation of this file.
1// Copyright 2019 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(Canvas_drawPath, 256, 256, false, 0) {
5void draw(SkCanvas* canvas) {
7 path.moveTo(20, 20);
8 path.quadTo(60, 20, 60, 60);
9 path.close();
10 path.moveTo(60, 20);
11 path.quadTo(60, 60, 20, 60);
13 paint.setStrokeWidth(10);
14 paint.setAntiAlias(true);
17 paint.setStrokeJoin(join);
19 paint.setStrokeCap(cap);
20 canvas->drawPath(path, paint);
21 canvas->translate(80, 0);
22 }
23 canvas->translate(-240, 60);
24 }
26 for (auto fill : { SkPathFillType::kWinding,
29 path.setFillType(fill);
30 canvas->save();
31 canvas->clipRect({0, 10, 80, 70});
32 canvas->drawPath(path, paint);
33 canvas->restore();
34 canvas->translate(80, 0);
35 }
36}
37} // END FIDDLE
REG_FIDDLE(Canvas_drawPath, 256, 256, false, 0)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void clipRect(const SkRect &rect, SkClipOp op, bool doAntiAlias)
Definition: SkCanvas.cpp:1361
void restore()
Definition: SkCanvas.cpp:461
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
int save()
Definition: SkCanvas.cpp:447
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ kRound_Cap
adds circle
Definition: SkPaint.h:335
@ kButt_Cap
no stroke extension
Definition: SkPaint.h:334
@ kSquare_Cap
adds square
Definition: SkPaint.h:336
@ kStroke_Style
set to stroke geometry
Definition: SkPaint.h:194
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
@ kRound_Join
adds circle
Definition: SkPaint.h:360
@ kMiter_Join
extends to miter limit
Definition: SkPaint.h:359
@ kBevel_Join
connects outside edges
Definition: SkPaint.h:361
Definition: SkPath.h:59
const Paint & paint
Definition: color_source.cc:38
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
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741