40 return (
type == Type::kFractalNoise)
45 stitchTiles ? &
size :
nullptr)
50 stitchTiles ? &
size : nullptr);
69 SkVector baseFrequency,
int numOctaves,
float seed,
SkISize tileSize = {40, 40}) {
78 paint.setShader(std::move(shader));
80 this->drawRect(canvas, pt,
paint, tileSize);
81 pt.
fX += tileSize.width();
82 this->drawRect(canvas, pt,
paint, tileSize);
83 pt.
fY += tileSize.height();
84 this->drawRect(canvas, pt,
paint, tileSize);
85 pt.
fX -= tileSize.width();
86 this->drawRect(canvas, pt,
paint, tileSize);
93 this->
test(canvas,
SkPoint{ 0, 0}, Type::kFractalNoise,
false,
95 this->
test(canvas,
SkPoint{100, 0}, Type::kTurbulence,
false,
98 this->
test(canvas,
SkPoint{ 0, 100}, Type::kFractalNoise,
false,
100 this->
test(canvas,
SkPoint{100, 100}, Type::kFractalNoise,
true,
103 this->
test(canvas,
SkPoint{ 0, 200}, Type::kTurbulence,
true,
105 this->
test(canvas,
SkPoint{100, 200}, Type::kTurbulence,
false,
108 this->
test(canvas,
SkPoint{ 0, 300}, Type::kFractalNoise,
false,
110 this->
test(canvas,
SkPoint{100, 300}, Type::kFractalNoise,
false,
114 canvas->
scale(0.75f, 1.0f);
116 this->
test(canvas,
SkPoint{ 0, 400}, Type::kFractalNoise,
false,
118 this->
test(canvas,
SkPoint{100, 400}, Type::kFractalNoise,
true,
124 this->
test(canvas,
SkPoint{ 0, 500}, Type::kTurbulence,
true,
125 SkVector{0.03f, 0.03f}, 1, 0, {50, 50});
128 this->
test(canvas,
SkPoint{120, 500}, Type::kTurbulence,
false,
137class PerlinNoiseLocalMatrixGM :
public skiagm::GM {
148 paint.setShader(noise_shader(Type::kFractalNoise, 0.1f, 0.1f, 2, 0,
false,
kSize));
180 paint.setShader(
paint.getShader()->makeWithLocalMatrix(lm));
197class PerlinNoiseRotatedGM :
public skiagm::GM {
199 static constexpr SkISize kRectSize = { 60, 60 };
200 static constexpr int kPad = 10;
201 static constexpr int kCellsX = 3;
202 static constexpr int kCellsY = 2;
220 float yOffset =
kPad;
221 for (
auto type : { Type::kFractalNoise, Type::kTurbulence }) {
222 float xOffset =
kPad;
225 p.setShader(noise_shader(
type, 0.05f, 0.05f, 1, 0,
false, kRectSize));
227 for (
float rotation : {0.0f, 10.0f, 80.0f}) {
228 int saveCount = canvas->
save();
241 canvas->
drawRect(kRectToDraw, outline);
255class PerlinNoiseLayeredGM :
public skiagm::GM {
269 p.setImageFilter(perlin);
277 p.setImageFilter(perlin);
286DEF_GM(
return new PerlinNoiseGM;)
287DEF_GM(
return new PerlinNoiseLocalMatrixGM;)
288DEF_GM(
return new PerlinNoiseRotatedGM;)
289DEF_GM(
return new PerlinNoiseLayeredGM;)
constexpr SkColor SK_ColorBLACK
#define INHERITED(method,...)
int saveLayer(const SkRect *bounds, const SkPaint *paint)
void drawRect(const SkRect &rect, const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void drawPaint(const SkPaint &paint)
void rotate(SkScalar degrees)
void restoreToCount(int saveCount)
void scale(SkScalar sx, SkScalar sy)
static sk_sp< SkColorFilter > Matrix(const SkColorMatrix &)
static sk_sp< SkImageFilter > ColorFilter(sk_sp< SkColorFilter > cf, sk_sp< SkImageFilter > input, const CropRect &cropRect={})
static sk_sp< SkImageFilter > Shader(sk_sp< SkShader > shader, const CropRect &cropRect={})
SkMatrix & setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py)
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
void setStrokeWidth(SkScalar width)
GM(SkColor backgroundColor=SK_ColorWHITE)
virtual SkISize getISize()=0
virtual SkString getName() const =0
virtual DrawResult onDraw(SkCanvas *, SkString *errorMsg)
SK_API sk_sp< SkShader > MakeTurbulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY, int numOctaves, SkScalar seed, const SkISize *tileSize=nullptr)
SK_API sk_sp< SkShader > MakeFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY, int numOctaves, SkScalar seed, const SkISize *tileSize=nullptr)
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 keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
constexpr int32_t width() const
constexpr int32_t height() const
SkScalar fBottom
larger y-axis bounds
SkScalar fRight
larger x-axis bounds
constexpr float height() const
constexpr float width() const
static constexpr SkRect MakeWH(float w, float h)