Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
Path_addRect_2.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Path_addRect_2, 256, 128, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Path_addRect_2  ,
256  ,
128  ,
false  ,
 
)

Definition at line 5 of file Path_addRect_2.cpp.

5 {
6void draw(SkCanvas* canvas) {
7 const SkPoint arrow[] = { {5, -5}, {15, -5}, {20, 0}, {15, 5}, {5, 5}, {10, 0} };
8 const SkRect rect = {10, 10, 54, 54};
9 SkPaint rectPaint;
10 rectPaint.setAntiAlias(true);
12 SkPaint arrowPaint(rectPaint);
13 SkPath arrowPath;
14 arrowPath.addPoly(arrow, std::size(arrow), true);
15 arrowPaint.setPathEffect(SkPath1DPathEffect::Make(arrowPath, 176, 0,
17 for (auto direction : { SkPathDirection::kCW, SkPathDirection::kCCW } ) {
18 for (unsigned start : { 0, 1, 2, 3 } ) {
20 path.addRect(rect, direction, start);
21 canvas->drawPath(path, rectPaint);
22 canvas->drawPath(path, arrowPaint);
23 canvas->translate(64, 0);
24 }
25 canvas->translate(-256, 64);
26 }
27}
28} // 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)
void setStyle(Style style)
Definition SkPaint.cpp:105
void setAntiAlias(bool aa)
Definition SkPaint.h:170
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
static sk_sp< SkPathEffect > Make(const SkPath &path, SkScalar advance, SkScalar phase, Style)
SkPath & addPoly(const SkPoint pts[], int count, bool close)
Definition SkPath.cpp:880
sk_sp< SkBlender > blender SkRect rect
Definition SkRecords.h:350
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