Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
SkPerlinNoiseShader::PaintingData Struct Reference

#include <SkPerlinNoiseShaderImpl.h>

Public Member Functions

 PaintingData (const SkISize &tileSize, SkScalar seed, SkScalar baseFrequencyX, SkScalar baseFrequencyY)
 
void generateBitmaps ()
 
 PaintingData (const PaintingData &that)
 
const SkBitmapgetPermutationsBitmap () const
 
const SkBitmapgetNoiseBitmap () const
 

Public Attributes

int fSeed
 
uint8_t fLatticeSelector [kBlockSize]
 
uint16_t fNoise [4][kBlockSize][2]
 
SkISize fTileSize
 
SkVector fBaseFrequency
 
StitchData fStitchDataInit
 

Detailed Description

Definition at line 62 of file SkPerlinNoiseShaderImpl.h.

Constructor & Destructor Documentation

◆ PaintingData() [1/2]

SkPerlinNoiseShader::PaintingData::PaintingData ( const SkISize tileSize,
SkScalar  seed,
SkScalar  baseFrequencyX,
SkScalar  baseFrequencyY 
)
inline

Definition at line 63 of file SkPerlinNoiseShaderImpl.h.

66 {
67 fBaseFrequency.set(baseFrequencyX, baseFrequencyY);
70 this->init(seed);
71 if (!fTileSize.isEmpty()) {
72 this->stitch();
73 }
74 }
#define SkScalarRoundToInt(x)
Definition: SkScalar.h:37
bool isEmpty() const
Definition: SkSize.h:31
int32_t fHeight
Definition: SkSize.h:18
int32_t fWidth
Definition: SkSize.h:17
void set(int32_t w, int32_t h)
Definition: SkSize.h:24
void set(float x, float y)
Definition: SkPoint_impl.h:200

◆ PaintingData() [2/2]

SkPerlinNoiseShader::PaintingData::PaintingData ( const PaintingData that)
inline

Definition at line 86 of file SkPerlinNoiseShaderImpl.h.

87 : fSeed(that.fSeed)
88 , fTileSize(that.fTileSize)
89 , fBaseFrequency(that.fBaseFrequency)
90 , fStitchDataInit(that.fStitchDataInit)
91 , fPermutationsBitmap(that.fPermutationsBitmap)
92 , fNoiseBitmap(that.fNoiseBitmap) {
93 memcpy(fLatticeSelector, that.fLatticeSelector, sizeof(fLatticeSelector));
94 memcpy(fNoise, that.fNoise, sizeof(fNoise));
95 }

Member Function Documentation

◆ generateBitmaps()

void SkPerlinNoiseShader::PaintingData::generateBitmaps ( )
inline

Definition at line 76 of file SkPerlinNoiseShaderImpl.h.

76 {
77 SkImageInfo info = SkImageInfo::MakeA8(kBlockSize, 1);
78 fPermutationsBitmap.installPixels(info, fLatticeSelector, info.minRowBytes());
79 fPermutationsBitmap.setImmutable();
80
82 fNoiseBitmap.installPixels(info, fNoise[0][0], info.minRowBytes());
83 fNoiseBitmap.setImmutable();
84 }
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
Definition: SkAlphaType.h:29
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
Definition: SkColorType.h:24
void setImmutable()
Definition: SkBitmap.cpp:400
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
Definition: SkBitmap.cpp:323
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)
static SkImageInfo MakeA8(int width, int height)

◆ getNoiseBitmap()

const SkBitmap & SkPerlinNoiseShader::PaintingData::getNoiseBitmap ( ) const
inline

Definition at line 232 of file SkPerlinNoiseShaderImpl.h.

232 {
233 SkASSERT(!fNoiseBitmap.drawsNothing());
234 return fNoiseBitmap;
235 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
bool drawsNothing() const
Definition: SkBitmap.h:226

◆ getPermutationsBitmap()

const SkBitmap & SkPerlinNoiseShader::PaintingData::getPermutationsBitmap ( ) const
inline

Definition at line 228 of file SkPerlinNoiseShaderImpl.h.

228 {
229 SkASSERT(!fPermutationsBitmap.drawsNothing());
230 return fPermutationsBitmap;
231 }

Member Data Documentation

◆ fBaseFrequency

SkVector SkPerlinNoiseShader::PaintingData::fBaseFrequency

Definition at line 101 of file SkPerlinNoiseShaderImpl.h.

◆ fLatticeSelector

uint8_t SkPerlinNoiseShader::PaintingData::fLatticeSelector[kBlockSize]

Definition at line 98 of file SkPerlinNoiseShaderImpl.h.

◆ fNoise

uint16_t SkPerlinNoiseShader::PaintingData::fNoise[4][kBlockSize][2]

Definition at line 99 of file SkPerlinNoiseShaderImpl.h.

◆ fSeed

int SkPerlinNoiseShader::PaintingData::fSeed

Definition at line 97 of file SkPerlinNoiseShaderImpl.h.

◆ fStitchDataInit

StitchData SkPerlinNoiseShader::PaintingData::fStitchDataInit

Definition at line 102 of file SkPerlinNoiseShaderImpl.h.

◆ fTileSize

SkISize SkPerlinNoiseShader::PaintingData::fTileSize

Definition at line 100 of file SkPerlinNoiseShaderImpl.h.


The documentation for this struct was generated from the following file: