Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Path_addRect_3.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.
4// HASH=3837827310e8b88b8c2e128ef9fbbd65
5REG_FIDDLE(Path_addRect_3, 256, 128, false, 0) {
6void draw(SkCanvas* canvas) {
8 paint.setStrokeWidth(15);
9 paint.setStrokeCap(SkPaint::kSquare_Cap);
10 float intervals[] = { 5, 21.75f };
12 paint.setPathEffect(SkDashPathEffect::Make(intervals, std::size(intervals), 0));
13 for (auto direction : { SkPathDirection::kCW, SkPathDirection::kCCW } ) {
14 SkPath path;
15 path.addRect(20, 20, 100, 100, direction);
16 canvas->drawPath(path, paint);
17 canvas->translate(128, 0);
18 }
19}
20} // END FIDDLE
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition aaclip.cpp:27
void translate(SkScalar dx, SkScalar dy)
void drawPath(const SkPath &path, 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
const Paint & paint
#define REG_FIDDLE(NAME, W, H, TEXT, I)
Definition examples.h:60