Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
points.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkBlurTypes.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPoint.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "src/base/SkRandom.h"
#include <stddef.h>
#include "include/core/SkMaskFilter.h"

Go to the source code of this file.

Classes

class  skiagm::PointsGM
 

Namespaces

namespace  skiagm
 

Functions

 DEF_SIMPLE_GM (points_maskfilter, canvas, 512, 256)
 

Function Documentation

◆ DEF_SIMPLE_GM()

DEF_SIMPLE_GM ( points_maskfilter  ,
canvas  ,
512  ,
256   
)

Definition at line 78 of file points.cpp.

78 {
79 constexpr int N = 30;
80 SkPoint pts[N];
81
82 SkRandom rand;
83 for (SkPoint& p : pts) {
84 p.fX = rand.nextF() * 220 + 18;
85 p.fY = rand.nextF() * 220 + 18;
86 }
87
90
92 paint.setAntiAlias(true);
93 paint.setStroke(true);
94 paint.setStrokeWidth(10);
95
96 for (auto cap : caps) {
97 paint.setStrokeCap(cap);
98
99 paint.setMaskFilter(mf);
100 paint.setColor(SK_ColorBLACK);
101 canvas->drawPoints(SkCanvas::kPoints_PointMode, N, pts, paint);
102
103 paint.setMaskFilter(nullptr);
104 paint.setColor(SK_ColorRED);
105 canvas->drawPoints(SkCanvas::kPoints_PointMode, N, pts, paint);
106
107 canvas->translate(256, 0);
108 }
109}
@ kNormal_SkBlurStyle
fuzzy inside and outside
Definition SkBlurTypes.h:12
constexpr SkColor SK_ColorRED
Definition SkColor.h:126
constexpr SkColor SK_ColorBLACK
Definition SkColor.h:103
#define N
Definition beziers.cpp:19
@ kPoints_PointMode
draw each point separately
Definition SkCanvas.h:1241
static sk_sp< SkMaskFilter > MakeBlur(SkBlurStyle style, SkScalar sigma, bool respectCTM=true)
@ kRound_Cap
adds circle
Definition SkPaint.h:335
@ kSquare_Cap
adds square
Definition SkPaint.h:336
float nextF()
Definition SkRandom.h:55
const Paint & paint