Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 5 of file Canvas_drawPoints.cpp.

5 {
6void draw(SkCanvas* canvas) {
8 paint.setAntiAlias(true);
10 paint.setStrokeWidth(10);
11 paint.setColor(0x80349a45);
12 const SkPoint points[] = {{32, 16}, {48, 48}, {16, 32}};
16 int joinIndex = 0;
18 path.addPoly(points, 3, false);
19 for (const auto cap : { SkPaint::kRound_Cap, SkPaint::kSquare_Cap, SkPaint::kButt_Cap } ) {
20 paint.setStrokeCap(cap);
21 paint.setStrokeJoin(join[joinIndex++]);
22 for (const auto mode : { SkCanvas::kPoints_PointMode,
25 canvas->drawPoints(mode, 3, points, paint);
26 canvas->translate(64, 0);
27 }
28 canvas->drawPath(path, paint);
29 canvas->translate(-192, 64);
30 }
31}
32} // 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)
void translate(SkScalar dx, SkScalar dy)
void drawPath(const SkPath &path, const SkPaint &paint)
@ 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
const Paint & paint
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
SINT Vec< 2 *N, T > join(const Vec< N, T > &lo, const Vec< N, T > &hi)
Definition SkVx.h:242