noise

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2020 License: MIT Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(width, height int, o *Options) *image.RGBA

Generate returns an image of the parameter width and height filled with the values from a noise function. If no options are provided, defaults will be used.

func GeneratePerlin added in v0.12.0

func GeneratePerlin(width, height int, frequency float64) *image.RGBA

GeneratePerlin outputs the perlin image of given height and width and freqency

Types

type Fn

type Fn func() uint8

Fn is a noise function that generates values between 0 and 255.

var (
	// Uniform distribution noise function.
	Uniform Fn
	// Binary distribution noise function.
	Binary Fn
	// Gaussian distribution noise function.
	Gaussian Fn
)

type Options

type Options struct {
	// NoiseFn is a noise function that will be called for each pixel
	// on the image being generated.
	NoiseFn Fn
	// Monochrome sets if the resulting image is grayscale or colored,
	// the latter meaning that each RGB channel was filled with different values.
	Monochrome bool
}

Options to configure the noise generation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL