noise

package
Version: v0.0.0-...-358a119 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package noise provides functions to generate various types of image noise.

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.

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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL