Flutter Engine
The Flutter Engine
Functions
Canvas_drawPoints.cpp File Reference
#include "tools/fiddle/examples.h"

Go to the source code of this file.

Functions

 REG_FIDDLE (Canvas_drawPoints, 256, 200, false, 0)
 

Function Documentation

◆ REG_FIDDLE()

REG_FIDDLE ( Canvas_drawPoints  ,
256  ,
200  ,
false  ,
 
)

Definition at line 4 of file Canvas_drawPoints.cpp.

4 {
5void draw(SkCanvas* canvas) {
7 paint.setAntiAlias(true);
9 paint.setStrokeWidth(10);
10 paint.setColor(0x80349a45);
11 const SkPoint points[] = {{32, 16}, {48, 48}, {16, 32}};
15 int joinIndex = 0;
17 path.addPoly(points, 3, false);
18 for (const auto cap : { SkPaint::kRound_Cap, SkPaint::kSquare_Cap, SkPaint::kButt_Cap } ) {
19 paint.setStrokeCap(cap);
20 paint.setStrokeJoin(join[joinIndex++]);
21 for (const auto mode : { SkCanvas::kPoints_PointMode,
24 canvas->drawPoints(mode, 3, points, paint);
25 canvas->translate(64, 0);
26 }
27 canvas->drawPath(path, paint);
28 canvas->translate(-192, 64);
29 }
30}
31} // END FIDDLE
static const int points[]
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
Definition: aaclip.cpp:27
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
Definition: SkCanvas.cpp:1710
void translate(SkScalar dx, SkScalar dy)
Definition: SkCanvas.cpp:1278
void drawPath(const SkPath &path, const SkPaint &paint)
Definition: SkCanvas.cpp:1747
@ kLines_PointMode
draw each pair of points as a line segment
Definition: SkCanvas.h:1242
@ kPolygon_PointMode
draw the array of points as a open polygon
Definition: SkCanvas.h:1243
@ kPoints_PointMode
draw each point separately
Definition: SkCanvas.h:1241
@ 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
@ 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
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741