8 #ifndef SkPerlinNoiseShader_DEFINED
9 #define SkPerlinNoiseShader_DEFINED
41 kFirstType = kFractalNoise_Type,
42 kLastType = kTurbulence_Type
58 static sk_sp<SkShader> MakeFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
59 int numOctaves, SkScalar seed,
60 const SkISize* tileSize =
nullptr);
61 static sk_sp<SkShader> MakeTurbulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
62 int numOctaves, SkScalar seed,
63 const SkISize* tileSize =
nullptr);
65 #ifdef SK_SUPPORT_LEGACY_CREATESHADER_PTR
66 static SkShader* CreateFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
67 int numOctaves, SkScalar seed,
68 const SkISize* tileSize = NULL) {
69 return MakeFractalNoise(baseFrequencyX, baseFrequencyY, numOctaves, seed, tileSize).release();
71 static SkShader* CreateTurbulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
72 int numOctaves, SkScalar seed,
73 const SkISize* tileSize = NULL) {
74 return MakeTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, tileSize).release();
76 static SkShader* CreateTubulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY,
77 int numOctaves, SkScalar seed,
78 const SkISize* tileSize = NULL) {
79 return CreateTurbulence(baseFrequencyX, baseFrequencyY, numOctaves, seed, tileSize);
88 void shadeSpan(
int x,
int y,
SkPMColor[],
int count)
override;
92 SkScalar calculateTurbulenceValueForPoint(
94 StitchData& stitchData,
const SkPoint& point)
const;
95 SkScalar noise2D(
int channel,
96 const StitchData& stitchData,
const SkPoint& noiseVector)
const;
99 PaintingData* fPaintingData;
108 SK_TO_STRING_OVERRIDE()
114 size_t onContextSize(const ContextRec&) const override;
118 SkScalar baseFrequencyY,
int numOctaves, SkScalar seed,
122 const SkPerlinNoiseShader::Type fType;
123 const SkScalar fBaseFrequencyX;
124 const SkScalar fBaseFrequencyY;
125 const
int fNumOctaves;
126 const SkScalar fSeed;
128 const
bool fStitchTiles;
SkPerlinNoiseShader creates an image using the Perlin turbulence function.
Definition: SkPerlinNoiseShader.h:25
Definition: SkShader.h:327
Shaders specify the source color(s) for what is being drawn.
Definition: SkShader.h:38
Definition: SkPerlinNoiseShader.h:83
Definition: SkPoint.h:156
virtual sk_sp< GrFragmentProcessor > asFragmentProcessor(const AsFPArgs &) const
Returns a GrFragmentProcessor that implements the shader for the GPU backend.
The SkMatrix class holds a 3x3 matrix for transforming coordinates.
Definition: SkMatrix.h:26
Definition: SkRefCnt.h:135
uint32_t SkPMColor
32 bit ARGB color value, premultiplied.
Definition: SkColor.h:147
Definition: SkShader.h:123
Definition: SkWriteBuffer.h:26
ContextRec acts as a parameter bundle for creating Contexts.
Definition: SkShader.h:104