Flutter Engine
The Flutter Engine
Classes | Macros | Functions | Variables
beziers.cpp File Reference
#include "gm/gm.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPathBuilder.h"
#include "include/core/SkScalar.h"
#include "include/core/SkSize.h"
#include "include/core/SkString.h"
#include "src/base/SkRandom.h"

Go to the source code of this file.

Classes

class  BeziersGM
 

Macros

#define W   400
 
#define H   400
 
#define N   10
 

Functions

static SkPath rnd_quad (SkPaint *paint, SkRandom &rand)
 
static SkPath rnd_cubic (SkPaint *paint, SkRandom &rand)
 

Variables

constexpr SkScalar SH = SkIntToScalar(H)
 

Macro Definition Documentation

◆ H

#define H   400

Definition at line 18 of file beziers.cpp.

◆ N

#define N   10

Definition at line 19 of file beziers.cpp.

◆ W

#define W   400

Definition at line 17 of file beziers.cpp.

Function Documentation

◆ rnd_cubic()

static SkPath rnd_cubic ( SkPaint paint,
SkRandom rand 
)
static

Definition at line 44 of file beziers.cpp.

44 {
45 auto a = rand.nextRangeScalar(0,W),
46 b = rand.nextRangeScalar(0,H);
47
49 builder.moveTo(a, b);
50 for (int x = 0; x < 2; ++x) {
51 auto c = rand.nextRangeScalar(W/4, W),
52 d = rand.nextRangeScalar( 0, H),
53 e = rand.nextRangeScalar( 0, W),
54 f = rand.nextRangeScalar(H/4, H),
55 g = rand.nextRangeScalar(W/4, W),
56 h = rand.nextRangeScalar(H/4, H);
57 builder.cubicTo(c,d,e,f,g,h);
58 }
59 paint->setColor(rand.nextU());
60 SkScalar width = rand.nextRangeScalar(1, 5);
61 width *= width;
62 paint->setStrokeWidth(width);
63 paint->setAlphaf(1.0f);
64 return builder.detach();
65}
#define W
Definition: beziers.cpp:17
uint32_t nextU()
Definition: SkRandom.h:42
SkScalar nextRangeScalar(SkScalar min, SkScalar max)
Definition: SkRandom.h:106
const Paint & paint
Definition: color_source.cc:38
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
float SkScalar
Definition: extension.cpp:12
static bool b
struct MyStruct a[10]
double x
SkScalar h
int32_t width
Definition: SkMD5.cpp:130

◆ rnd_quad()

static SkPath rnd_quad ( SkPaint paint,
SkRandom rand 
)
static

Definition at line 23 of file beziers.cpp.

23 {
24 auto a = rand.nextRangeScalar(0,W),
25 b = rand.nextRangeScalar(0,H);
26
28 builder.moveTo(a, b);
29 for (int x = 0; x < 2; ++x) {
30 auto c = rand.nextRangeScalar(W/4, W),
31 d = rand.nextRangeScalar( 0, H),
32 e = rand.nextRangeScalar( 0, W),
33 f = rand.nextRangeScalar(H/4, H);
34 builder.quadTo(c,d,e,f);
35 }
36 paint->setColor(rand.nextU());
37 SkScalar width = rand.nextRangeScalar(1, 5);
38 width *= width;
39 paint->setStrokeWidth(width);
40 paint->setAlphaf(1.0f);
41 return builder.detach();
42}

Variable Documentation

◆ SH

constexpr SkScalar SH = SkIntToScalar(H)
constexpr

Definition at line 21 of file beziers.cpp.