Documentation ¶
Overview ¶
Package random contains functions, MakeXXX, that can be used to create a random texture tree.
The following code creates a random tree up to six nodes deep and uses it to render to an 800x800 image, which is then saved as "example.png"
package main import ( "github.com/jphsd/graphics2d/image" "github.com/jphsd/texture" "github.com/jphsd/texture/random" ) func main() { cf := random.MakeColorField(6, 0) img := texture.NewRGBA(800, 800, cf, 0, 0, 1, 1) image.SaveImage(img, "example") }
Index ¶
- Variables
- func MakeAddCombiner(md, d int) texture.Field
- func MakeBinary() texture.Field
- func MakeBlend(md, d int) texture.Field
- func MakeColorBlend(md, d int) texture.ColorField
- func MakeColorConv(md, d int) texture.ColorField
- func MakeColorField(md, d int) texture.ColorField
- func MakeColorFields(md, d int) texture.ColorField
- func MakeColorGray(md, d int) texture.ColorField
- func MakeColorSinCos(md, d int) texture.ColorField
- func MakeColorSubstitute(md, d int) texture.ColorField
- func MakeComponent() *texture.Component
- func MakeConicGradient() texture.Field
- func MakeDiffCombiner(md, d int) texture.Field
- func MakeDirection(md, d int) texture.Field
- func MakeDisplace(md, d int) texture.Field
- func MakeDistort(md, d int) texture.Field
- func MakeDistortedPerlin() texture.Field
- func MakeField(md, d int) texture.Field
- func MakeFractal(md, d int) texture.Field
- func MakeImage() texture.Field
- func MakeJitterBlend(md, d int) texture.Field
- func MakeLeaf() texture.Field
- func MakeLinearGradient() texture.Field
- func MakeMagnitude(md, d int) texture.Field
- func MakeMaxCombiner(md, d int) texture.Field
- func MakeMinCombiner(md, d int) texture.Field
- func MakeMorphological(md, d int) texture.Field
- func MakeMulCombiner(md, d int) texture.Field
- func MakeNL() *texture.NonLinear
- func MakeNLCatenary() *texture.NonLinear
- func MakeNLCircle1() *texture.NonLinear
- func MakeNLCircle2() *texture.NonLinear
- func MakeNLCube() *texture.NonLinear
- func MakeNLExponential() *texture.NonLinear
- func MakeNLFilter(md, d int) texture.Field
- func MakeNLGauss() *texture.NonLinear
- func MakeNLLinear() *texture.NonLinear
- func MakeNLLogarithmic() *texture.NonLinear
- func MakeNLLogistic() *texture.NonLinear
- func MakeNLP3() *texture.NonLinear
- func MakeNLP5() *texture.NonLinear
- func MakeNLRand() *texture.NonLinear
- func MakeNLSin() *texture.NonLinear
- func MakeNLSin1() *texture.NonLinear
- func MakeNLSin2() *texture.NonLinear
- func MakeNLSquare() *texture.NonLinear
- func MakeNLWave() texture.Wave
- func MakeNode(md, d int) texture.Field
- func MakeNormal(md, d int) texture.VectorField
- func MakePattern(n int) []float64
- func MakePatternWave() texture.Wave
- func MakePerlin() texture.Field
- func MakeQuantizeFilter(md, d int) texture.Field
- func MakeRadialGradient() texture.Field
- func MakeRandQuantFilter(md, d int) texture.Field
- func MakeReflect(md, d int) texture.Field
- func MakeSelect(md, d int) texture.Field
- func MakeStochasticBlend(md, d int) texture.Field
- func MakeStrip(md, d int) texture.Field
- func MakeSubCombiner(md, d int) texture.Field
- func MakeSubstituteCombiner(md, d int) texture.Field
- func MakeSupport() [][]float64
- func MakeTiledGradient() texture.Field
- func MakeTransform(md, d int) texture.Field
- func MakeUniform() texture.Field
- func MakeVariableFractal(md, d int) texture.Field
- func MakeVectorField(md, d int) texture.VectorField
- func MakeWave() texture.Wave
- func MakeWeightedCombiner(md, d int) texture.Field
- func MakeWindowedCombiner(md, d int) texture.Field
- func PickLambda() float64
- type ColorFieldOpts
- type Leaf
- type NLFunc
- type Node
Constants ¶
This section is empty.
Variables ¶
var ColorFieldOptions []ColorFieldOpts
var Lambdas = []float64{
11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97,
}
var LeafOptions = []Leaf{ {"LinearGradient", MakeLinearGradient}, {"RadialGradient", MakeRadialGradient}, {"ConicGradient", MakeConicGradient}, {"TiledGradient", MakeTiledGradient}, {"Binary", MakeBinary}, {"Perlin", MakePerlin}, {"DistortedPerlin", MakeDistortedPerlin}, {"Image", MakeImage}, }
var NLFOptions = []NLFunc{ {"Linear", MakeNLLinear}, {"Square", MakeNLSquare}, {"Cube", MakeNLCube}, {"Exponential", MakeNLExponential}, {"Logarithmic", MakeNLLogarithmic}, {"Sin", MakeNLSin}, {"Sin1", MakeNLSin1}, {"Sin2", MakeNLSin2}, {"Circle1", MakeNLCircle1}, {"Circle2", MakeNLCircle2}, {"Catenary", MakeNLCatenary}, {"Gauss", MakeNLGauss}, {"Logistic", MakeNLLogistic}, {"NLP3", MakeNLP3}, {"NLP5", MakeNLP5}, {"NLRand", MakeNLRand}, }
var NodeOptions []Node
var Sample image.Image
Functions ¶
func MakeAddCombiner ¶
func MakeBinary ¶
MakeBinary creates a new field backed by bit noise.
func MakeColorBlend ¶
func MakeColorBlend(md, d int) texture.ColorField
MakeColorBlend creates a color field from two input color fields and a field.
func MakeColorConv ¶
func MakeColorConv(md, d int) texture.ColorField
MakeColorConv creates a new color field from a field.
func MakeColorField ¶
func MakeColorField(md, d int) texture.ColorField
MakeColorField creates a new color field.
func MakeColorFields ¶
func MakeColorFields(md, d int) texture.ColorField
MakeColorFields creates a color field from three fields.
func MakeColorGray ¶
func MakeColorGray(md, d int) texture.ColorField
MakeColorGray creates a new color field from a field.
func MakeColorSinCos ¶
func MakeColorSinCos(md, d int) texture.ColorField
MakeColorSinCos creates a new color field from a field.
func MakeColorSubstitute ¶
func MakeColorSubstitute(md, d int) texture.ColorField
MakeColorSubstitute creates a color field from two input color fields and a field.
func MakeConicGradient ¶
func MakeDiffCombiner ¶
func MakeDirection ¶
MakeDirection creates a new field from a vector field.
func MakeDisplace ¶
MakeDisplace creates a displacement of src1 with src2 and src3.
func MakeDistort ¶
MakeDistort creates a new distorted processor.
func MakeDistortedPerlin ¶
MakeDistortedPerlin creates a new field backed by a perlin noise function.
func MakeFractal ¶
MakeFractal creates a new fractal processor.
func MakeJitterBlend ¶
func MakeLinearGradient ¶
func MakeMagnitude ¶
MakeMagnitude creates a new field from a vector field.
func MakeMaxCombiner ¶
func MakeMinCombiner ¶
func MakeMorphological ¶
func MakeMulCombiner ¶
func MakeNLCatenary ¶
func MakeNLCircle1 ¶
func MakeNLCircle2 ¶
func MakeNLCube ¶
func MakeNLExponential ¶
func MakeNLFilter ¶
MakeNLFilter creates a non-linear filter.
func MakeNLGauss ¶
func MakeNLLinear ¶
func MakeNLLogarithmic ¶
func MakeNLLogistic ¶
func MakeNLRand ¶
func MakeNLSin1 ¶
func MakeNLSin2 ¶
func MakeNLSquare ¶
func MakeNormal ¶
func MakeNormal(md, d int) texture.VectorField
MakeNormal creates a new vector field from a field.
func MakePattern ¶
func MakePerlin ¶
MakePerlin creates a new field backed by a perlin noise function.
func MakeQuantizeFilter ¶
MakeQuantizeFilter creates a non-linear filter.
func MakeRadialGradient ¶
func MakeRandQuantFilter ¶
MakeRandQuantFilter creates a non-linear filter.
func MakeReflect ¶
MakeReflect creates a mirror plane in the field.
func MakeSelect ¶
MakeSelect creates a new field from a vector field.
func MakeStochasticBlend ¶
func MakeSubCombiner ¶
func MakeSubstituteCombiner ¶
func MakeSupport ¶
func MakeSupport() [][]float64
func MakeTiledGradient ¶
func MakeTransform ¶
MakeTransform creates a new transform processor
func MakeVariableFractal ¶
MakeVariableFractal creates a new fractal processor.
func MakeVectorField ¶
func MakeVectorField(md, d int) texture.VectorField
MakeVectorField creates a new VectorField.
func MakeWeightedCombiner ¶
func MakeWindowedCombiner ¶
func PickLambda ¶
func PickLambda() float64
Types ¶
type ColorFieldOpts ¶
type ColorFieldOpts struct { Name string Make func(int, int) texture.ColorField }
ColorFieldOpts describes the available ColorField functions.
func GetColorFields ¶
func GetColorFields() []ColorFieldOpts
GetColorFields returns the list of ColorField functions.