Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Macros | Functions
strokerect.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPathUtils.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRect.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkTemplates.h"
#include <float.h>

Go to the source code of this file.

Classes

class  StrokeRectGM
 

Macros

#define STROKE_WIDTH   SkIntToScalar(20)
 

Functions

static void draw_path (SkCanvas *canvas, const SkPath &path, const SkRect &rect, SkPaint::Join join, int doFill)
 
 DEF_SIMPLE_GM (strokerect_anisotropic_5408, canvas, 200, 50)
 

Macro Definition Documentation

◆ STROKE_WIDTH

#define STROKE_WIDTH   SkIntToScalar(20)

Definition at line 26 of file strokerect.cpp.

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( strokerect_anisotropic_5408  ,
canvas  ,
200  ,
50   
)

Definition at line 130 of file strokerect.cpp.

130 {
131 SkPaint p;
132 p.setStyle(SkPaint::kStroke_Style);
133 p.setStrokeWidth(6);
134
135 canvas->scale(10, 1);
136 SkRect r = SkRect::MakeXYWH(5, 20, 10, 10);
137 canvas->drawRect(r, p);
138}
@ kStroke_Style
set to stroke geometry
Definition SkPaint.h:194
static constexpr SkRect MakeXYWH(float x, float y, float w, float h)
Definition SkRect.h:659

◆ draw_path()

static void draw_path ( SkCanvas canvas,
const SkPath path,
const SkRect rect,
SkPaint::Join  join,
int  doFill 
)
static

Definition at line 28 of file strokerect.cpp.

29 {
31 paint.setAntiAlias(true);
32 paint.setStyle(doFill ? SkPaint::kStrokeAndFill_Style : SkPaint::kStroke_Style);
33
34 paint.setColor(SK_ColorGRAY);
35 paint.setStrokeWidth(STROKE_WIDTH);
36 paint.setStrokeJoin(join);
37 canvas->drawRect(rect, paint);
38
40 paint.setStrokeWidth(0);
41 paint.setColor(SK_ColorRED);
42 canvas->drawPath(path, paint);
43
44 paint.setStrokeWidth(3);
45 paint.setStrokeJoin(SkPaint::kMiter_Join);
46 int n = path.countPoints();
48 path.getPoints(points.get(), n);
50}
static const int points[]
constexpr SkColor SK_ColorGRAY
Definition SkColor.h:113
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
void drawPath(const SkPath &path, const SkPaint &paint)
@ kPoints_PointMode
draw each point separately
Definition SkCanvas.h:1241
@ kStrokeAndFill_Style
sets to stroke and fill geometry
Definition SkPaint.h:195
@ kMiter_Join
extends to miter limit
Definition SkPaint.h:359
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
#define STROKE_WIDTH