pattern

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: BSD-3-Clause Imports: 20 Imported by: 0

README

go-pattern

go-pattern is a collection of pre-created image.Image implementations. It provides a variety of ready-to-use patterns that implement the standard Go image interface.

This project is in the early stages, please let me know of use/dependencies.

These patterns are designed to be:

  • Ready to use: Instantly available as standard image.Image objects.
  • Composable: Easily combined (e.g., zooming, transposing) to form complex visual structures.
  • Standard: Fully compatible with any Go library that accepts image.Image.

Patterns

AbstractArt Pattern

AbstractArt Pattern

	v := NewVoronoi(
		makePoints(30, 150, 150),
		[]color.Color{
			color.RGBA{200, 220, 255, 255},
			color.RGBA{100, 150, 250, 255},
			color.RGBA{50, 100, 200, 255},
			color.RGBA{150, 200, 240, 255},
			color.RGBA{20, 40, 100, 255},
		},
	)
	shine := NewLinearGradient(
		SetStartColor(color.RGBA{255, 255, 255, 50}),
		SetEndColor(color.Transparent),
		SetAngle(30),
	)
	return NewBlend(v, shine, BlendOverlay)
AmbientOcclusion Pattern

AmbientOcclusion Pattern

	// This function is for documentation reference
	_ = GenerateAmbientOcclusion(image.Rect(0, 0, 200, 200))
Brick Pattern

Brick Pattern

	return NewBrick(
		SetBrickSize(50, 20),
		SetMortarSize(4),
	)
Brick_stone Pattern

Brick_stone Pattern

	// Create "Stone" textures
	var stones []image.Image
	for i := 0; i < 4; i++ {
		noise := NewNoise(SetNoiseAlgorithm(&PerlinNoise{
			Seed:      int64(i*50 + 123),
			Frequency: 0.2,
		}))
		// Grey/Blueish stone colors
		colored := NewColorMap(noise,
			ColorStop{0.0, color.RGBA{80, 80, 90, 255}},
			ColorStop{0.6, color.RGBA{120, 120, 130, 255}},
			ColorStop{1.0, color.RGBA{160, 160, 170, 255}},
		)
		stones = append(stones, colored)
	}

	mortar := NewUniform(color.RGBA{50, 50, 50, 255})

	// Larger bricks/stones
	return NewBrick(
		SetBrickSize(40, 30),
		SetMortarSize(6),
		SetBrickImages(stones...),
		SetMortarImage(mortar),
		SetBrickOffset(0.3), // Non-standard offset
	)
Brick_textures Pattern

Brick_textures Pattern

	// Bricks with variations
	// Create 3 variations of brick textures using Noise
	var bricks []image.Image
	for i := 0; i < 3; i++ {
		// Noise with different seeds to ensure different texture per variant
		noise := NewNoise(SetNoiseAlgorithm(&PerlinNoise{
			Seed:      int64(i*100 + 1),
			Frequency: 0.1,
		}))

		// Tint the noise red/brown
		colored := NewColorMap(noise,
			ColorStop{0.0, color.RGBA{100, 30, 30, 255}},
			ColorStop{1.0, color.RGBA{180, 60, 50, 255}},
		)
		bricks = append(bricks, colored)
	}

	// Mortar texture: grey noise
	mortar := NewColorMap(
		NewNoise(SetNoiseAlgorithm(&PerlinNoise{
			Seed:      999,
			Frequency: 0.5,
		})),
		ColorStop{0.0, color.RGBA{180, 180, 180, 255}},
		ColorStop{1.0, color.RGBA{220, 220, 220, 255}},
	)

	return NewBrick(
		SetBrickSize(60, 25),
		SetMortarSize(3),
		SetBrickImages(bricks...),
		SetMortarImage(mortar),
	)
Camouflage Pattern

Camouflage Pattern

	img := GenerateCamouflage(image.Rect(0, 0, 150, 150))
	f, err := os.Create(CamouflageOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err = png.Encode(f, img); err != nil {
		panic(err)
	}
Candy Pattern

Candy Pattern

	// 1. Define colors for our candy.
	colors := []color.RGBA{
		{255, 0, 0, 255},     // Red
		{0, 255, 0, 255},     // Green
		{0, 0, 255, 255},     // Blue
		{255, 255, 0, 255},   // Yellow
		{255, 165, 0, 255},   // Orange
		{139, 69, 19, 255},   // Brown
	}

	// 2. Create the Scatter pattern.
	candy := NewScatter(
		SetScatterFrequency(0.04), // Controls size/spacing relative to pixels
		SetScatterDensity(0.9),    // High density
		SetScatterGenerator(func(u, v float64, hash uint64) (color.Color, float64) {
			// Radius of the candy
			radius := 14.0

			// Distance from center
			distSq := u*u + v*v
			if distSq > radius*radius {
				return color.Transparent, 0
			}
			dist := math.Sqrt(distSq)

			// Pick a random color based on hash
			colIdx := hash % uint64(len(colors))
			baseCol := colors[colIdx]

			// Simple shading: slightly darker at edges, highlight at top-left
			// Spherical shading approx
			// Normal vector (nx, ny, nz)
			// z = sqrt(1 - x^2 - y^2)
			nx := u / radius
			ny := v / radius
			nz := math.Sqrt(math.Max(0, 1.0 - nx*nx - ny*ny))

			// Light source direction (top-left)
			lx, ly, lz := -0.5, -0.5, 0.7
			lLen := math.Sqrt(lx*lx + ly*ly + lz*lz)
			lx, ly, lz = lx/lLen, ly/lLen, lz/lLen

			// Diffuse
			dot := nx*lx + ny*ly + nz*lz
			diffuse := math.Max(0, dot)

			// Specular (Glossy plastic look)
			// Reflected light vector
			// R = 2(N.L)N - L
			rx := 2*dot*nx - lx
			ry := 2*dot*ny - ly
			rz := 2*dot*nz - lz
			// View vector (straight up)
			vx, vy, vz := 0.0, 0.0, 1.0
			specDot := rx*vx + ry*vy + rz*vz
			specular := math.Pow(math.Max(0, specDot), 20) // Shininess

			// Apply lighting
			r := float64(baseCol.R) * (0.2 + 0.8*diffuse) + 255*specular*0.6
			g := float64(baseCol.G) * (0.2 + 0.8*diffuse) + 255*specular*0.6
			b := float64(baseCol.B) * (0.2 + 0.8*diffuse) + 255*specular*0.6

			// Clamp
			r = math.Min(255, math.Max(0, r))
			g = math.Min(255, math.Max(0, g))
			b = math.Min(255, math.Max(0, b))

			// Anti-aliasing at edge
			alpha := 1.0
			if dist > radius - 1.0 {
				alpha = radius - dist
			}

			// Use hash for random Z-ordering
			z := float64(hash) / 18446744073709551615.0

			return color.RGBA{
				R: uint8(r),
				G: uint8(g),
				B: uint8(b),
				A: uint8(alpha * 255),
			}, z
		}),
	)

	f, err := os.Create(CandyOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, candy); err != nil {
		panic(err)
	}
Carpet Pattern

Carpet Pattern

	bg := NewRect(SetFillColor(color.RGBA{80, 0, 0, 255})) // Dark Red Base

	// Main Pattern: Large Diamonds
	d1 := NewRotate(
		NewChecker(
			color.RGBA{160, 120, 40, 255}, // Gold
			color.Transparent,
			SetSpaceSize(30),
		),
		45,
	)

	// Secondary Pattern: Smaller overlay diamonds
	d2 := NewRotate(
		NewChecker(
			color.Transparent,
			color.RGBA{0, 0, 0, 60}, // Shadow
			SetSpaceSize(10),
		),
		45,
	)

	// Border Elements?
	// Striped background for texture
	stripes := NewCrossHatch(SetLineSize(1), SetSpaceSize(3), SetAngle(0), SetLineColor(color.RGBA{0,0,0,30}))

	l1 := NewBlend(bg, stripes, BlendNormal)
	l2 := NewBlend(l1, d1, BlendNormal)
	l3 := NewBlend(l2, d2, BlendNormal)

	return l3
Cells Pattern

Cells Pattern

	// F1 Euclidean gives distance to center of cell.
	// We want irregular organic cells.
	noise := NewWorleyNoise(
		SetFrequency(0.02),
		SetSeed(777),
		SetWorleyOutput(OutputF1),
		SetWorleyMetric(MetricEuclidean),
		SetWorleyJitter(0.8), // High jitter for organic look
	)

	// ColorMap:
	// 0.0 - 0.2: Nucleus (Dark Green)
	// 0.2 - 0.25: Nucleus Membrane (Lighter)
	// 0.25 - 0.7: Cytoplasm (Light Green, Translucent look)
	// 0.7 - 0.9: Cell Wall Inner (Darker Green)
	// 0.9 - 1.0: Cell Wall (Thick Dark Border)

	cells := NewColorMap(noise,
		ColorStop{Position: 0.0, Color: color.RGBA{20, 80, 20, 255}},    // Nucleus Center
		ColorStop{Position: 0.18, Color: color.RGBA{40, 100, 40, 255}},  // Nucleus
		ColorStop{Position: 0.20, Color: color.RGBA{100, 180, 100, 255}},// Membrane
		ColorStop{Position: 0.25, Color: color.RGBA{150, 220, 150, 255}},// Cytoplasm Start
		ColorStop{Position: 0.70, Color: color.RGBA{140, 210, 140, 255}},// Cytoplasm End
		ColorStop{Position: 0.85, Color: color.RGBA{50, 120, 50, 255}},  // Wall Inner
		ColorStop{Position: 0.95, Color: color.RGBA{10, 40, 10, 255}},   // Wall Outer
		ColorStop{Position: 1.0, Color: color.RGBA{0, 20, 0, 255}},      // Gap
	)

	f, err := os.Create(CellsOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, cells); err != nil {
		panic(err)
	}
CheckerBorder Pattern

CheckerBorder Pattern

	check := NewChecker(
		color.White,
		color.Black,
		SetSpaceSize(20),
	)
	return NewRect(
		SetLineSize(20),
		SetLineImageSource(check),
		SetFillColor(color.Transparent),
	)
ChippedBrick Pattern

ChippedBrick Pattern

	return GenerateChippedBrick(image.Rect(0, 0, 300, 300))
Circuit Pattern

Circuit Pattern

	return GenerateCircuitImpl(image.Rect(0, 0, 150, 150))
Clouds Pattern

Clouds Pattern

	return ExampleNewClouds_cumulus()
Clouds_cirrus Pattern

Clouds_cirrus Pattern

	// High frequency noise with high persistence to simulate wisps
	wispyNoise := NewNoise(NoiseSeed(103), SetNoiseAlgorithm(&PerlinNoise{
		Frequency:   0.05,
		Octaves:     6,
		Persistence: 0.7,
	}))

	return NewColorMap(wispyNoise,
		ColorStop{0.0, color.RGBA{20, 50, 150, 255}},   // Dark Blue Sky
		ColorStop{0.6, color.RGBA{50, 100, 200, 255}},  // Blue
		ColorStop{0.7, color.RGBA{150, 200, 255, 100}}, // Faint wisp
		ColorStop{1.0, color.RGBA{255, 255, 255, 200}}, // Bright wisp
	)
Clouds_cumulus Pattern

Clouds_cumulus Pattern

	// 1. Base shape: Low frequency noise to define the cloud blobs
	noise := NewNoise(NoiseSeed(42), SetNoiseAlgorithm(&PerlinNoise{
		Frequency:   0.015,
		Octaves:     4,
		Persistence: 0.5,
		Lacunarity:  2.0,
	}))

	// 2. Color Map: Sky Blue -> White
	// We use a steep ramp around 0.5-0.6 to create distinct cloud shapes
	// rather than a smooth fog.
	return NewColorMap(noise,
		ColorStop{0.0, color.RGBA{100, 180, 255, 255}}, // Blue Sky
		ColorStop{0.4, color.RGBA{130, 200, 255, 255}}, // Light Sky
		ColorStop{0.55, color.RGBA{245, 245, 255, 255}}, // Cloud Edge (White-ish)
		ColorStop{0.7, color.RGBA{255, 255, 255, 255}}, // Cloud Body
		ColorStop{1.0, color.RGBA{230, 230, 240, 255}}, // Cloud Shadow/Density
	)
Clouds_storm Pattern

Clouds_storm Pattern

	// Layer 1: Large, brooding shapes
	base := NewNoise(NoiseSeed(666), SetNoiseAlgorithm(&PerlinNoise{
		Frequency:   0.01,
		Octaves:     3,
	}))

	// Layer 2: Detailed turbulence
	detail := NewNoise(NoiseSeed(777), SetNoiseAlgorithm(&PerlinNoise{
		Frequency:   0.04,
		Octaves:     5,
		Persistence: 0.6,
	}))

	// Blend them: Overlay adds contrast
	blended := NewBlend(base, detail, BlendOverlay)

	// Map to stormy colors
	return NewColorMap(blended,
		ColorStop{0.0, color.RGBA{20, 20, 25, 255}},    // Darkest Grey
		ColorStop{0.4, color.RGBA{50, 50, 60, 255}},    // Dark Grey
		ColorStop{0.6, color.RGBA{80, 80, 90, 255}},    // Mid Grey
		ColorStop{0.8, color.RGBA{120, 120, 130, 255}}, // Light Grey highlights
		ColorStop{1.0, color.RGBA{160, 160, 170, 255}}, // Brightest peaks
	)
Clouds_sunset Pattern

Clouds_sunset Pattern

	// 1. Sky Gradient (Orange to Purple)
	sky := NewLinearGradient(
		SetStartColor(color.RGBA{255, 100, 50, 255}),  // Orange/Red Horizon
		SetEndColor(color.RGBA{50, 20, 100, 255}),     // Purple/Blue Zenith
		GradientVertical(),
	)

	// 2. Cloud Shapes
	clouds := NewNoise(NoiseSeed(888), SetNoiseAlgorithm(&PerlinNoise{
		Frequency:   0.012,
		Octaves:     4,
	}))

	// Map cloud noise to alpha/color
	// We want the clouds to be dark at the bottom (shadow) and pink/gold at the edges
	cloudColor := NewColorMap(clouds,
		ColorStop{0.0, color.Black},                        // No clouds
		ColorStop{0.4, color.Black},                        // No clouds
		ColorStop{0.5, color.RGBA{80, 40, 60, 255}},        // Dark cloud base
		ColorStop{0.7, color.RGBA{200, 100, 80, 255}},      // Orange/Pink mid
		ColorStop{1.0, color.RGBA{255, 200, 100, 255}},     // Gold highlights
	)

	// 3. Composite Clouds over Sky using Screen blend mode for a glowing effect
	return NewBlend(sky, cloudColor, BlendScreen)
CrackedMud Pattern

CrackedMud Pattern

	// F2-F1 gives thick lines at cell boundaries (where distance to 1st and 2nd closest points are similar)
	noise := NewWorleyNoise(
		SetFrequency(0.02),
		SetSeed(123),
		SetWorleyOutput(OutputF2MinusF1),
		SetWorleyMetric(MetricEuclidean),
	)

	// Map distance to mud colors.
	// Low value (close to 0) means F1 ~= F2, i.e., boundary/crack.
	// High value means center of cell.

	mud := NewColorMap(noise,
		ColorStop{Position: 0.0, Color: color.RGBA{30, 20, 10, 255}},    // Crack (Dark brown/black)
		ColorStop{Position: 0.1, Color: color.RGBA{60, 40, 20, 255}},    // Crack edge
		ColorStop{Position: 0.2, Color: color.RGBA{130, 100, 70, 255}},  // Mud surface
		ColorStop{Position: 1.0, Color: color.RGBA{160, 120, 80, 255}},  // Center of mud chunk
	)

	f, err := os.Create(CrackedMudOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, mud); err != nil {
		panic(err)
	}
CrossHatch Pattern

CrossHatch Pattern

	// This function body is empty because the bootstrap tool uses the function signature
	// and the following variable to generate the documentation and image.
Curvature Pattern

Curvature Pattern

	// This function is for documentation reference
	_ = GenerateCurvature(image.Rect(0, 0, 200, 200))
Damascus Pattern

Damascus Pattern

	img := GenerateDamascus(image.Rect(0, 0, 150, 150))
	f, err := os.Create(DamascusOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err = png.Encode(f, img); err != nil {
		panic(err)
	}
Dirt Pattern

Dirt Pattern

	// 1. Base Dirt: Brown, grainy noise
	base := NewNoise(
		NoiseSeed(101),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:        101,
			Frequency:   0.1,
			Octaves:     4,
			Persistence: 0.6,
		}),
	)

	dirtColor := NewColorMap(base,
		ColorStop{Position: 0.0, Color: color.RGBA{40, 30, 20, 255}}, // Dark Brown
		ColorStop{Position: 0.5, Color: color.RGBA{80, 60, 40, 255}}, // Brown
		ColorStop{Position: 0.8, Color: color.RGBA{100, 80, 60, 255}}, // Light Brown
		ColorStop{Position: 1.0, Color: color.RGBA{120, 100, 80, 255}}, // Pebbles
	)

	// 2. Grain: High freq noise overlay
	grain := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.5}))
	detailed := NewBlend(dirtColor, grain, BlendOverlay)

	return detailed
Dirt_mud Pattern

Dirt_mud Pattern

	// Base dirt
	dirt := ExampleNewDirt()

	// 3. Wetness Mask: Puddles
	// Low frequency noise thresholded
	puddleNoise := NewNoise(
		NoiseSeed(202),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:      202,
			Frequency: 0.02,
		}),
	)

	// Mask: White where puddles are, Black where dirt is
	// Threshold at 0.6
	mask := NewColorMap(puddleNoise,
		ColorStop{Position: 0.0, Color: color.Black},
		ColorStop{Position: 0.55, Color: color.Black},
		ColorStop{Position: 0.6, Color: color.White},
		ColorStop{Position: 1.0, Color: color.White},
	)

	// Puddles: Darker, smoother, reflective (mocked by color)
	// Or use NormalMap to make them flat vs rough dirt.
	// Let's make puddles dark brown/black and subtract detail.

	puddleColor := NewRect(SetFillColor(color.RGBA{20, 15, 10, 255}))

	// Blend puddle color based on mask?
	// We don't have a "BlendMask" pattern yet that takes a mask image.
	// But we can use boolean ops or just Blend?
	// Or we can use the mask as alpha for the puddle layer and overlay it.
	// But our patterns usually return opaque images unless alpha is handled.

	// Let's assume we want to composite Puddle over Dirt using Mask.
	// This usually requires a MaskedComposite pattern.
	// I don't see one.

	// Workaround:
	// 1. Create Puddle Layer (Dark)
	// 2. Create Dirt Layer
	// 3. Blend them? No, we want distinct areas.
	// If I use `NewBlend` with a mode? No standard mode does masking.

	// I can use `NewBoolean` (BitwiseAnd) if mask is binary?
	// Dirt AND (NOT Mask) + Puddle AND Mask.

	// Invert mask for dirt
	invMask := NewBitwiseNot(mask)

	dirtPart := NewBitwiseAnd([]image.Image{dirt, invMask})
	puddlePart := NewBitwiseAnd([]image.Image{puddleColor, mask})

	return NewBitwiseOr([]image.Image{dirtPart, puddlePart})
Dungeon Pattern

Dungeon Pattern

	stoneTex := NewWorleyNoise(SetFrequency(0.2), NoiseSeed(1))
	stoneCol := NewColorMap(stoneTex,
		ColorStop{0.0, color.RGBA{60, 60, 65, 255}},
		ColorStop{1.0, color.RGBA{40, 40, 45, 255}},
	)
	tiles := NewBrick(
		SetBrickSize(50, 50),
		SetMortarSize(4),
		SetBrickOffset(0),
		SetBrickImages(stoneCol),
		SetMortarImage(NewRect(SetFillColor(color.RGBA{10, 10, 10, 255}))),
	)
	cracks := NewWorleyNoise(
		SetFrequency(0.1),
		SetWorleyOutput(OutputF2MinusF1),
		NoiseSeed(2),
	)
	crackMask := NewColorMap(cracks,
		ColorStop{0.0, color.Black},
		ColorStop{0.05, color.Black},
		ColorStop{0.1, color.Transparent},
	)
	mossNoise := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.05}), NoiseSeed(3))
	mossDetail := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.5}), NoiseSeed(4))
	mossMask := NewBlend(mossNoise, mossDetail, BlendMultiply)
	mossCol := NewColorMap(mossMask,
		ColorStop{0.4, color.Transparent},
		ColorStop{0.6, color.RGBA{50, 100, 50, 150}},
	)
	withCracks := NewBlend(tiles, crackMask, BlendNormal)
	withMoss := NewBlend(withCracks, mossCol, BlendNormal)
	return withMoss
FantasyFrame Pattern

FantasyFrame Pattern

	return GenerateFantasyFrame(image.Rect(0, 0, 150, 150))
Fence Pattern

Fence Pattern

	wires := NewCrossHatch(
		SetLineSize(2),
		SetSpaceSize(18),
		SetAngles(45, 135),
		SetLineColor(color.RGBA{180, 180, 180, 255}),
	)
	grass := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.1}), NoiseSeed(30))
	bg := NewColorMap(grass,
		ColorStop{0.0, color.RGBA{20, 100, 20, 255}},
		ColorStop{1.0, color.RGBA{30, 150, 30, 255}},
	)
	return NewBlend(bg, wires, BlendNormal)
FineGrid Pattern

FineGrid Pattern

	img := NewFineGrid(
		SetBounds(image.Rect(0, 0, 640, 640)),
		SetFineGridCellSize(12),
		SetFineGridGlowRadius(3.5),
		SetFineGridHue(205),
		SetFineGridAberration(1),
		SetFineGridGlowStrength(0.9),
		SetFineGridLineStrength(1.4),
		SetFineGridBackgroundFade(0.0),
	)

	f, err := os.Create(FineGridOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if cerr := f.Close(); cerr != nil {
			panic(cerr)
		}
	}()
	if err := png.Encode(f, img); err != nil {
		panic(err)
	}
Floor Pattern

Floor Pattern

	// Tiled floor using Tile pattern?
	// We have `NewTile` which tiles an image.
	// We have `NewBrick` or `NewGrid`?
	// `brick.go` makes bricks.
	// `checker.go` makes checks.

	// Let's use `NewBrick` for a tile floor.
	// Large square tiles.

	// Create a marble texture for tiles
	marble := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.1}))
	marbleColor := NewColorMap(marble,
		ColorStop{0.0, color.RGBA{220, 220, 220, 255}},
		ColorStop{1.0, color.White},
	)

	// Create a slightly different marble for variation
	marble2 := NewRotate(marbleColor, 90)

	mortarColor := NewRect(SetFillColor(color.RGBA{50, 50, 50, 255}))

	return NewBrick(
		SetBrickSize(60, 60),
		SetMortarSize(3),
		SetBrickOffset(0),
		SetBrickImages(marbleColor, marble2),
		SetMortarImage(mortarColor),
	)
Globe Pattern

Globe Pattern

	ExampleNewGlobe_Projected()
Globe_Grid Pattern

Globe_Grid Pattern

	g := GenerateGlobe_Grid(image.Rect(0, 0, 300, 300))
	saveImage(Globe_GridOutputFilename, g)
Globe_Projected Pattern

Globe_Projected Pattern

	g := GenerateGlobe_Projected(image.Rect(0, 0, 300, 300))
	saveImage(Globe_ProjectedOutputFilename, g)
Globe_Simple Pattern

Globe_Simple Pattern

	g := GenerateGlobe_Simple(image.Rect(0, 0, 300, 300))
	saveImage(Globe_SimpleOutputFilename, g)
GlyphRing Pattern

GlyphRing Pattern

	i := NewGlyphRing()
	f, err := os.Create(GlyphRingOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
Grass Pattern

Grass Pattern

	// 1. Create a base noise layer for general color variation.
	baseNoise := NewNoise(
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:        500,
			Frequency:   0.02,
			Octaves:     4,
			Persistence: 0.5,
			Lacunarity:  2.0,
		}),
	)

	// 2. Create a high-frequency noise layer for "blades" or detail.
	detailNoise := NewNoise(
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:        600,
			Frequency:   0.2, // High frequency for grass blades
			Octaves:     2,
			Persistence: 0.5,
			Lacunarity:  2.0,
		}),
	)

	// 3. Blend them. We want the detail to be prominent but influenced by the base.
	// Multiply might darken too much, let's use Overlay or just simple addition/average.
	// Actually, let's just use the detail noise warped by base noise for a wind-blown look?
	// Or simply blend them.

	// Let's try blending: Base * 0.5 + Detail * 0.5
	// Using BlendAverage is simple.
	blended := NewBlend(baseNoise, detailNoise, BlendAverage)

	// 4. Map to Grass Colors.
	grass := NewColorMap(blended,
		ColorStop{Position: 0.0, Color: color.RGBA{10, 40, 10, 255}},    // Deep shadow/dirt
		ColorStop{Position: 0.3, Color: color.RGBA{30, 80, 30, 255}},    // Dark Grass
		ColorStop{Position: 0.6, Color: color.RGBA{60, 140, 40, 255}},   // Mid Grass
		ColorStop{Position: 0.8, Color: color.RGBA{100, 180, 60, 255}},  // Light Grass
		ColorStop{Position: 1.0, Color: color.RGBA{140, 220, 100, 255}}, // Tips/Highlights
	)

	f, err := os.Create(GrassOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, grass); err != nil {
		panic(err)
	}
GrassClose Pattern

GrassClose Pattern

	// 1. Background: Dirt
	dirt := NewColorMap(
		NewNoise(SetFrequency(0.05), NoiseSeed(1)),
		ColorStop{0.0, color.RGBA{40, 30, 20, 255}},
		ColorStop{1.0, color.RGBA{80, 60, 40, 255}},
	)

	// 2. Wind map (Perlin noise)
	wind := NewNoise(
		SetFrequency(0.01),
		NoiseSeed(2),
		SetNoiseAlgorithm(&PerlinNoise{Seed: 2, Octaves: 2, Persistence: 0.5}),
	)

	// 3. Density map (Worley noise for clumping)
	density := NewWorleyNoise(
		SetFrequency(0.02),
		SetSeed(3),
	)

	// 4. Grass Layer
	grass := NewGrassClose(
		SetBladeHeight(35),
		SetBladeWidth(5),
		SetFillColor(color.RGBA{20, 160, 30, 255}),
		SetWindSource(wind),
		SetDensitySource(density),
		// Background source
		func(p any) {
			if g, ok := p.(*GrassClose); ok {
				g.Source = dirt
			}
		},
	)

	f, err := os.Create(GrassCloseOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, grass); err != nil {
		panic(err)
	}
HexGrid Pattern

HexGrid Pattern

	img := GenerateHexGrid(image.Rect(0, 0, 255, 255))
	f, err := os.Create(HexGridOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()

	if err := png.Encode(f, img); err != nil {
		panic(err)
	}
Ice Pattern

Ice Pattern

	base := NewColorMap(
		NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.02}), NoiseSeed(10)),
		ColorStop{0.0, color.RGBA{220, 230, 255, 255}},
		ColorStop{1.0, color.RGBA{240, 250, 255, 255}},
	)
	cracks := NewWorleyNoise(
		SetFrequency(0.08),
		SetWorleyOutput(OutputF2MinusF1),
		NoiseSeed(11),
	)
	crackLines := NewColorMap(cracks,
		ColorStop{0.0, color.RGBA{255, 255, 255, 180}},
		ColorStop{0.05, color.Transparent},
	)
	deepCracks := NewWorleyNoise(
		SetFrequency(0.04),
		SetWorleyOutput(OutputF2MinusF1),
		NoiseSeed(12),
	)
	deepCrackLines := NewColorMap(deepCracks,
		ColorStop{0.0, color.RGBA{180, 200, 220, 200}},
		ColorStop{0.02, color.Transparent},
	)
	layer1 := NewBlend(base, crackLines, BlendNormal)
	layer2 := NewBlend(layer1, deepCrackLines, BlendNormal)
	return layer2
Islands Pattern

Islands Pattern

	// Layer 1: Base Shape (Worley F1 Euclidean) - Large distinct landmasses
	baseShape := NewWorleyNoise(
		SetFrequency(0.01),
		SetSeed(555),
		SetWorleyOutput(OutputF1),
		SetWorleyMetric(MetricEuclidean),
	)

	// Layer 2: Detail (Perlin Noise) - Adds coastline complexity and terrain roughness
	detail := NewNoise(
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:        123,
			Frequency:   0.05,
			Octaves:     4,
			Persistence: 0.5,
			Lacunarity:  2.0,
		}),
	)

	// Blend: Subtract detail from base shape? Or Overlay?
	// Worley F1 is 0 at center (Peak), 1 at edge (Deep Water).
	// We want Peaks to be high (1.0). So let's Invert Worley first?
	// Or just use ColorMap on the result.
	// If we Add detail to Worley, the values increase.
	// Let's use BlendOverlay to mix the gradients.

	mixed := NewBlend(baseShape, detail, BlendOverlay)

	// ColorMap:
	// Worley: 0 (Peak) -> 1 (Edge)
	// Overlay tends to push contrast.
	// Let's define:
	// 0.0 - 0.2: Snow (Peak)
	// 0.2 - 0.4: Mountain/Rock
	// 0.4 - 0.5: Forest
	// 0.5 - 0.6: Sand
	// 0.6 - 1.0: Water

	islands := NewColorMap(mixed,
		ColorStop{Position: 0.0, Color: color.RGBA{250, 250, 250, 255}}, // Snow
		ColorStop{Position: 0.15, Color: color.RGBA{120, 120, 120, 255}}, // Rock
		ColorStop{Position: 0.30, Color: color.RGBA{34, 139, 34, 255}},  // Forest
		ColorStop{Position: 0.50, Color: color.RGBA{210, 180, 140, 255}}, // Sand
		ColorStop{Position: 0.55, Color: color.RGBA{64, 164, 223, 255}}, // Water
		ColorStop{Position: 1.0, Color: color.RGBA{0, 0, 128, 255}},     // Deep Water
	)

	f, err := os.Create(IslandsOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, islands); err != nil {
		panic(err)
	}
KnollDither Pattern

KnollDither Pattern

	img := NewGopher()
	return NewKnollDither(img, Windows16, 8)
Lava Pattern

Lava Pattern

	// This function is for the testable example and documentation.
	// It creates the file directly.
	img := GenerateLava(image.Rect(0, 0, 150, 150))
	f, err := os.Create(LavaOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err = png.Encode(f, img); err != nil {
		panic(err)
	}
LavaFlow Pattern

LavaFlow Pattern

	base := NewColorMap(
		NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.05}), NoiseSeed(70)),
		ColorStop{0.0, color.RGBA{20, 0, 0, 255}},
		ColorStop{0.6, color.RGBA{60, 10, 0, 255}},
		ColorStop{1.0, color.RGBA{100, 20, 0, 255}},
	)
	rivers := NewColorMap(
		NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.03}), NoiseSeed(71)),
		ColorStop{0.0, color.RGBA{255, 200, 0, 255}}, // Bright Yellow
		ColorStop{0.2, color.RGBA{255, 50, 0, 255}},  // Red
		ColorStop{0.4, color.Transparent},            // Cooled rock
	)
	flow := NewWarp(rivers,
		WarpDistortion(NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.02}), NoiseSeed(72))),
		WarpScale(20.0),
	)
	return NewBlend(base, flow, BlendNormal)
Metal Pattern

Metal Pattern

	// Brushed Metal
	// 1. High frequency noise
	noise := NewNoise(
		NoiseSeed(333),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:        333,
			Frequency:   0.1, // Lower frequency to avoid aliasing when scaled
			Octaves:     3,
			Persistence: 0.5,
		}),
	)

	// Map to grey gradients before scaling
	metalBase := NewColorMap(noise,
		ColorStop{Position: 0.0, Color: color.RGBA{50, 50, 50, 255}},
		ColorStop{Position: 0.5, Color: color.RGBA{150, 150, 150, 255}},
		ColorStop{Position: 1.0, Color: color.RGBA{200, 200, 200, 255}},
	)

	// 2. Anisotropy: Scale heavily
	// Scale X large, Y small? Or X 1, Y large?
	// Vertical streaks: Scale Y > 1.
	// But `NewScale` interpolates.
	// Try Scale X=1, Y=10.
	brushed := NewScale(metalBase, ScaleX(1.0), ScaleY(10.0))

	return brushed
MetalPlate Pattern

MetalPlate Pattern

	// Base: Brushed Metal
	// Use highly directional noise
	noise := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.1, Octaves: 3}))
	// Scale X to 1.0, Scale Y to 0.05 to stretch vertically? Or horizontally?
	// If we want horizontal brush, we stretch X.
	// Scale(1, 0.05) -> Stretches Y (low freq Y).
	// We want lines. Lines are high freq in one direction, low in other.
	// High freq X (1.0), Low freq Y (0.01).
	brushed := NewScale(noise, ScaleX(1.0), ScaleY(0.02))

	metalBase := NewColorMap(brushed,
		ColorStop{0.0, color.RGBA{120, 120, 125, 255}},
		ColorStop{1.0, color.RGBA{180, 180, 190, 255}},
	)

	// Scratches
	scratchNoise := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.5}))
	// Rotate scratches
	scratches := NewRotate(NewScale(scratchNoise, ScaleX(1.0), ScaleY(0.01)), 15)

	scratchLayer := NewColorMap(scratches,
		ColorStop{0.0, color.RGBA{255, 255, 255, 40}},
		ColorStop{0.3, color.Transparent},
	)

	// Rivets
	rivets := NewGeneric(func(x, y int) color.Color {
		s := 50
		nx := (x + s/2) / s * s
		ny := (y + s/2) / s * s
		dx := x - nx
		dy := y - ny
		dist := math.Sqrt(float64(dx*dx + dy*dy))

		if dist < 6 {
			// Rivet shading (simple gradient)
			v := uint8(255 - dist*20)
			return color.RGBA{v, v, v, 255}
		}
		return color.Transparent
	})

	l1 := NewBlend(metalBase, scratchLayer, BlendOverlay)
	l2 := NewBlend(l1, rivets, BlendNormal)

	return l2
Metal_scratched Pattern

Metal_scratched Pattern

	// Base brushed metal
	base := ExampleNewMetal()

	// Scratches using CrossHatch
	hatchMultiply := NewCrossHatch(
		SetLineColor(color.Gray{100}), // Dark scratches
		SetSpaceColor(color.White),    // No change
		SetLineSize(1),
		SetSpaceSize(40),
		SetAngles(10, 80, 170),
	)

	// Distort scratches slightly
	distort := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.1}))
	hatchWarped := NewWarp(hatchMultiply, WarpDistortion(distort), WarpScale(2.0))

	return NewBlend(base, hatchWarped, BlendMultiply)
Molecules Pattern

Molecules Pattern

	// Base Worley Noise (F1) provides the cellular structure
	noise := NewWorleyNoise(
		SetFrequency(0.02),
		SetSeed(42),
		SetWorleyOutput(OutputF1),
		SetWorleyMetric(MetricEuclidean),
	)

	// ColorMap:
	// Center (distance 0) -> Light
	// Edge (distance ~0.5) -> Dark
	// Gaps -> Black

	molecules := NewColorMap(noise,
		ColorStop{Position: 0.0, Color: color.RGBA{180, 180, 190, 255}}, // Center
		ColorStop{Position: 0.4, Color: color.RGBA{100, 100, 110, 255}}, // Edge
		ColorStop{Position: 0.45, Color: color.RGBA{50, 50, 55, 255}},   // Darker edge
		ColorStop{Position: 0.5, Color: color.RGBA{10, 10, 10, 255}},    // Gap
		ColorStop{Position: 1.0, Color: color.RGBA{0, 0, 0, 255}},       // Deep gap
	)

	f, err := os.Create(MoleculesOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, molecules); err != nil {
		panic(err)
	}
MudTracks Pattern

MudTracks Pattern

	img := buildMudTracks(nil)

	f, err := os.Create(MudTracksOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, img); err != nil {
		panic(err)
	}
NormalMap Pattern

NormalMap Pattern

	// Create a height map using Perlin noise
	noise := NewNoise(
		NoiseSeed(123),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:        123,
			Octaves:     4,
			Persistence: 0.5,
			Lacunarity:  2.0,
			Frequency:   0.05,
		}),
	)

	// Convert to normal map with strength 5.0
	return NewNormalMap(noise, NormalMapStrength(5.0))
NormalMap_sphere Pattern

NormalMap_sphere Pattern

	// A simple sphere gradient to show curvature normals
	grad := NewRadialGradient(
		GradientCenter(0.5, 0.5),
		SetStartColor(color.White),
		SetEndColor(color.Black),
	)

	// Increase strength significantly to visualize the curve on a smooth gradient
	return NewNormalMap(grad, NormalMapStrength(30.0))
Null Pattern

Null Pattern

	i := NewNull()
	f, err := os.Create(NullOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
PCBTraces Pattern

PCBTraces Pattern

	return GeneratePCBTraces(image.Rect(0, 0, 192, 192))
PaintedPlanks Pattern

PaintedPlanks Pattern

	return NewPaintedPlanks(
		SetPlankBaseWidth(72),
		SetPlankWidthVariance(0.32),
		SetGrainIntensity(0.75),
		SetPaintWear(0.42),
		SetPaintColor(color.RGBA{177, 202, 214, 255}),
	)
Pebbles Pattern

Pebbles Pattern

	// Re-implement Pebbles using Scatter for true overlapping geometry.
	pebbles := NewScatter(
		SetScatterFrequency(0.04), // Size control
		SetScatterDensity(1.0),    // Packed tight
		SetScatterMaxOverlap(1),
		SetScatterGenerator(func(u, v float64, hash uint64) (color.Color, float64) {
			// Randomize size slightly
			rSize := float64(hash&0xFF)/255.0
			radius := 12.0 + rSize*6.0 // 12 to 18 pixels radius

			// Perturb the shape using simple noise (simulated by sin/cos of hash+angle)
			// to make it "chipped" or irregular.
			angle := math.Atan2(v, u)
			dist := math.Sqrt(u*u + v*v)

			// Simple radial noise
			noise := math.Sin(angle*5 + float64(hash%10)) * 0.1
			noise += math.Cos(angle*13 + float64(hash%7)) * 0.05

			effectiveRadius := radius * (1.0 + noise)

			if dist > effectiveRadius {
				return color.Transparent, 0
			}

			// Stone Color: Grey/Brown variations
			grey := 100 + int(hash%100)
			col := color.RGBA{uint8(grey), uint8(grey - 5), uint8(grey - 10), 255}

			// Shading (diffuse)
			// Normal estimation for a flattened spheroid
			nx := u / effectiveRadius
			ny := v / effectiveRadius
			nz := math.Sqrt(math.Max(0, 1.0 - nx*nx - ny*ny))

			// Light dir
			lx, ly, lz := -0.5, -0.5, 0.7
			lLen := math.Sqrt(lx*lx + ly*ly + lz*lz)
			lx, ly, lz = lx/lLen, ly/lLen, lz/lLen

			diffuse := math.Max(0, nx*lx + ny*ly + nz*lz)

			// Apply shading
			r := float64(col.R) * (0.1 + 0.9*diffuse)
			g := float64(col.G) * (0.1 + 0.9*diffuse)
			b := float64(col.B) * (0.1 + 0.9*diffuse)

			// Soft edge anti-aliasing
			alpha := 1.0
			edgeDist := effectiveRadius - dist
			if edgeDist < 1.0 {
				alpha = edgeDist
			}

			// Use hash for random Z-ordering
			z := float64(hash) / 18446744073709551615.0

			return color.RGBA{
				R: uint8(math.Min(255, r)),
				G: uint8(math.Min(255, g)),
				B: uint8(math.Min(255, b)),
				A: uint8(alpha * 255),
			}, z
		}),
	)

	f, err := os.Create(PebblesOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, pebbles); err != nil {
		panic(err)
	}
PersianRug Pattern

PersianRug Pattern

	return GeneratePersianRugImpl(image.Rect(0, 0, 150, 150))
PixelCamo Pattern

PixelCamo Pattern

	pn := &PerlinNoise{Frequency: 0.04, Seed: 60}
	return NewGeneric(func(x, y int) color.Color {
		s := 10
		qx := (x / s) * s
		qy := (y / s) * s
		c := pn.At(qx, qy)
		g := c.(color.Gray).Y
		v := float64(g) / 255.0
		if v < 0.3 {
			return color.RGBA{30, 25, 20, 255}
		} else if v < 0.5 {
			return color.RGBA{60, 80, 40, 255}
		} else if v < 0.7 {
			return color.RGBA{140, 130, 100, 255}
		}
		return color.RGBA{10, 10, 10, 255}
	})
Polka Pattern

Polka Pattern

	i := NewPolka(
		SetRadius(10),
		SetSpacing(40),
		SetFillColor(color.Black),
		SetSpaceColor(color.White),
	)
	f, err := os.Create(PolkaOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
Road Pattern

Road Pattern

	// Asphalt: Aggregate noise (grey with black/white speckles)
	base := NewNoise(
		NoiseSeed(707),
		SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.8}),
	)

	asphalt := NewColorMap(base,
		ColorStop{Position: 0.0, Color: color.RGBA{40, 40, 40, 255}},
		ColorStop{Position: 0.2, Color: color.RGBA{60, 60, 60, 255}},
		ColorStop{Position: 0.5, Color: color.RGBA{50, 50, 50, 255}},
		ColorStop{Position: 0.8, Color: color.RGBA{70, 70, 70, 255}},
		ColorStop{Position: 1.0, Color: color.RGBA{90, 90, 90, 255}},
	)

	// Cracks: Voronoi edges
	v2 := NewVoronoi(
		[]image.Point{
			{10, 10}, {50, 200}, {200, 50}, {220, 220},
			{100, 100}, {150, 150}, {80, 20}, {20, 80},
		},
		[]color.Color{color.Black, color.White},
	)

	edges := NewEdgeDetect(v2)
	// Edges are white on black.

	// Invert to get Black cracks on White background
	cracks := NewBitwiseNot(edges)

	// Multiply cracks onto asphalt
	return NewBlend(asphalt, cracks, BlendMultiply)
Road_marked Pattern

Road_marked Pattern

	road := ExampleNewRoad()

	// Painted lines
	// Yellow center line (dashed?)
	// Let's do a solid double yellow or single yellow.
	// VerticalLine pattern repeats.
	// Image width is usually 255.
	// We want one line in the center.
	// LineSize 10. SpaceSize big enough to push next line off screen.

	lines := NewVerticalLine(
		SetLineSize(8),
		SetSpaceSize(300),
		SetLineColor(color.RGBA{255, 200, 0, 255}), // Paint
		SetSpaceColor(color.Transparent),
		SetPhase(123), // Center: ~127 minus half line width (4) = 123.
	)

	// Composite lines over road using Normal blend (Paint on top)
	return NewBlend(road, lines, BlendNormal)
Road_terrain Pattern

Road_terrain Pattern

	// Winding road on grass

	// 1. Terrain (Grass)
	grass := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.1}))
	grassColor := NewColorMap(grass,
		ColorStop{0.0, color.RGBA{30, 100, 30, 255}},
		ColorStop{1.0, color.RGBA{50, 150, 50, 255}},
	)

	// 2. Road Mask (Winding curve)
	// We can use a low freq noise thresholded to a thin band?
	// Or use `ModuloStripe` or `Sine` warped.
	// Let's use a warped VerticalLine.

	roadPath := NewVerticalLine(
		SetLineSize(40), // Road width
		SetSpaceSize(300),
		SetLineColor(color.White), // Mask: White = Road
		SetSpaceColor(color.Black), // Mask: Black = Grass
		SetPhase(105),
	)

	// Warp the road path to make it winding
	warpNoise := NewNoise(NoiseSeed(999), SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.02}))
	windingRoadMask := NewWarp(roadPath, WarpDistortionX(warpNoise), WarpScale(50.0))

	// 3. Road Texture
	// Use asphalt from ExampleNewRoad, but we need to map it to the winding path?
	// A simple tiled asphalt is fine.
	roadTex := ExampleNewRoad()

	// 4. Composite
	// We have Grass (Bg), RoadTex (Fg), Mask (windingRoadMask).
	// We don't have a MaskedBlend.
	// Workaround:
	// GrassPart = Grass * (NOT Mask)
	// RoadPart = RoadTex * Mask
	// Result = GrassPart + RoadPart

	// Invert mask
	invMask := NewBitwiseNot(windingRoadMask)

	// Masking requires BitwiseAnd?
	// But BitwiseAnd operates on colors bits.
	// If Mask is pure Black/White, it works like a stencil for RGB.

	grassPart := NewBitwiseAnd([]image.Image{grassColor, invMask})
	roadPart := NewBitwiseAnd([]image.Image{roadTex, windingRoadMask})

	return NewBitwiseOr([]image.Image{grassPart, roadPart})
Sand Pattern

Sand Pattern

	// 1. Fine grain noise
	grain := NewNoise(
		NoiseSeed(303),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:        303,
			Frequency:   0.5,
			Octaves:     2,
		}),
	)

	sandColor := NewColorMap(grain,
		ColorStop{Position: 0.0, Color: color.RGBA{194, 178, 128, 255}}, // Sand
		ColorStop{Position: 1.0, Color: color.RGBA{225, 205, 150, 255}}, // Light Sand
	)

	return sandColor
Sand_dunes Pattern

Sand_dunes Pattern

	// Base sand
	sand := ExampleNewSand()

	// 2. Ripples
	ripples := NewNoise(
		NoiseSeed(404),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:      404,
			Frequency: 0.05,
		}),
	)
	// Stretch to make lines
	ripplesStretched := NewScale(ripples, ScaleX(1.0), ScaleY(10.0))

	// Darken troughs using Multiply
	shadows := NewColorMap(ripplesStretched,
		ColorStop{Position: 0.0, Color: color.RGBA{180, 180, 180, 255}}, // Darker (Grey for Multiply)
		ColorStop{Position: 0.5, Color: color.White}, // No change
		ColorStop{Position: 1.0, Color: color.White}, // No change
	)

	// Rotate ripples
	rotatedShadows := NewRotate(shadows, 90)

	return NewBlend(sand, rotatedShadows, BlendMultiply)
Sand_zoomed Pattern

Sand_zoomed Pattern

	// Zoomed in sand to show grains
	// Use Scatter or just low freq noise mapped to dots?
	// Let's use noise with thresholding to make "grains".

	noise := NewNoise(
		NoiseSeed(304),
		SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.2}),
	)

	// Map to distinct grains
	grains := NewColorMap(noise,
		ColorStop{Position: 0.0, Color: color.RGBA{160, 140, 100, 255}}, // Dark grain
		ColorStop{Position: 0.4, Color: color.RGBA{210, 190, 150, 255}}, // Main sand
		ColorStop{Position: 0.7, Color: color.RGBA{230, 210, 170, 255}}, // Light grain
		ColorStop{Position: 0.9, Color: color.RGBA{255, 255, 255, 255}}, // Quartz sparkle
	)

	return grains
Scales Pattern

Scales Pattern

	// Use the explicit Scales pattern for proper overlapping geometry.
	// Radius 40, SpacingX 40 (touching horizontally), SpacingY 20 (half-overlap vertically).
	pattern := NewScales(
		SetScaleRadius(40),
		SetScaleXSpacing(40),
		SetScaleYSpacing(25),
	)

	// The Scales pattern returns a heightmap (0 edge, 1 center).
	// We want to map this to look like a tough fish scale.
	// Center: Shiny/Metallic
	// Gradient towards edge.
	// Edge: Dark border.

	scales := NewColorMap(pattern,
		ColorStop{Position: 0.0, Color: color.RGBA{10, 10, 10, 255}},    // Deep edge (overlap shadow)
		ColorStop{Position: 0.2, Color: color.RGBA{40, 40, 30, 255}},    // Rim
		ColorStop{Position: 0.5, Color: color.RGBA{100, 100, 80, 255}},  // Body
		ColorStop{Position: 0.8, Color: color.RGBA{160, 150, 120, 255}}, // Highlight start
		ColorStop{Position: 1.0, Color: color.RGBA{200, 190, 160, 255}}, // Peak Highlight
	)

	f, err := os.Create(ScalesOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, scales); err != nil {
		panic(err)
	}
ScreenTone Pattern

ScreenTone Pattern

	i := NewScreenTone(
		SetRadius(3),
		SetSpacing(10),
		SetAngle(45),
		SetFillColor(color.Black),
		SetSpaceColor(color.White),
	)
	f, err := os.Create(ScreenToneOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
Shojo Pattern

Shojo Pattern

	i := NewShojo()
	f, err := os.Create(ShojoOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
Shojo_blue Pattern

Shojo_blue Pattern

	i := NewShojo(
		SetSpaceColor(color.RGBA{0, 0, 40, 255}),     // Dark blue bg
		SetFillColor(color.RGBA{200, 220, 255, 255}), // Blueish sparkles
	)
	f, err := os.Create(Shojo_blueOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
Shojo_pink Pattern

Shojo_pink Pattern

	i := NewShojo(
		SetSpaceColor(color.RGBA{20, 0, 10, 255}),    // Dark red/brown bg
		SetFillColor(color.RGBA{255, 200, 220, 255}), // Pink sparkles
	)
	f, err := os.Create(Shojo_pinkOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
Slate Pattern

Slate Pattern

	// Slate: Layered noise, laminar structure.
	// Dark grey, slight blue/green tint.

	base := NewNoise(
		NoiseSeed(808),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:      808,
			Frequency: 0.05,
			Octaves:   5,
		}),
	)

	// Map to slate colors
	slateColor := NewColorMap(base,
		ColorStop{Position: 0.0, Color: color.RGBA{40, 45, 50, 255}},
		ColorStop{Position: 0.5, Color: color.RGBA{60, 65, 70, 255}},
		ColorStop{Position: 1.0, Color: color.RGBA{80, 85, 90, 255}},
	)

	// Laminar effect: Scale Y slightly to stretch horizontally? Or vertically?
	// Slate cleaves. Usually fine layers.
	laminar := NewScale(slateColor, ScaleX(2.0), ScaleY(1.0))

	// Surface bumpiness
	bump := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.2}))

	return NewBlend(laminar, bump, BlendOverlay)
Snow Pattern

Snow Pattern

	// 1. Soft base noise (drifts) - Bright white/grey
	drifts := NewNoise(
		NoiseSeed(505),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:      505,
			Frequency: 0.01,
		}),
	)

	snowColor := NewColorMap(drifts,
		ColorStop{Position: 0.0, Color: color.RGBA{240, 240, 250, 255}}, // Slight blue-grey shadow
		ColorStop{Position: 1.0, Color: color.White},
	)

	// 2. Sparkle: Use white/blue dots.
	// We can use Scatter pattern to place small bright dots.
	// But let's fix the noise approach.
	// High frequency noise, thresholded.
	sparkleNoise := NewNoise(
		NoiseSeed(606),
		SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.8}),
	)

	// We want sparkles to be White/Blue on Transparent background.
	// Then Overlay or Screen them.
	// If background is Transparent, Screen (1-(1-A)*(1-B)) of Snow(A) and Transparent(B=0) -> A.
	// So sparkles need to be Additive.
	// Or we can just use Mix/Over.

	sparkles := NewColorMap(sparkleNoise,
		ColorStop{Position: 0.0, Color: color.Transparent},
		ColorStop{Position: 0.9, Color: color.Transparent},
		ColorStop{Position: 0.92, Color: color.RGBA{200, 220, 255, 255}}, // Blue tint
		ColorStop{Position: 1.0, Color: color.White},
	)

	// Use BlendNormal (Over) for sparkles
	return NewBlend(snowColor, sparkles, BlendNormal)
Snow_tracks Pattern

Snow_tracks Pattern

	snow := ExampleNewSnow()

	// 3. Compression Tracks: Blueish/Grey depression.
	tracks := NewCrossHatch(
		SetLineColor(color.RGBA{200, 210, 230, 255}), // Icy blue/grey
		SetSpaceColor(color.White), // Neutral for Multiply
		SetLineSize(15),
		SetSpaceSize(80),
		SetAngles(25, 35), // Overlapping tracks
	)

	// Distort tracks
	distort := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.05}))
	organicTracks := NewWarp(tracks, WarpDistortion(distort), WarpScale(8.0))

	// Multiply tracks onto snow
	// LineColor (Blueish) * Snow (White) -> Blueish.
	// SpaceColor (White) * Snow (White) -> White.
	return NewBlend(snow, organicTracks, BlendMultiply)
Starfield Pattern

Starfield Pattern

	img := GenerateStarfield(image.Rect(0, 0, 150, 150))
	f, err := os.Create(StarfieldOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err = png.Encode(f, img); err != nil {
		panic(err)
	}
Stone Pattern

Stone Pattern

	// Voronoi base for cells (cobblestones)
	// We want cells to be somewhat irregular.
	voronoi := NewVoronoi(
		// Points
		[]image.Point{
			{50, 50}, {150, 40}, {230, 60},
			{40, 140}, {130, 130}, {240, 150},
			{60, 230}, {160, 240}, {220, 220},
			{100, 100}, {200, 200}, {30, 30},
			{180, 80}, {80, 180},
		},
		// Colors: Using Greyscale for heightmap initially, or color for texture
		// Let's make a texture.
		[]color.Color{
			color.RGBA{100, 100, 100, 255},
			color.RGBA{120, 115, 110, 255},
			color.RGBA{90, 90, 95, 255},
			color.RGBA{110, 110, 110, 255},
			color.RGBA{130, 125, 120, 255},
		},
	)

	// 1. Edge Wear: Distort the Voronoi
	distort := NewNoise(
		NoiseSeed(77),
		SetNoiseAlgorithm(&PerlinNoise{Seed: 77, Frequency: 0.1}),
	)
	worn := NewWarp(voronoi, WarpDistortion(distort), WarpScale(5.0))

	// 2. Surface Detail: Grain
	grain := NewNoise(
		NoiseSeed(88),
		SetNoiseAlgorithm(&PerlinNoise{Seed: 88, Frequency: 0.5}),
	)

	// Blend grain onto stones (Overlay)
	textured := NewBlend(worn, grain, BlendOverlay)

	// We return the Albedo texture, not the normal map.
	// Normal map can be a separate pass or derived.
	return textured
Stone_cobble Pattern

Stone_cobble Pattern

	// Cellular noise (Worley) for cobblestones heightmap
	worley := NewWorleyNoise(
		SetWorleyMetric(MetricEuclidean),
		SetWorleyOutput(OutputF1), // Distance to closest point
		NoiseSeed(123),
		SetFrequency(0.06),
	)

	// Map Worley (0-1 distance) to Stone Colors
	// Worley: 0 is center, 1 is edge.
	// Cobbles: Center is high/bright, Edge is low/dark (mortar).
	// We want to map the distance to a color gradient.

	cobbleColor := NewColorMap(worley,
		ColorStop{Position: 0.0, Color: color.RGBA{180, 175, 170, 255}}, // Center (Light Stone)
		ColorStop{Position: 0.4, Color: color.RGBA{140, 135, 130, 255}}, // Mid Stone
		ColorStop{Position: 0.7, Color: color.RGBA{100, 95, 90, 255}},   // Dark Stone edge
		ColorStop{Position: 0.85, Color: color.RGBA{60, 55, 50, 255}},   // Mortar start
		ColorStop{Position: 1.0, Color: color.RGBA{40, 35, 30, 255}},    // Deep Mortar
	)

	// Add noise for texture
	noise := NewNoise(SetNoiseAlgorithm(&PerlinNoise{Frequency: 0.2}))
	textured := NewBlend(cobbleColor, noise, BlendOverlay)

	return textured
Stones Pattern

Stones Pattern

	// F2-F1 gives distance to the border.
	// Border is 0. Center is High.
	noise := NewWorleyNoise(
		SetFrequency(0.02),
		SetSeed(100),
		SetWorleyOutput(OutputF2MinusF1),
		SetWorleyMetric(MetricEuclidean),
	)

	// Map:
	// 0.0 - 0.1: Mortar (Dark)
	// 0.1 - 0.3: Edge of stone (Darker Grey)
	// 0.3 - 1.0: Stone Body (Grey/Blueish with gradient)

	stones := NewColorMap(noise,
		ColorStop{Position: 0.0, Color: color.RGBA{20, 15, 10, 255}},    // Mortar
		ColorStop{Position: 0.15, Color: color.RGBA{40, 40, 45, 255}},   // Stone Edge
		ColorStop{Position: 0.3, Color: color.RGBA{80, 80, 90, 255}},    // Stone Body
		ColorStop{Position: 0.8, Color: color.RGBA{150, 150, 160, 255}}, // Highlight
	)

	f, err := os.Create(StonesOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, stones); err != nil {
		panic(err)
	}
Stripe Pattern

Stripe Pattern

	stripes := NewCrossHatch(
		SetLineSize(20),
		SetSpaceSize(20),
		SetAngle(45),
		SetLineColor(color.RGBA{255, 200, 0, 255}), // Yellow
		SetSpaceColor(color.RGBA{20, 20, 20, 255}), // Black
	)
	return stripes
ThreadBands Pattern

ThreadBands Pattern

	// Example body intentionally empty. The bootstrap tool inspects the signature and
	// metadata variables below to render documentation assets.
Tile Pattern

Tile Pattern

	gopher := NewScale(NewGopher(), ScaleToRatio(0.25))
	// Tile the gopher in a 200x200 area
	return NewTile(gopher, image.Rect(0, 0, 200, 200))
Voronoi Pattern

Voronoi Pattern

	// Define some points and colors
	points := []image.Point{
		{50, 50}, {200, 50}, {125, 125}, {50, 200}, {200, 200},
	}
	colors := []color.Color{
		color.RGBA{255, 100, 100, 255},
		color.RGBA{100, 255, 100, 255},
		color.RGBA{100, 100, 255, 255},
		color.RGBA{255, 255, 100, 255},
		color.RGBA{100, 255, 255, 255},
	}

	i := NewVoronoi(points, colors)
	f, err := os.Create(VoronoiOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
VoronoiTiles Pattern

VoronoiTiles Pattern

	img := NewVoronoiTiles(image.Rect(0, 0, 255, 255), defaultVoronoiTileCellSize, defaultVoronoiTileGapWidth, defaultVoronoiTileHeightImpact, 2024)

	f, err := os.Create(VoronoiTilesOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, img); err != nil {
		panic(err)
	}
Warp Pattern

Warp Pattern

	// Standard demo: Grid warped by noise
	// We want a visual that clearly shows the warping effect.
	// A checkerboard is good.

	checker := NewChecker(
		color.RGBA{200, 200, 200, 255},
		color.RGBA{50, 50, 50, 255},
	)

	// Distortion noise
	noise := NewNoise(NoiseSeed(99), SetNoiseAlgorithm(&PerlinNoise{
		Frequency: 0.03,
		Octaves: 2,
	}))

	// Apply Warp
	warped := NewWarp(checker,
		WarpDistortion(noise),
		WarpScale(10.0),
	)

	fmt.Println(warped.At(10, 10))
	// Output: {50 50 50 255}
Warp_clouds Pattern

Warp_clouds Pattern

	baseNoise := NewNoise(NoiseSeed(777), SetNoiseAlgorithm(&PerlinNoise{
		Frequency: 0.02,
		Octaves: 4,
		Persistence: 0.5,
	}))

	warpNoise := NewNoise(NoiseSeed(888), SetNoiseAlgorithm(&PerlinNoise{
		Frequency: 0.02,
		Octaves: 2,
	}))

	warped := NewWarp(baseNoise,
		WarpDistortion(warpNoise),
		WarpScale(50.0),
	)

	stops := []ColorStop{
		{0.0, color.RGBA{0, 100, 200, 255}},
		{0.4, color.RGBA{100, 150, 255, 255}},
		{0.6, color.RGBA{255, 255, 255, 255}},
		{1.0, color.RGBA{255, 255, 255, 255}},
	}

	return NewColorMap(warped, stops...)
Warp_marble Pattern

Warp_marble Pattern

	colors := []color.Color{
		color.RGBA{240, 240, 245, 255},
		color.RGBA{240, 240, 245, 255},
		color.RGBA{240, 240, 245, 255},
		color.RGBA{200, 200, 210, 255},
		color.RGBA{100, 100, 110, 255},
		color.RGBA{200, 200, 210, 255},
	}
	stripes := NewModuloStripe(colors)

	noise := NewNoise(NoiseSeed(456), SetNoiseAlgorithm(&PerlinNoise{
		Frequency: 0.04,
		Octaves: 4,
		Persistence: 0.6,
	}))

	return NewWarp(stripes,
		WarpDistortion(noise),
		WarpScale(30.0),
	)
Warp_terrain Pattern

Warp_terrain Pattern

	fbm := func(seed int64) image.Image {
		return NewNoise(NoiseSeed(seed), SetNoiseAlgorithm(&PerlinNoise{
			Frequency: 0.015,
			Octaves: 6,
			Persistence: 0.5,
			Lacunarity: 2.0,
		}))
	}

	base := fbm(101)

	warp := NewNoise(NoiseSeed(202), SetNoiseAlgorithm(&PerlinNoise{
		Frequency: 0.01,
		Octaves: 2,
	}))

	warped := NewWarp(base,
		WarpDistortion(warp),
		WarpScale(80.0),
	)

	stops := []ColorStop{
		{0.0, color.RGBA{0, 0, 150, 255}},
		{0.2, color.RGBA{0, 50, 200, 255}},
		{0.22, color.RGBA{240, 230, 140, 255}},
		{0.3, color.RGBA{34, 139, 34, 255}},
		{0.6, color.RGBA{107, 142, 35, 255}},
		{0.8, color.RGBA{139, 69, 19, 255}},
		{0.9, color.RGBA{100, 100, 100, 255}},
		{0.98, color.RGBA{255, 250, 250, 255}},
	}

	return NewColorMap(warped, stops...)
Warp_wood Pattern

Warp_wood Pattern

	woodLight := color.RGBA{222, 184, 135, 255}
	woodDark := color.RGBA{139, 69, 19, 255}

	colors := []color.Color{}
	steps := 20
	for i := 0; i < steps; i++ {
		t := float64(i) / float64(steps-1)
		r := uint8(float64(woodLight.R)*(1-t) + float64(woodDark.R)*t)
		g := uint8(float64(woodLight.G)*(1-t) + float64(woodDark.G)*t)
		b := uint8(float64(woodLight.B)*(1-t) + float64(woodDark.B)*t)
		colors = append(colors, color.RGBA{r, g, b, 255})
	}
	for i := steps - 1; i >= 0; i-- {
		colors = append(colors, colors[i])
	}

	rings := NewConcentricRings(colors)

	noiseLow := NewNoise(NoiseSeed(123), SetNoiseAlgorithm(&PerlinNoise{
		Frequency: 0.02,
		Octaves: 2,
	}))

	// Apply Warp
	return NewWarp(rings,
		WarpDistortion(noiseLow),
		WarpScale(15.0),
	)
Water Pattern

Water Pattern

	// 1. Base Noise: Simplex/Perlin noise (FBM)
	baseNoise := NewNoise(
		NoiseSeed(1),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:        1,
			Octaves:     6,
			Persistence: 0.5,
			Lacunarity:  2.0,
			Frequency:   0.03,
		}),
	)

	// 2. Flow Maps: We simulate flow by warping the noise.
	// We'll use another lower frequency noise as the vector field (x/y displacement).
	// Since Warp takes one image for X and Y, we can use the same noise or different ones.
	// Let's create a "flow" map.
	flowX := NewNoise(
		NoiseSeed(2),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:      2,
			Frequency: 0.01,
		}),
	)

	// Apply warp
	warped := NewWarp(baseNoise,
		WarpDistortionX(flowX),
		WarpDistortionY(flowX), // Using same for simplicity, or could offset.
		WarpScale(20.0),
	)

	// 3. Normal Map: Convert the heightmap to normals
	normals := NewNormalMap(warped, NormalMapStrength(4.0))

	// 4. Colorization: We can use the normal map directly (it looks cool/techy),
	// or we can try to render it. But the prompt asked for "normals + flow maps".
	// Usually water is rendered with reflection/refraction which needs a shader.
	// Here we can output the normal map as the representation of the water surface.
	// Or we can blend it with a blue tint to make it look like water.

	waterBlue := color.RGBA{0, 0, 100, 255}
	waterTint := NewRect(SetFillColor(waterBlue))

	// Blend normals with blue using Overlay or SoftLight
	// Overlay might be too harsh for normals.
	// Let's just return the normal map as it is the "texture" of water surface.
	// Or maybe "Multiply" the blue with the normal map to tint it.

	blended := NewBlend(normals, waterTint, BlendAverage)

	return blended
Water_surface Pattern

Water_surface Pattern

	// A variation showing just the normal map which is often what is used in game engines.
	baseNoise := NewNoise(
		NoiseSeed(42),
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:        42,
			Octaves:     5,
			Persistence: 0.6,
			Lacunarity:  2.0,
			Frequency:   0.04,
		}),
	)

	// Strong warp for "choppy" water
	distortion := NewNoise(
		NoiseSeed(100),
		SetNoiseAlgorithm(&PerlinNoise{Seed: 100, Frequency: 0.02}),
	)

	warped := NewWarp(baseNoise, WarpDistortion(distortion), WarpScale(30.0))

	return NewNormalMap(warped, NormalMapStrength(8.0))
WaveBorder Pattern

WaveBorder Pattern

	split := NewGeneric(func(x, y int) color.Color {
		if y > 75 {
			return color.RGBA{50, 100, 150, 255}
		}
		return color.Transparent
	})
	sine := NewGeneric(func(x, y int) color.Color {
		v := math.Sin(float64(x) * 0.1) * 10.0
		val := 128.0 + v
		return color.Gray{Y: uint8(val)}
	})
	warp := NewWarp(split,
		WarpDistortion(sine),
		WarpYScale(1.0),
		WarpXScale(0.0),
	)
	return warp
WindRidges Pattern

WindRidges Pattern

	img := GenerateWindRidges(image.Rect(0, 0, 200, 200))

	// Output:

	f, err := os.Create(WindRidgesOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, img); err != nil {
		panic(err)
	}
WindowsDither Pattern

WindowsDither Pattern

	img := NewGopher()
	// Spread 0 = auto calculate, or we can fine tune.
	// Standard Windows dithering often just used the nearest color after thresholding.
	// We use NewBayer8x8Dither for "Standard Ordered Dithering".
	return NewBayer8x8Dither(img, Windows16)
WindowsDither4x4 Pattern

WindowsDither4x4 Pattern

	img := NewGopher()
	return NewBayer4x4Dither(img, Windows16)
WindowsDitherHalftone Pattern

WindowsDitherHalftone Pattern

	img := NewGopher()
	return NewHalftoneDither(img, 8, Windows16)
Wood Pattern

Wood Pattern

	// 1. Wood Palette
	// Dark brown (Late wood / Rings) -> Light Tan (Early wood) -> Dark
	woodPalette := []ColorStop{
		{0.0, color.RGBA{101, 67, 33, 255}},  // Dark Brown (Ring Edge)
		{0.15, color.RGBA{160, 120, 80, 255}}, // Transition
		{0.5, color.RGBA{222, 184, 135, 255}}, // Light Tan (Center - Burlywood)
		{0.85, color.RGBA{160, 120, 80, 255}}, // Transition
		{1.0, color.RGBA{101, 67, 33, 255}},  // Back to Edge
	}

	// 2. Base "Heightmap" Generator
	// We create a grayscale gradient for rings (0-255).
	grayScale := make([]color.Color, 256)
	for i := range grayScale {
		grayScale[i] = color.Gray{Y: uint8(i)}
	}

	// Use ConcentricRings to generate the base distance field.
	// We want ~10 rings across the 256px width.
	// 256 colors in palette.
	// To get 1 cycle every 25 pixels: Freq = 256/25 ≈ 10.
	// To get elongated vertical rings, FreqY should be lower (slower change).
	ringsBase := NewConcentricRings(grayScale,
		SetCenter(128, -100), // Off-center top
		SetFrequencyX(8.0),   // ~30px width per ring
		SetFrequencyY(0.8),   // Stretched vertically (10x elongation)
	)

	// 3. Main Distortion (Growth Wobble)
	// Low frequency noise to warp the rings.
	// Noise values are 0..1 (from NewNoise/Perlin).
	// Warp maps intensity to offset.
	wobbleNoise := NewNoise(NoiseSeed(101), SetNoiseAlgorithm(&PerlinNoise{
		Frequency: 0.015,
		Octaves: 2,
	}))

	// Apply warp.
	// Scale 20.0 means max offset is +/- 20 pixels.
	// Since rings are ~30px wide, this distorts them significantly but keeps structure.
	warpedRings := NewWarp(ringsBase,
		WarpDistortion(wobbleNoise),
		WarpScale(20.0),
	)

	// 4. Fiber Grain (Fine Detail)
	// Add "Turbulence" to the warp using higher frequency noise.
	// This simulates the jagged edges of the grain.
	fiberDistortion := NewNoise(NoiseSeed(303), SetNoiseAlgorithm(&PerlinNoise{
		Frequency: 0.1, // Higher freq
		Octaves: 3,     // More detail
	}))

	// Chain Warps: WarpedRings -> Warp again with fiber distortion
	doubleWarped := NewWarp(warpedRings,
		WarpDistortion(fiberDistortion),
		WarpScale(2.0), // Small jaggedness (2 pixels)
	)

	// 5. Color Mapping
	// Map the grayscale intensity (warped distance) to the wood palette.
	finalWood := NewColorMap(doubleWarped, woodPalette...)

	return finalWood
WorleyNoise Pattern

WorleyNoise Pattern

	// Standard F1 Euclidean Worley Noise
	i := NewWorleyNoise(
		SetFrequency(0.05),
		SetSeed(1),
	)
	f, err := os.Create(WorleyNoiseOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
WorleyTiles Pattern

WorleyTiles Pattern

	baseTile := NewWorleyTiles(
		SetBounds(image.Rect(0, 0, 160, 160)),
		SetTileStoneSize(52),
		SetTileGapWidth(0.1),
		SetTilePaletteSpread(0.18),
		SetTilePalette(
			color.RGBA{128, 116, 106, 255},
			color.RGBA{146, 132, 118, 255},
			color.RGBA{112, 102, 96, 255},
		),
		WithSeed(2024),
	)

	// Tile the base stone field over a larger canvas so seams repeat cleanly.
	return NewTile(baseTile, image.Rect(0, 0, 320, 320))
Yliluoma1Dither Pattern

Yliluoma1Dither Pattern

	img := NewGopher()
	return NewYliluoma1Dither(img, Windows16, 8)
Yliluoma2Dither Pattern

Yliluoma2Dither Pattern

	img := NewGopher()
	return NewYliluoma2Dither(img, Windows16, 8)
Checker Pattern

Checker Pattern

	i := NewChecker(color.Black, color.White)
	f, err := os.Create(CheckerOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
Grid Pattern

Grid Pattern

	// Example 1: Simple 2x2 grid with Gophers
	// Shrink the Gopher so it fits better
	gopher := NewScale(NewGopher(), ScaleToRatio(0.25))

	args := []any{
		Row(Cell(gopher), Cell(gopher)),
		Row(Cell(gopher), Cell(gopher)),
	}
	for _, op := range ops {
		args = append(args, op)
	}

	// Create a grid with explicit Rows
	return NewGrid(args...)
GridUnbounded Pattern

GridUnbounded Pattern

	// 300x100 Grid
	// Col 0: Bounded (100x100)
	// Col 1: Unbounded (Should take remaining 200px)

	// bounded := NewChecker(color.Black, color.White) // Checkers default to 255x255 but here we want fixed?
	// Actually NewChecker returns default bounds.
	// Let's use NewCrop or just standard bounds behavior.
	// But `layout()` uses `image.Bounds()` if not `Bounded`.

	// Let's create a bounded Mock that is 100x100.
	hundred := 100
	zero := 0

	b := &boundedGopher{
		Image: NewScale(NewGopher(), ScaleToSize(100, 100)),
		bounds: Bounds{
			Left:   &Range{Low: &zero, High: &zero},
			Right:  &Range{Low: &hundred, High: &hundred},
			Top:    &Range{Low: &zero, High: &zero},
			Bottom: &Range{Low: &hundred, High: &hundred},
		},
	}

	// Unbounded pattern: e.g. a generic Tile or Checker that we want to fill space.
	// NewChecker returns 255x255.
	// Let's wrap it in an unbounded structure.
	u := &unboundedPattern{
		Image: NewChecker(color.RGBA{200, 0, 0, 255}, color.White),
	}

	args := []any{
		FixedSize(300, 100),
		Row(Cell(b), Cell(u)),
	}
	for _, op := range ops {
		args = append(args, op)
	}

	return NewGrid(args...)
Padding Pattern

Padding Pattern

	gopher := NewScale(NewGopher(), ScaleToRatio(0.5))
	// Padding with transparent background (nil)
	return NewPadding(gopher, PaddingMargin(20))
HorizontalLine Pattern

HorizontalLine Pattern

	i := NewHorizontalLine(
		SetLineSize(5),
		SetSpaceSize(5),
		SetLineColor(color.RGBA{255, 0, 0, 255}),
		SetSpaceColor(color.White),
	)
	f, err := os.Create(HorizontalLineOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
VerticalLine Pattern

VerticalLine Pattern

	i := NewVerticalLine(
		SetLineSize(5),
		SetSpaceSize(5),
		SetLineColor(color.RGBA{0, 0, 255, 255}),
		SetSpaceColor(color.White),
	)
	f, err := os.Create(VerticalLineOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
BooleanAnd Pattern

BooleanAnd Pattern

	// Gopher AND Horizontal Stripes
	g := NewGopher()
	// Line: Black (Alpha 1). Space: White (Alpha 1).
	h := NewHorizontalLine(SetLineSize(10), SetSpaceSize(10), SetLineColor(color.Black), SetSpaceColor(color.White))

	// Default uses component-wise min if no TrueColor/FalseColor set.
	i := NewAnd([]image.Image{g, h})

	f, err := os.Create(BooleanAndOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
Gopher Pattern

Gopher Pattern

	i := NewGopher()
	f, err := os.Create(GopherOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
MathsMandelbrot Pattern

MathsMandelbrot Pattern

	// See GenerateMathsMandelbrot for implementation details
Noise Pattern

Noise Pattern

	// Create a noise pattern with a seeded algorithm (Hash) for stability
	i := NewNoise(NoiseSeed(1))
	f, err := os.Create(NoiseOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
Rect Pattern

Rect Pattern

	// A simple black rectangle (default)
	i := NewRect()
	// Output:

	// Create the file for the example
	f, err := os.Create(RectOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
BooleanOr Pattern

BooleanOr Pattern

	g := NewGopher()
	v := NewVerticalLine(SetLineSize(10), SetSpaceSize(10), SetLineColor(color.Black), SetSpaceColor(color.White))

	// OR(Gopher, Stripes) -> Max(Gopher, Stripes)
	i := NewOr([]image.Image{g, v})

	f, err := os.Create(BooleanOrOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
MathsJulia Pattern

MathsJulia Pattern

	// See GenerateMathsJulia for implementation details
BooleanXor Pattern

BooleanXor Pattern

	g := NewGopher()
	v := NewVerticalLine(SetLineSize(20), SetSpaceSize(20), SetLineColor(color.Black))

	// XOR(Gopher, Stripes)
	i := NewXor([]image.Image{g, v}, SetTrueColor(color.RGBA{255, 255, 0, 255}), SetFalseColor(color.Transparent))

	f, err := os.Create(BooleanXorOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
MathsSine Pattern

MathsSine Pattern

	// See GenerateMathsSine for implementation details
BooleanNot Pattern

BooleanNot Pattern

	g := NewGopher()

	// Not Gopher.
	// Default component-wise: Invert colors.
	i := NewNot(g)

	f, err := os.Create(BooleanNotOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
MathsWaves Pattern

MathsWaves Pattern

	// See GenerateMathsWaves for implementation details
Circle Pattern

Circle Pattern

	// Create a simple circle
	c := NewCircle(SetLineColor(color.Black), SetSpaceColor(color.White))
	fmt.Printf("Circle bounds: %v\n", c.Bounds())
	// Output:
	// Circle bounds: (0,0)-(255,255)

	f, err := os.Create(CircleOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, c); err != nil {
		panic(err)
	}
Heatmap Pattern

Heatmap Pattern

	// See GenerateHeatmap for implementation details
ColorMap Pattern

ColorMap Pattern

	// 1. Create a Noise source (Perlin Noise with FBM)
	noise := NewNoise(
		NoiseSeed(42), // Fixed seed for reproducible documentation
		SetNoiseAlgorithm(&PerlinNoise{
			Seed:        42,
			Octaves:     4,
			Persistence: 0.5,
			Lacunarity:  2.0,
			Frequency:   0.1,
		}),
	)

	// 2. Map the noise to a "Grass" color ramp
	grass := NewColorMap(noise,
		ColorStop{Position: 0.0, Color: color.RGBA{0, 50, 0, 255}},     // Deep shadow green
		ColorStop{Position: 0.4, Color: color.RGBA{10, 100, 10, 255}},  // Mid green
		ColorStop{Position: 0.7, Color: color.RGBA{50, 150, 30, 255}},  // Light green
		ColorStop{Position: 1.0, Color: color.RGBA{100, 140, 60, 255}}, // Dried tip
	)

	f, err := os.Create(ColorMapOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, grass); err != nil {
		panic(err)
	}
Fibonacci Pattern

Fibonacci Pattern

	// Create a simple Fibonacci spiral
	c := NewFibonacci(SetLineColor(color.Black), SetSpaceColor(color.White))
	fmt.Printf("Fibonacci bounds: %v\n", c.Bounds())
	// Output:
	// Fibonacci bounds: (0,0)-(255,255)

	f, err := os.Create(FibonacciOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, c); err != nil {
		panic(err)
	}
SpeedLines Pattern

SpeedLines Pattern

	i := NewSpeedLines(
		SetDensity(150),
		SetMinRadius(30),
		SetMaxRadius(80),
	)
	f, err := os.Create(SpeedLinesOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
LinearGradient Pattern

LinearGradient Pattern

	// Linear Gradient (Horizontal)
	NewLinearGradient(
		SetStartColor(color.RGBA{255, 0, 0, 255}),
		SetEndColor(color.RGBA{0, 0, 255, 255}),
	)
Quantize Pattern

Quantize Pattern

	i := NewQuantize(NewGopher(), 4)
	f, err := os.Create(QuantizeOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
SimpleZoom Pattern

SimpleZoom Pattern

	i := NewSimpleZoom(NewChecker(color.Black, color.White), 2)
	f, err := os.Create(SimpleZoomOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
XorGrid Pattern

XorGrid Pattern

	p := NewXorPattern()
	f, err := os.Create(XorGridOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err := png.Encode(f, p); err != nil {
		panic(err)
	}
Bayer2x2Dither Pattern

Bayer2x2Dither Pattern

	// Black and White Palette
	palette := []color.Color{color.Black, color.White}
	i := NewBayer2x2Dither(NewGopher(), palette)

	f, err := os.Create(Bayer2x2DitherOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
ModuloStripe Pattern

ModuloStripe Pattern

	p := NewModuloStripe([]color.Color{
		color.RGBA{255, 0, 0, 255},
		color.RGBA{0, 255, 0, 255},
		color.RGBA{0, 0, 255, 255},
	})
	f, err := os.Create(ModuloStripeOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err := png.Encode(f, p); err != nil {
		panic(err)
	}
RadialGradient Pattern

RadialGradient Pattern

	// Radial Gradient
	NewRadialGradient(
		SetStartColor(color.RGBA{255, 0, 0, 255}),
		SetEndColor(color.RGBA{0, 0, 255, 255}),
	)
Transposed Pattern

Transposed Pattern

	i := NewTransposed(NewDemoNull(), 10, 10)
	f, err := os.Create(TransposedOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
ConcentricRings Pattern

ConcentricRings Pattern

	p := NewConcentricRings([]color.Color{
		color.Black,
		color.White,
		color.RGBA{255, 0, 0, 255},
	})
	f, err := os.Create(ConcentricRingsOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err := png.Encode(f, p); err != nil {
		panic(err)
	}
ConicGradient Pattern

ConicGradient Pattern

	// Conic Gradient
	NewConicGradient(
		SetStartColor(color.RGBA{255, 0, 255, 255}),
		SetEndColor(color.RGBA{0, 255, 255, 255}),
	)
Mirror Pattern

Mirror Pattern

	i := NewMirror(NewDemoMirrorInput(image.Rect(0, 0, 40, 40)), true, false)
	f, err := os.Create(MirrorOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
Plasma Pattern

Plasma Pattern

	p := NewPlasma()
	f, err := os.Create(PlasmaOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err := png.Encode(f, p); err != nil {
		panic(err)
	}
Rotate Pattern

Rotate Pattern

	i := NewRotate(NewDemoRotateInput(image.Rect(0, 0, 40, 60)), 90)
	f, err := os.Create(RotateOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
BayerDither Pattern

BayerDither Pattern

	grad := NewLinearGradient(
		SetStartColor(color.Black),
		SetEndColor(color.White),
	)
	p := NewBayerDither(grad, 4)
	f, err := os.Create(BayerDitherOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err := png.Encode(f, p); err != nil {
		panic(err)
	}
BlueNoise Pattern

BlueNoise Pattern

	p := NewBlueNoise()
	f, err := os.Create(BlueNoiseOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err := png.Encode(f, p); err != nil {
		panic(err)
	}
GradientQuantization Pattern

GradientQuantization Pattern

	grad := NewLinearGradient(
		SetStartColor(color.Black),
		SetEndColor(color.White),
	)
	p := NewQuantize(grad, 4)
	f, err := os.Create(GradientQuantizationOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err := png.Encode(f, p); err != nil {
		panic(err)
	}
BitwiseAnd Pattern

BitwiseAnd Pattern

	h := NewHorizontalLine(SetLineSize(50), SetSpaceSize(50), SetLineColor(color.RGBA{255, 0, 0, 255}))
	v := NewVerticalLine(SetLineSize(50), SetSpaceSize(50), SetLineColor(color.RGBA{0, 255, 0, 255}))
	p := NewBitwiseAnd([]image.Image{h, v})
	f, err := os.Create(BitwiseAndOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	if err := png.Encode(f, p); err != nil {
		panic(err)
	}
BooleanModes Pattern

BooleanModes Pattern

	// See GenerateBooleanModes for actual implementation.
SierpinskiTriangle Pattern

SierpinskiTriangle Pattern

	// See GenerateSierpinskiTriangle for implementation details
VHS Pattern

VHS Pattern

	// See GenerateVHS for implementation details
SierpinskiCarpet Pattern

SierpinskiCarpet Pattern

	// See GenerateSierpinskiCarpet for implementation details
SubpixelLines Pattern

SubpixelLines Pattern

	i := NewSubpixelLines(
		SetLineThickness(2),
		SetOffsetStrength(0.65),
		SetVignetteRadius(0.82),
	)
	f, err := os.Create(SubpixelLinesOutputFilename)
	if err != nil {
		panic(err)
	}
	defer f.Close()
	err = png.Encode(f, i)
	if err != nil {
		panic(err)
	}
Buffer Pattern

Buffer Pattern

	// 1. Create a source pattern
	source := NewSolid(color.RGBA{255, 0, 0, 255})
	// 2. Create a buffer
	b := NewBuffer(source, SetExpiry(10*time.Second))
	// 3. Refresh the buffer explicitly to populate the cache
	b.Refresh()

	// Output:

	// Create the file for the example
	f, err := os.Create(BufferOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, b); err != nil {
		panic(err)
	}
EdgeDetect Pattern

EdgeDetect Pattern

	i := NewDemoEdgeDetect()
	f, err := os.Create(EdgeDetectOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
ErrorDiffusion Pattern

ErrorDiffusion Pattern

	// Standard example
	i := NewDemoErrorDiffusion()
	f, err := os.Create(ErrorDiffusionOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
OrderedDither Pattern

OrderedDither Pattern

	i := NewDemoOrderedDither()
	f, err := os.Create(OrderedDitherOutputFilename)
	if err != nil {
		panic(err)
	}
	defer func() {
		if e := f.Close(); e != nil {
			panic(e)
		}
	}()
	if err = png.Encode(f, i); err != nil {
		panic(err)
	}
DitherStages Pattern

DitherStages Pattern

	// Default view: Bayer 8x8 on a gradient
	return NewBayer8x8Dither(NewLinearGradient(), nil)
DitherColorReduction Pattern

DitherColorReduction Pattern

	return NewBayer8x8Dither(NewGopher(), PaletteCGA)
Fog Pattern

Fog Pattern

	return NewFog(
		SetDensity(0.85),
		SetFalloffCurve(1.8),
		SetFillColor(color.RGBA{185, 205, 230, 255}),
	)
ConcentricWater Pattern

ConcentricWater Pattern

	return NewConcentricWater(
		ConcentricWaterRingSpacing(14.0),
		ConcentricWaterAmplitude(1.1),
		ConcentricWaterAmplitudeFalloff(0.018),
		ConcentricWaterBaseTint(color.RGBA{24, 104, 168, 255}),
		ConcentricWaterNormalStrength(4.0),
	)

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

Documentation

Index

Constants

View Source
const (
	// Phi is the Golden Ratio.
	Phi = 1.618033988749895
	// GoldenSpiralB is the growth factor for the Golden Spiral (2 * ln(Phi) / pi).
	GoldenSpiralB = 0.30634896253
)
View Source
const (
	GridOrder     = 5
	GridBaseLabel = "Grid"
)
View Source
const (
	GridUnboundedOrder     = 7
	GridUnboundedBaseLabel = "Unbounded"
)
View Source
const (
	PaddingOrder     = 8
	PaddingBaseLabel = "Padding"
)
View Source
const Bayer2x2DitherBaseLabel = "Bayer2x2Dither"
View Source
const Bayer2x2DitherOrder = 31
View Source
const BayerDitherOrder = 34
View Source
const BitwiseAndOrder = 37
View Source
const BlueNoiseOrder = 35
View Source
const BooleanAndOrder = 20
View Source
const BooleanModesOrder = 38
View Source
const BooleanNotOrder = 23
View Source
const BooleanOrOrder = 21
View Source
const BooleanXorOrder = 22
View Source
const BufferOrder = 100
View Source
const CamouflageBaseLabel = "Camouflage"
View Source
const CandyBaseLabel = "Candy"
View Source
const CellsBaseLabel = "Cells"
View Source
const CheckerOrder = 1
View Source
const CircleBaseLabel = "Circle"
View Source
const CircleOrder = 24
View Source
const ColorMapBaseLabel = "Grass"

Base label for the main example

View Source
const ColorMapOrder = 25
View Source
const ConcentricRingsOrder = 32
View Source
const ConcentricWaterOrder = 370
View Source
const ConicGradientOrder = 32
View Source
const CrackedMudBaseLabel = "CrackedMud"
View Source
const DamascusBaseLabel = "Damascus"
View Source
const DitherColorReductionOrder = 104
View Source
const DitherStagesOrder = 103
View Source
const EdgeDetectOrder = 100 // Arbitrary order
View Source
const ErrorDiffusionOrder = 101 // Arbitrary order
View Source
const FibonacciBaseLabel = "Fibonacci"
View Source
const FibonacciOrder = 25 // Adjust as needed to fit in the list
View Source
const FineGridBaseLabel = "FineGrid"
View Source
const FogOrder = 105
View Source
const GlobeBaseLabel = "Globe"
View Source
const GlyphRingBaseLabel = "GlyphRing"
View Source
const GopherBaseLabel = "Gopher"
View Source
const GopherOrder = 20
View Source
const GradientQuantizationOrder = 36
View Source
const GrassBaseLabel = "Grass"
View Source
const GrassCloseBaseLabel = "Grass Close"
View Source
const HeatmapOrder = 24
View Source
const HexGridBaseLabel = "HexGrid"
View Source
const HorizontalLineOrder = 10
View Source
const IslandsBaseLabel = "Islands"
View Source
const LavaBaseLabel = "Lava"
View Source
const LinearGradientBaseLabel = "Horizontal"
View Source
const LinearGradientOrder = 30
View Source
const MathsJuliaOrder = 21
View Source
const MathsMandelbrotOrder = 20
View Source
const MathsSineOrder = 22
View Source
const MathsWavesOrder = 23
View Source
const MirrorBaseLabel = "Grid"
View Source
const MirrorOrder = 32
View Source
const ModuloStripeOrder = 31
View Source
const MoleculesBaseLabel = "Molecules"
View Source
const MudTracksBaseLabel = "MudTracks"
View Source
const NoiseOrder = 20
View Source
const NullOrder = 0
View Source
const OrderedDitherOrder = 102 // Arbitrary order
View Source
const PebblesBaseLabel = "Pebbles"
View Source
const PlasmaOrder = 33
View Source
const QuantizeBaseLabel = "Quantize"
View Source
const QuantizeOrder = 30
View Source
const RadialGradientOrder = 31
View Source
const RectOrder = 20
View Source
const RotateBaseLabel = "Grid"
View Source
const RotateOrder = 33
View Source
const ScalesBaseLabel = "Scales"
View Source
const ShojoBaseLabel = "Shojo"
View Source
const Shojo_blueBaseLabel = "Blue Variant"
View Source
const Shojo_pinkBaseLabel = "Pink Variant"
View Source
const SierpinskiCarpetOrder = 41
View Source
const SierpinskiTriangleOrder = 40
View Source
const SimpleZoomOrder = 30
View Source
const SpeedLinesBaseLabel = "SpeedLines"
View Source
const SpeedLinesOrder = 25
View Source
const StarfieldBaseLabel = "Starfield"
View Source
const StonesBaseLabel = "Stones"
View Source
const SubpixelLinesOrder = 41
View Source
const TransposedOrder = 31
View Source
const VHSOrder = 40 // Adjust order as needed
View Source
const VerticalLineOrder = 11
View Source
const VoronoiBaseLabel = "Voronoi"
View Source
const VoronoiTilesBaseLabel = "Voronoi_tiles"
View Source
const WindRidgesBaseLabel = "WindRidges"
View Source
const WorleyNoiseBaseLabel = "WorleyNoise"
View Source
const XorGridOrder = 30

Variables

View Source
var (
	BrickOutputFilename = "brick.png"
	BrickZoomLevels     = []int{}
	BrickBaseLabel      = "Brick"
	BrickOrder          = 20
)
View Source
var (
	Brick_texturesOutputFilename = "brick_textures.png"
	Brick_texturesZoomLevels     = []int{}
	Brick_texturesBaseLabel      = "Brick Textures"
)
View Source
var (
	Brick_stoneOutputFilename = "brick_stone.png"
	Brick_stoneZoomLevels     = []int{}
	Brick_stoneBaseLabel      = "Stone Wall"
)
View Source
var (
	ChippedBrickOutputFilename = "chipped_brick.png"
	ChippedBrickZoomLevels     = []int{}
	ChippedBrickBaseLabel      = "ChippedBrick"
)
View Source
var (
	CloudsOutputFilename = "clouds.png"
	CloudsZoomLevels     = []int{}
	CloudsBaseLabel      = "Clouds"
)

Main Clouds Example

View Source
var (
	Clouds_cumulusOutputFilename = "clouds_cumulus.png"
	Clouds_cumulusZoomLevels     = []int{}
	Clouds_cumulusBaseLabel      = "Cumulus"
)
View Source
var (
	Clouds_cirrusOutputFilename = "clouds_cirrus.png"
	Clouds_cirrusZoomLevels     = []int{}
	Clouds_cirrusBaseLabel      = "Cirrus"
)
View Source
var (
	Clouds_stormOutputFilename = "clouds_storm.png"
	Clouds_stormZoomLevels     = []int{}
	Clouds_stormBaseLabel      = "Storm"
)
View Source
var (
	Clouds_sunsetOutputFilename = "clouds_sunset.png"
	Clouds_sunsetZoomLevels     = []int{}
	Clouds_sunsetBaseLabel      = "Sunset"
)
View Source
var (
	// CrossHatchZoomLevels defines the zoom levels for the CrossHatch pattern documentation.
	CrossHatchZoomLevels = []int{}

	// CrossHatchOutputFilename defines the output filename for the CrossHatch pattern image.
	CrossHatchOutputFilename = "crosshatch.png"

	// CrossHatchBaseLabel defines the base label for the CrossHatch pattern.
	CrossHatchBaseLabel = "CrossHatch"
)
View Source
var (
	DirtOutputFilename     = "dirt.png"
	Dirt_mudOutputFilename = "dirt_mud.png"
)
View Source
var (
	// FloydSteinberg is the classic error diffusion kernel (7, 3, 5, 1) / 16.
	FloydSteinberg = DiffusionKernel{
		Items: []DiffusionItem{
			{1, 0, 7},
			{-1, 1, 3},
			{0, 1, 5},
			{1, 1, 1},
		},
		Divisor: 16,
	}

	// JarvisJudiceNinke is a larger kernel (5x3) for smoother gradients.
	JarvisJudiceNinke = DiffusionKernel{
		Items: []DiffusionItem{
			{1, 0, 7}, {2, 0, 5},
			{-2, 1, 3}, {-1, 1, 5}, {0, 1, 7}, {1, 1, 5}, {2, 1, 3},
			{-2, 2, 1}, {-1, 2, 3}, {0, 2, 5}, {1, 2, 3}, {2, 2, 1},
		},
		Divisor: 48,
	}

	// Stucki is similar to Jarvis but with different weights for sharper edges.
	Stucki = DiffusionKernel{
		Items: []DiffusionItem{
			{1, 0, 8}, {2, 0, 4},
			{-2, 1, 2}, {-1, 1, 4}, {0, 1, 8}, {1, 1, 4}, {2, 1, 2},
			{-2, 2, 1}, {-1, 2, 2}, {0, 2, 4}, {1, 2, 2}, {2, 2, 1},
		},
		Divisor: 42,
	}

	// Atkinson is a 3x2 kernel designed for small icons.
	Atkinson = DiffusionKernel{
		Items: []DiffusionItem{
			{1, 0, 1}, {2, 0, 1},
			{-1, 1, 1}, {0, 1, 1}, {1, 1, 1},
			{0, 2, 1},
		},
		Divisor: 8,
	}

	// Burkes is an efficient 5x2 kernel.
	Burkes = DiffusionKernel{
		Items: []DiffusionItem{
			{1, 0, 8}, {2, 0, 4},
			{-2, 1, 2}, {-1, 1, 4}, {0, 1, 8}, {1, 1, 4}, {2, 1, 2},
		},
		Divisor: 32,
	}

	// SierraLite is a compact 3x2 kernel.
	SierraLite = DiffusionKernel{
		Items: []DiffusionItem{
			{1, 0, 2},
			{-1, 1, 1}, {0, 1, 1},
		},
		Divisor: 4,
	}

	// Sierra2 (Two-row Sierra) is a balanced 5x2 kernel.
	Sierra2 = DiffusionKernel{
		Items: []DiffusionItem{
			{1, 0, 4}, {2, 0, 3},
			{-2, 1, 1}, {-1, 1, 2}, {0, 1, 3}, {1, 1, 2}, {2, 1, 1},
		},
		Divisor: 16,
	}

	// Sierra3 (Full Sierra) is a 5x3 kernel.
	Sierra3 = DiffusionKernel{
		Items: []DiffusionItem{
			{1, 0, 5}, {2, 0, 3},
			{-2, 1, 2}, {-1, 1, 4}, {0, 1, 5}, {1, 1, 4}, {2, 1, 2},
			{-1, 2, 2}, {0, 2, 3}, {1, 2, 2},
		},
		Divisor: 32,
	}

	// StevensonArce diffuses error in a dispersed pattern.
	StevensonArce = DiffusionKernel{
		Items: []DiffusionItem{
			{2, 0, 32},
			{-3, 1, 12}, {-1, 1, 26}, {1, 1, 30},
			{-1, 2, 16}, {1, 2, 12},
		},
		Divisor: 128,
	}
)

Predefined kernels.

View Source
var (
	FineGridOutputFilename = "fine_grid.png"
	FineGridZoomLevels     = []int{}
)
View Source
var (
	FloorOutputFilename      = "floor.png"
	Floor_woodOutputFilename = "floor_wood.png"
)
View Source
var (
	FogOutputFilename = "fog.png"
	FogZoomLevels     = []int{}
	FogBaseLabel      = "Fog"
)
View Source
var (
	GlobeOutputFilename           = "globe.png"
	Globe_SimpleOutputFilename    = "globe_simple.png"
	Globe_ProjectedOutputFilename = "globe_projected.png"
	Globe_GridOutputFilename      = "globe_grid.png"
)
View Source
var (
	GlyphRingOutputFilename = "glyph_ring.png"
	GlyphRingZoomLevels     = []int{}
	GlyphRingOrder          = 101
)
View Source
var (
	GridOutputFilename = "grid.png"
	GridZoomLevels     = []int{}
)
View Source
var (
	GridUnboundedOutputFilename = "grid_unbounded.png"
	GridUnboundedZoomLevels     = []int{}
)
View Source
var (
	AmbientOcclusionOutputFilename = "ambient_occlusion.png"
	CurvatureOutputFilename        = "curvature.png"
)
View Source
var (
	MetalOutputFilename           = "metal.png"
	Metal_scratchedOutputFilename = "metal_scratched.png"
)
View Source
var (
	NormalMapOutputFilename        = "normal_map.png"
	NormalMap_sphereOutputFilename = "normal_map_sphere.png"
)
View Source
var (
	PaddingOutputFilename = "padding.png"
	PaddingZoomLevels     = []int{2}
)
View Source
var (
	PaintedPlanksOutputFilename = "painted_planks.png"
	PaintedPlanksZoomLevels     = []int{}
	PaintedPlanksBaseLabel      = "PaintedPlanks"
)
View Source
var (
	DungeonOutputFilename       = "dungeon.png"
	IceOutputFilename           = "ice.png"
	CircuitOutputFilename       = "circuit.png"
	FenceOutputFilename         = "fence.png"
	StripeOutputFilename        = "stripe.png"
	AbstractArtOutputFilename   = "abstract_art.png" // Renamed from Crystal
	PixelCamoOutputFilename     = "pixel_camo.png"
	CheckerBorderOutputFilename = "checker_border.png"
	WaveBorderOutputFilename    = "wave_border.png"
	CarpetOutputFilename        = "carpet.png"
	PersianRugOutputFilename    = "persian_rug.png"
	LavaFlowOutputFilename      = "lava_flow.png"
	MetalPlateOutputFilename    = "metal_plate.png"
	FantasyFrameOutputFilename  = "fantasy_frame.png"
)
View Source
var (
	GlobalGenerators = make(map[string]func(image.Rectangle) image.Image)
	GlobalReferences = make(map[string]func() (map[string]func(image.Rectangle) image.Image, []string))
)
View Source
var (
	RoadOutputFilename         = "road.png"
	Road_markedOutputFilename  = "road_marked.png"
	Road_terrainOutputFilename = "road_terrain.png"
)
View Source
var (
	SandOutputFilename        = "sand.png"
	Sand_dunesOutputFilename  = "sand_dunes.png"
	Sand_zoomedOutputFilename = "sand_zoomed.png"
)
View Source
var (
	ShojoOutputFilename = "shojo.png"
	ShojoZoomLevels     = []int{}
	ShojoOrder          = 25
)
View Source
var (
	Shojo_pinkOutputFilename = "shojo_pink.png"
	Shojo_pinkZoomLevels     = []int{}
	Shojo_pinkOrder          = 26
)
View Source
var (
	Shojo_blueOutputFilename = "shojo_blue.png"
	Shojo_blueZoomLevels     = []int{}
	Shojo_blueOrder          = 27
)
View Source
var (
	SnowOutputFilename        = "snow.png"
	Snow_tracksOutputFilename = "snow_tracks.png"
)
View Source
var (
	StoneOutputFilename        = "stone.png"
	Stone_cobbleOutputFilename = "stone_cobble.png"
)
View Source
var (
	ThreadBandsOutputFilename = "thread_bands.png"
	ThreadBandsZoomLevels     = []int{}
	ThreadBandsBaseLabel      = "ThreadBands"
)
View Source
var (
	TileOutputFilename = "tile.png"
	TileZoomLevels     = []int{}
	TileOrder          = 6
	TileBaseLabel      = "Tiled"
)
View Source
var (
	WorleyTilesOutputFilename = "tile_worley.png"
	WorleyTilesZoomLevels     = []int{}
	WorleyTilesBaseLabel      = "WorleyTiles"
)
View Source
var (
	WarpOutputFilename = "warp.png"
	WarpZoomLevels     = []int{}
	WarpBaseLabel      = "Warp"
)

Main Warp Example Variables defined here to ensure findStringVar finds them easily.

View Source
var (
	Warp_woodOutputFilename = "warp_wood.png"
	Warp_woodZoomLevels     = []int{}
	Warp_woodBaseLabel      = "Wood"
)
View Source
var (
	Warp_marbleOutputFilename = "warp_marble.png"
	Warp_marbleZoomLevels     = []int{}
	Warp_marbleBaseLabel      = "Marble"
)
View Source
var (
	Warp_cloudsOutputFilename = "warp_clouds.png"
	Warp_cloudsZoomLevels     = []int{}
	Warp_cloudsBaseLabel      = "Clouds"
)
View Source
var (
	Warp_terrainOutputFilename = "warp_terrain.png"
	Warp_terrainZoomLevels     = []int{}
	Warp_terrainBaseLabel      = "Terrain"
)
View Source
var (
	WaterOutputFilename         = "water.png"
	Water_surfaceOutputFilename = "water_surface.png"
)
View Source
var (
	WoodOutputFilename = "wood.png"
	WoodZoomLevels     = []int{} // No zoom needed for texture
	WoodBaseLabel      = "Wood"
)
View Source
var Bayer2x2 = generateBayer(2)

Bayer2x2 Matrix

View Source
var Bayer2x2DitherOutputFilename = "bayer2x2.png"
View Source
var Bayer2x2DitherZoomLevels = []int{}
View Source
var Bayer4x4 = generateBayer(4)

Bayer4x4 Matrix

View Source
var Bayer8x8 = generateBayer(8)

Bayer8x8 Matrix

View Source
var BayerDitherOutputFilename = "bayer_dither.png"
View Source
var BayerDitherZoomLevels = []int{}
View Source
var BitwiseAndOutputFilename = "bitwise_and.png"
View Source
var BitwiseAndZoomLevels = []int{}
View Source
var BlueNoiseOutputFilename = "bluenoise.png"
View Source
var BlueNoiseZoomLevels = []int{}
View Source
var BooleanAndOutputFilename = "boolean_and.png"
View Source
var BooleanAndZoomLevels = []int{}
View Source
var BooleanModesOutputFilename = "boolean_modes.png"
View Source
var BooleanModesZoomLevels = []int{}
View Source
var BooleanNotOutputFilename = "boolean_not.png"
View Source
var BooleanNotZoomLevels = []int{}
View Source
var BooleanOrOutputFilename = "boolean_or.png"
View Source
var BooleanOrZoomLevels = []int{}
View Source
var BooleanXorOutputFilename = "boolean_xor.png"
View Source
var BooleanXorZoomLevels = []int{}
View Source
var BufferOutputFilename = "buffer.png"
View Source
var BufferZoomLevels = []int{}
View Source
var CamouflageOutputFilename = "camouflage.png"
View Source
var CandyOutputFilename = "candy.png"
View Source
var CellsOutputFilename = "cells.png"
View Source
var CheckerOutputFilename = "checker.png"
View Source
var CheckerZoomLevels = []int{2, 4}
View Source
var ChunkyBandsOutputFilename = "chunky_bands.png"
View Source
var CircleOutputFilename = "circle.png"
View Source
var CircleZoomLevels = []int{}
View Source
var ColorMapOutputFilename = "colormap.png"
View Source
var ColorMapZoomLevels = []int{}
View Source
var ConcentricRingsOutputFilename = "concentric_rings.png"
View Source
var ConcentricRingsZoomLevels = []int{}
View Source
var ConcentricWaterOutputFilename = "concentric_water.png"
View Source
var ConcentricWaterZoomLevels = []int{}
View Source
var ConicGradientOutputFilename = "conic_gradient.png"
View Source
var ConicGradientZoomLevels = []int{}
View Source
var CrackedMudOutputFilename = "cracked_mud.png"
View Source
var DamascusOutputFilename = "damascus.png"
View Source
var DitherColorReductionOutputFilename = "dither_color_reduction.png"
View Source
var DitherColorReductionZoomLevels = []int{}
View Source
var DitherStagesOutputFilename = "dither_stages.png"

DitherStagesOutputFilename defines the output filename for the stages example.

View Source
var DitherStagesZoomLevels = []int{}
View Source
var EdgeDetectOutputFilename = "edgedetect.png"
View Source
var EdgeDetectZoomLevels = []int{} // No zoom levels by default for now, or maybe 1?
View Source
var ErrorDiffusionOutputFilename = "dither_errordiffusion.png"
View Source
var ErrorDiffusionZoomLevels = []int{}
View Source
var FibonacciOutputFilename = "fibonacci.png"
View Source
var FibonacciZoomLevels = []int{}
View Source
var GopherOutputFilename = "gopher.png"
View Source
var GopherZoomLevels = []int{}
View Source
var GradientQuantizationOutputFilename = "gradient_quantize.png"
View Source
var GradientQuantizationZoomLevels = []int{}
View Source
var GrassCloseOutputFilename = "grass_close.png"
View Source
var GrassCloseZoomLevels = []int{}
View Source
var GrassOutputFilename = "grass.png"
View Source
var HeatmapOutputFilename = "heatmap.png"
View Source
var HeatmapZoomLevels = []int{}
View Source
var HexGridOutputFilename = "hex_grid.png"
View Source
var HorizontalLineOutputFilename = "horizontal_line.png"
View Source
var HorizontalLineZoomLevels = []int{} // Disabled as per feedback
View Source
var IslandsOutputFilename = "islands.png"
View Source
var KnollDitherOutputFilename = "dither_knoll.png"
View Source
var KnollDitherZoomLevels = []int{}
View Source
var LavaOutputFilename = "lava.png"
View Source
var LinearGradientOutputFilename = "linear_gradient.png"
View Source
var LinearGradientZoomLevels = []int{}
View Source
var MathsJuliaOutputFilename = "maths_julia.png"
View Source
var MathsJuliaZoomLevels = []int{}
View Source
var MathsMandelbrotOutputFilename = "maths_mandelbrot.png"
View Source
var MathsMandelbrotZoomLevels = []int{}
View Source
var MathsSineOutputFilename = "maths_sine.png"
View Source
var MathsSineZoomLevels = []int{}
View Source
var MathsWavesOutputFilename = "maths_waves.png"
View Source
var MathsWavesZoomLevels = []int{}
View Source
var MirrorOutputFilename = "mirror.png"
View Source
var MirrorZoomLevels = []int{}
View Source
var ModuloStripeOutputFilename = "modulo_stripe.png"
View Source
var ModuloStripeZoomLevels = []int{}
View Source
var MoleculesOutputFilename = "molecules.png"
View Source
var MudTracksOutputFilename = "mud_tracks.png"
View Source
var NoiseOutputFilename = "noise.png"
View Source
var NoiseZoomLevels = []int{} // Zooming is unnecessary for noise
View Source
var NullOutputFilename = "null.png"
View Source
var NullZoomLevels = []int{}
View Source
var OrderedDitherOutputFilename = "dither_ordered.png"
View Source
var OrderedDitherZoomLevels = []int{}
View Source
var PCBTracesOutputFilename = "pcbtraces.png"

PCBTracesOutputFilename is the default output filename for the PCBTraces pattern.

View Source
var PCBTracesZoomLevels = []int{}

PCBTracesZoomLevels is the default zoom levels for the PCBTraces pattern.

View Source
var PaletteCGA = color.Palette{
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0xff, 0x55, 0xff, 0xff},
	color.RGBA{0x55, 0xff, 0xff, 0xff},
	color.RGBA{0xff, 0xff, 0xff, 0xff},
}

PaletteCGA is the CGA Palette 1 High Intensity

View Source
var PebblesOutputFilename = "pebbles.png"
View Source
var PlasmaOutputFilename = "plasma.png"
View Source
var PlasmaZoomLevels = []int{}
View Source
var PolkaOutputFilename = "polka.png"
View Source
var QuantizeOutputFilename = "quantize.png"
View Source
var QuantizeZoomLevels = []int{}
View Source
var RadialGradientOutputFilename = "radial_gradient.png"
View Source
var RadialGradientZoomLevels = []int{}
View Source
var RectOutputFilename = "rect.png"
View Source
var RectZoomLevels = []int{}
View Source
var RotateOutputFilename = "rotate.png"
View Source
var RotateZoomLevels = []int{}
View Source
var ScalesOutputFilename = "scales.png"
View Source
var ScreenToneOutputFilename = "screentone.png"
View Source
var SierpinskiCarpetOutputFilename = "sierpinski_carpet.png"
View Source
var SierpinskiCarpetZoomLevels = []int{}
View Source
var SierpinskiTriangleOutputFilename = "sierpinski_triangle.png"
View Source
var SierpinskiTriangleZoomLevels = []int{}
View Source
var SimpleZoomOutputFilename = "simplezoom.png"
View Source
var SimpleZoomZoomLevels = []int{2, 4}
View Source
var (
	SlateOutputFilename = "slate.png"
)
View Source
var SpeedLinesOutputFilename = "speedlines.png"
View Source
var SpeedLinesZoomLevels = []int{}
View Source
var StarfieldOutputFilename = "starfield.png"
View Source
var StonesOutputFilename = "stones.png"
View Source
var SubpixelLinesOutputFilename = "subpixel_lines.png"
View Source
var SubpixelLinesZoomLevels = []int{}
View Source
var TransposedOutputFilename = "transposed.png"
View Source
var TransposedZoomLevels = []int{2, 4}
View Source
var VHSOutputFilename = "vhs.png"
View Source
var VHSZoomLevels = []int{}
View Source
var VerticalLineOutputFilename = "vertical_line.png"
View Source
var VerticalLineZoomLevels = []int{}
View Source
var VoronoiOutputFilename = "voronoi.png"
View Source
var VoronoiTilesOutputFilename = "voronoi_tiles.png"
View Source
var VoronoiTilesZoomLevels = []int{}
View Source
var VoronoiZoomLevels = []int{}
View Source
var WindRidgesOutputFilename = "wind.png"
View Source
var Windows16 = color.Palette{
	color.RGBA{0x00, 0x00, 0x00, 0xff},
	color.RGBA{0x80, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0x80, 0x00, 0xff},
	color.RGBA{0x80, 0x80, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0x80, 0xff},
	color.RGBA{0x80, 0x00, 0x80, 0xff},
	color.RGBA{0x00, 0x80, 0x80, 0xff},
	color.RGBA{0xc0, 0xc0, 0xc0, 0xff},
	color.RGBA{0x80, 0x80, 0x80, 0xff},
	color.RGBA{0xff, 0x00, 0x00, 0xff},
	color.RGBA{0x00, 0xff, 0x00, 0xff},
	color.RGBA{0xff, 0xff, 0x00, 0xff},
	color.RGBA{0x00, 0x00, 0xff, 0xff},
	color.RGBA{0xff, 0x00, 0xff, 0xff},
	color.RGBA{0x00, 0xff, 0xff, 0xff},
	color.RGBA{0xff, 0xff, 0xff, 0xff},
}
View Source
var WindowsDither4x4OutputFilename = "dither_windows_4x4.png"
View Source
var WindowsDither4x4ZoomLevels = []int{}
View Source
var WindowsDitherHalftoneOutputFilename = "dither_windows_halftone.png"
View Source
var WindowsDitherHalftoneZoomLevels = []int{}
View Source
var WindowsDitherOutputFilename = "dither_windows.png"
View Source
var WindowsDitherZoomLevels = []int{}
View Source
var WorleyNoiseOutputFilename = "worley.png"
View Source
var WorleyNoiseZoomLevels = []int{}
View Source
var XorGridOutputFilename = "xor_pattern.png"
View Source
var XorGridZoomLevels = []int{}
View Source
var Yliluoma1DitherOutputFilename = "dither_yliluoma1.png"
View Source
var Yliluoma1DitherZoomLevels = []int{}
View Source
var Yliluoma2DitherOutputFilename = "dither_yliluoma2.png"
View Source
var Yliluoma2DitherZoomLevels = []int{}

Functions

func AOFromHeight added in v0.0.6

func AOFromHeight(source image.Image, radius int) image.Image

AOFromHeight is a utility function that wraps NewAmbientOcclusion to creates an ambient occlusion map from a height map with the given radius.

func AmbientOcclusionRadius added in v0.0.6

func AmbientOcclusionRadius(radius int) func(any)

func BootstrapGridReferences added in v0.0.2

func BootstrapGridReferences() (map[string]func(image.Rectangle) image.Image, []string)

func BootstrapGridUnboundedReferences added in v0.0.2

func BootstrapGridUnboundedReferences() (map[string]func(image.Rectangle) image.Image, []string)

func BootstrapPaddingReferences added in v0.0.2

func BootstrapPaddingReferences() (map[string]func(image.Rectangle) image.Image, []string)

func BootstrapTileReferences added in v0.0.2

func BootstrapTileReferences() (map[string]func(image.Rectangle) image.Image, []string)

func Cell added in v0.0.2

func Cell(content any) any

func CellPos added in v0.0.2

func CellPos(x, y int, content any) any

func Column added in v0.0.2

func Column(cells ...any) any

func ConcentricWaterAmplitude added in v0.0.6

func ConcentricWaterAmplitude(amplitude float64) func(any)

ConcentricWaterAmplitude sets the sine wave amplitude.

func ConcentricWaterAmplitudeFalloff added in v0.0.6

func ConcentricWaterAmplitudeFalloff(falloff float64) func(any)

ConcentricWaterAmplitudeFalloff controls how quickly the ripple amplitude decays with distance.

func ConcentricWaterBaseTint added in v0.0.6

func ConcentricWaterBaseTint(tint color.RGBA) func(any)

ConcentricWaterBaseTint sets the base water color.

func ConcentricWaterLightDirection added in v0.0.6

func ConcentricWaterLightDirection(x, y, z float64) func(any)

ConcentricWaterLightDirection sets the light vector used for shading.

func ConcentricWaterNormalStrength added in v0.0.6

func ConcentricWaterNormalStrength(strength float64) func(any)

ConcentricWaterNormalStrength sets the slope scaling used for normal estimation.

func ConcentricWaterRingSpacing added in v0.0.6

func ConcentricWaterRingSpacing(spacing float64) func(any)

ConcentricWaterRingSpacing sets the spacing between ripples.

func CurvatureFromHeight added in v0.0.6

func CurvatureFromHeight(source image.Image) image.Image

CurvatureFromHeight is a utility function that wraps NewCurvature to creates a curvature map from a height map.

func DefaultPredicate added in v0.0.2

func DefaultPredicate(c color.Color) float64

Default predicate

func ExampleChunkyBands added in v0.0.6

func ExampleChunkyBands()

Chunky pixel bands example.

func ExampleMaterial_basic added in v0.0.6

func ExampleMaterial_basic()

func ExampleNewAbstractArt added in v0.0.6

func ExampleNewAbstractArt() image.Image

Abstract Art: Renamed from Crystal (Original implementation)

func ExampleNewAmbientOcclusion added in v0.0.6

func ExampleNewAmbientOcclusion()

func ExampleNewBayer2x2Dither added in v0.0.2

func ExampleNewBayer2x2Dither()

Bayer2x2Dither Pattern Example of applying a 2x2 Bayer ordered dither.

func ExampleNewBayerDither added in v0.0.2

func ExampleNewBayerDither()

func ExampleNewBitwiseAnd added in v0.0.2

func ExampleNewBitwiseAnd()

func ExampleNewBlueNoise added in v0.0.2

func ExampleNewBlueNoise()

func ExampleNewBooleanAnd added in v0.0.2

func ExampleNewBooleanAnd()

func ExampleNewBooleanModes added in v0.0.6

func ExampleNewBooleanModes()

ExampleNewBooleanModes is a placeholder for documentation.

func ExampleNewBooleanNot added in v0.0.2

func ExampleNewBooleanNot()

func ExampleNewBooleanOr added in v0.0.2

func ExampleNewBooleanOr()

func ExampleNewBooleanXor added in v0.0.2

func ExampleNewBooleanXor()

func ExampleNewBrick added in v0.0.3

func ExampleNewBrick() image.Image

ExampleNewBrick creates a basic brick pattern. Output:

func ExampleNewBrick_stone added in v0.0.3

func ExampleNewBrick_stone() image.Image

ExampleNewBrick_stone demonstrates a stone-like wall using grey colors and size variations.

func ExampleNewBrick_textures added in v0.0.3

func ExampleNewBrick_textures() image.Image

ExampleNewBrick_textures demonstrates using different textures for bricks and mortar.

func ExampleNewBuffer added in v0.0.6

func ExampleNewBuffer()

Buffer Pattern A pattern that buffers a source image.

func ExampleNewCamouflage added in v0.0.4

func ExampleNewCamouflage()

func ExampleNewCandy added in v0.0.3

func ExampleNewCandy()

Candy Example (M&Ms / Smarties) Demonstrates using the Scatter pattern to draw overlapping, colored candy circles.

func ExampleNewCarpet added in v0.0.6

func ExampleNewCarpet() image.Image

Carpet: Visual interest increased

func ExampleNewCells added in v0.0.3

func ExampleNewCells()

Cells Example (Biological) Demonstrates using Worley Noise to create a biological cell structure (e.g., plant cells).

func ExampleNewChecker

func ExampleNewChecker()

Checker Pattern Alternates between two colors in a checkerboard fashion.

func ExampleNewCheckerBorder added in v0.0.6

func ExampleNewCheckerBorder() image.Image

Checker Border: Classic black/white border strip

func ExampleNewChippedBrick added in v0.0.6

func ExampleNewChippedBrick() image.Image

ExampleNewChippedBrick provides a sample for documentation use.

func ExampleNewCircle added in v0.0.2

func ExampleNewCircle()

func ExampleNewCircuit added in v0.0.6

func ExampleNewCircuit() image.Image

func ExampleNewClouds added in v0.0.4

func ExampleNewClouds() image.Image

ExampleNewClouds generates a generic cloud pattern.

func ExampleNewClouds_cirrus added in v0.0.4

func ExampleNewClouds_cirrus() image.Image

ExampleNewClouds_cirrus generates wispy, high-altitude cirrus clouds.

func ExampleNewClouds_cumulus added in v0.0.4

func ExampleNewClouds_cumulus() image.Image

ExampleNewClouds_cumulus generates fluffy, white cumulus clouds on a blue sky. It uses Perlin noise with a specific color map that has a sharp transition from blue to white to simulate the defined edges of cumulus clouds.

func ExampleNewClouds_storm added in v0.0.4

func ExampleNewClouds_storm() image.Image

ExampleNewClouds_storm generates dark, turbulent storm clouds. It blends multiple layers of noise to create depth and complexity.

func ExampleNewClouds_sunset added in v0.0.4

func ExampleNewClouds_sunset() image.Image

ExampleNewClouds_sunset generates clouds illuminated by a setting sun. It uses a linear gradient for the sky background and Perlin noise for the clouds, blending them to simulate under-lighting.

func ExampleNewColorMap added in v0.0.2

func ExampleNewColorMap()

ColorMap Pattern Maps the luminance of a source pattern to a color gradient (ramp). This is useful for creating textures like grass, dirt, clouds, or heatmaps.

func ExampleNewConcentricRings added in v0.0.2

func ExampleNewConcentricRings()

func ExampleNewConcentricWater added in v0.0.6

func ExampleNewConcentricWater() image.Image

ExampleNewConcentricWater demonstrates concentric distance-field ripples with sine-driven heights that tint and bend the normals of the surface.

func ExampleNewConicGradient added in v0.0.2

func ExampleNewConicGradient()

func ExampleNewCrackedMud added in v0.0.3

func ExampleNewCrackedMud()

Cracked Mud Example Demonstrates using Worley Noise (F2-F1) to create cracked earth.

func ExampleNewCrossHatch added in v0.0.2

func ExampleNewCrossHatch()

func ExampleNewCurvature added in v0.0.6

func ExampleNewCurvature()

func ExampleNewDamascus added in v0.0.4

func ExampleNewDamascus()

func ExampleNewDirt added in v0.0.5

func ExampleNewDirt() image.Image

func ExampleNewDirt_mud added in v0.0.5

func ExampleNewDirt_mud() image.Image

func ExampleNewDitherColorReduction added in v0.0.3

func ExampleNewDitherColorReduction() image.Image

ExampleNewDitherColorReduction demonstrates color reduction capabilities using various palettes.

func ExampleNewDitherStages added in v0.0.3

func ExampleNewDitherStages() image.Image

ExampleNewDitherStages demonstrates the progression of dithering techniques on a linear gradient, illustrating the "stages" or levels of detail each matrix provides.

func ExampleNewDungeon added in v0.0.6

func ExampleNewDungeon() image.Image

Dungeon: Stone brick + moss speckles + edge cracks

func ExampleNewEdgeDetect added in v0.0.2

func ExampleNewEdgeDetect()

EdgeDetect Pattern Applies Sobel edge detection to an input image.

func ExampleNewErrorDiffusion added in v0.0.2

func ExampleNewErrorDiffusion()

func ExampleNewFantasyFrame added in v0.0.6

func ExampleNewFantasyFrame() image.Image

We need to update ExampleNewFantasyFrame to use GenerateFantasyFrame or standard bounds

func ExampleNewFence added in v0.0.6

func ExampleNewFence() image.Image

Fence: Diagonal diamond grid (Chain link)

func ExampleNewFibonacci added in v0.0.2

func ExampleNewFibonacci()

func ExampleNewFineGrid added in v0.0.6

func ExampleNewFineGrid()

ExampleNewFineGrid renders a neon grid with glow and saves it to fine_grid.png.

func ExampleNewFloor added in v0.0.5

func ExampleNewFloor() image.Image

func ExampleNewFog added in v0.0.6

func ExampleNewFog() image.Image

ExampleNewFog renders soft Perlin/fBm fog with a radial falloff so the center stays clearer.

func ExampleNewGlobe added in v0.0.4

func ExampleNewGlobe()

ExampleNewGlobe is the default example for the documentation.

func ExampleNewGlobe_Grid added in v0.0.4

func ExampleNewGlobe_Grid()

ExampleNewGlobe_Grid demonstrates the wireframe/grid mode of the Globe pattern.

func ExampleNewGlobe_Projected added in v0.0.4

func ExampleNewGlobe_Projected()

ExampleNewGlobe_Projected demonstrates the true "Globe" pattern with spherical projection. It maps the same texture onto a sphere.

func ExampleNewGlobe_Simple added in v0.0.4

func ExampleNewGlobe_Simple()

ExampleNewGlobe_Simple demonstrates the "Circle and Texture" technique requested. It uses a flat circular mask over a terrain texture.

func ExampleNewGlyphRing added in v0.0.6

func ExampleNewGlyphRing()

ExampleNewGlyphRing produces a demo PNG for documentation.

func ExampleNewGopher added in v0.0.2

func ExampleNewGopher()

Gopher Pattern A static image of the Go Gopher.

func ExampleNewGradientQuantization added in v0.0.2

func ExampleNewGradientQuantization()

func ExampleNewGrass added in v0.0.3

func ExampleNewGrass()

Grass Example Demonstrates using Perlin Noise with ColorMap to create a simple grass texture.

func ExampleNewGrassClose added in v0.0.3

func ExampleNewGrassClose()

Grass Close Example Demonstrates a procedural grass texture using the GrassClose pattern composed with Noise.

func ExampleNewGrid added in v0.0.2

func ExampleNewGrid(ops ...func(any)) image.Image

func ExampleNewGridUnbounded added in v0.0.2

func ExampleNewGridUnbounded(ops ...func(any)) image.Image

func ExampleNewHeatmap added in v0.0.2

func ExampleNewHeatmap()

Heatmap Generates a heatmap for the function z = sin(x) * cos(y).

func ExampleNewHexGrid added in v0.0.6

func ExampleNewHexGrid()

HexGrid example: alternating palette across axial coordinates with a subtle bevel.

func ExampleNewHorizontalLine added in v0.0.2

func ExampleNewHorizontalLine()

func ExampleNewIce added in v0.0.6

func ExampleNewIce() image.Image

Ice: Pale base + thin cracks + faint gradient

func ExampleNewIslands added in v0.0.3

func ExampleNewIslands()

Islands Example Demonstrates composing patterns using Blend to create a realistic island terrain.

func ExampleNewKnollDither added in v0.0.3

func ExampleNewKnollDither() image.Image

func ExampleNewLava added in v0.0.4

func ExampleNewLava()

func ExampleNewLavaFlow added in v0.0.6

func ExampleNewLavaFlow() image.Image

Lava Flow: Dark base + bright streaks + subtle noise

func ExampleNewLinearGradient added in v0.0.2

func ExampleNewLinearGradient()

func ExampleNewMathsJulia added in v0.0.2

func ExampleNewMathsJulia()

Julia Set Generates a Julia set visualization.

func ExampleNewMathsMandelbrot added in v0.0.2

func ExampleNewMathsMandelbrot()

Mandelbrot Set Generates a Mandelbrot set visualization.

func ExampleNewMathsSine added in v0.0.2

func ExampleNewMathsSine()

Sine Waves Generates a sine wave pattern.

func ExampleNewMathsWaves added in v0.0.2

func ExampleNewMathsWaves()

Interference Waves Generates an interference pattern from multiple sine waves.

func ExampleNewMetal added in v0.0.5

func ExampleNewMetal() image.Image

func ExampleNewMetalPlate added in v0.0.6

func ExampleNewMetalPlate() image.Image

Metal Plate: Improved texture (Brushed)

func ExampleNewMetal_scratched added in v0.0.5

func ExampleNewMetal_scratched() image.Image

func ExampleNewMirror added in v0.0.2

func ExampleNewMirror()

Mirror Pattern Mirrors the input pattern horizontally or vertically.

func ExampleNewModuloStripe added in v0.0.2

func ExampleNewModuloStripe()

func ExampleNewMolecules added in v0.0.3

func ExampleNewMolecules()

Molecules Example (formerly Stones) Demonstrates using Worley Noise to create an atomic/molecular structure.

func ExampleNewMudTracks added in v0.0.6

func ExampleNewMudTracks()

ExampleNewMudTracks lays down multiple compacted bands with embedded pebble noise.

func ExampleNewNoise added in v0.0.2

func ExampleNewNoise()

Noise Pattern Generates random noise using various algorithms (Crypto, Hash).

func ExampleNewNormalMap added in v0.0.5

func ExampleNewNormalMap() image.Image

func ExampleNewNormalMap_sphere added in v0.0.5

func ExampleNewNormalMap_sphere() image.Image

func ExampleNewNull

func ExampleNewNull()

Null Pattern Returns a transparent color for all pixels.

func ExampleNewOrderedDither added in v0.0.2

func ExampleNewOrderedDither()

func ExampleNewPCBTraces added in v0.0.6

func ExampleNewPCBTraces() image.Image

ExampleNewPCBTraces returns a sample PCB trace layout with default options.

func ExampleNewPadding added in v0.0.2

func ExampleNewPadding(ops ...func(any)) image.Image

func ExampleNewPaintedPlanks added in v0.0.6

func ExampleNewPaintedPlanks() image.Image

ExampleNewPaintedPlanks demonstrates segmented planks with grain noise per board and a chipped paint overlay.

func ExampleNewPebbles added in v0.0.3

func ExampleNewPebbles()

Pebbles Example (Chipped Stone / Gravel) Demonstrates using the Scatter pattern to create overlapping, irregular stones.

func ExampleNewPersianRug added in v0.0.6

func ExampleNewPersianRug() image.Image

func ExampleNewPixelCamo added in v0.0.6

func ExampleNewPixelCamo() image.Image

Pixel Camo: Clustered 2x2 blocks in 3-4 colors

func ExampleNewPlasma added in v0.0.2

func ExampleNewPlasma()

func ExampleNewPolka added in v0.0.2

func ExampleNewPolka()

Polka Pattern A pattern of dots (circles) arranged in a grid.

func ExampleNewQuantize added in v0.0.2

func ExampleNewQuantize()

Quantize Pattern Example of quantizing the colors of an image (Posterization). This example reduces the Gopher image to 4 levels per channel.

func ExampleNewRadialGradient added in v0.0.2

func ExampleNewRadialGradient()

func ExampleNewRect added in v0.0.2

func ExampleNewRect()

Rect Pattern A pattern that draws a filled rectangle.

func ExampleNewRoad added in v0.0.5

func ExampleNewRoad() image.Image

func ExampleNewRoad_marked added in v0.0.5

func ExampleNewRoad_marked() image.Image

func ExampleNewRoad_terrain added in v0.0.5

func ExampleNewRoad_terrain() image.Image

func ExampleNewRotate added in v0.0.2

func ExampleNewRotate()

Rotate Pattern Rotates the input pattern by 90, 180, or 270 degrees.

func ExampleNewSand added in v0.0.5

func ExampleNewSand() image.Image

func ExampleNewSand_dunes added in v0.0.5

func ExampleNewSand_dunes() image.Image

func ExampleNewSand_zoomed added in v0.0.5

func ExampleNewSand_zoomed() image.Image

func ExampleNewScales added in v0.0.3

func ExampleNewScales()

Scales Example Demonstrates using the Scales pattern to create Amazonian fish scales.

func ExampleNewScreenTone added in v0.0.2

func ExampleNewScreenTone()

ScreenTone Pattern A halftone dot matrix pattern with adjustable density (Spacing) and angle.

func ExampleNewShojo added in v0.0.2

func ExampleNewShojo()

ExampleNewShojo produces a demo variant for readme.md.

func ExampleNewShojo_blue added in v0.0.2

func ExampleNewShojo_blue()

ExampleNewShojo_blue demonstrates a blue variant.

func ExampleNewShojo_pink added in v0.0.2

func ExampleNewShojo_pink()

ExampleNewShojo_pink demonstrates a pink variant.

func ExampleNewSierpinskiCarpet added in v0.0.2

func ExampleNewSierpinskiCarpet()

Sierpinski Carpet Generates a Sierpinski Carpet fractal.

func ExampleNewSierpinskiTriangle added in v0.0.2

func ExampleNewSierpinskiTriangle()

Sierpinski Triangle Generates a Sierpinski Triangle fractal (right-angled variant using Pascal's Triangle modulo 2).

func ExampleNewSimpleZoom

func ExampleNewSimpleZoom()

SimpleZoom Pattern Scales an input pattern by a factor.

func ExampleNewSlate added in v0.0.5

func ExampleNewSlate() image.Image

func ExampleNewSnow added in v0.0.5

func ExampleNewSnow() image.Image

func ExampleNewSnow_tracks added in v0.0.5

func ExampleNewSnow_tracks() image.Image

func ExampleNewSpeedLines added in v0.0.2

func ExampleNewSpeedLines()

SpeedLines Pattern Basic radial speed lines.

func ExampleNewStarfield added in v0.0.4

func ExampleNewStarfield()

func ExampleNewStone added in v0.0.5

func ExampleNewStone() image.Image

func ExampleNewStone_cobble added in v0.0.5

func ExampleNewStone_cobble() image.Image

func ExampleNewStones added in v0.0.3

func ExampleNewStones()

Stones Example (Riverbed / Cobblestones) Demonstrates using Worley Noise (F2-F1) to create smooth stones with mortar.

func ExampleNewStripe added in v0.0.6

func ExampleNewStripe() image.Image

Warning Stripe: Diagonal alternating yellow/black

func ExampleNewSubpixelLines added in v0.0.6

func ExampleNewSubpixelLines()

Subpixel lines with per-channel offset and vignette.

func ExampleNewThreadBands added in v0.0.6

func ExampleNewThreadBands()

func ExampleNewTile added in v0.0.2

func ExampleNewTile(ops ...func(any)) image.Image

func ExampleNewTransposed

func ExampleNewTransposed()

Transposed Pattern Transposes the coordinates of an input pattern.

func ExampleNewVHS added in v0.0.2

func ExampleNewVHS()

Retro VHS Effect Demonstrates the VHS scanline, color shift, and noise effect.

func ExampleNewVerticalLine added in v0.0.2

func ExampleNewVerticalLine()

func ExampleNewVoronoi added in v0.0.2

func ExampleNewVoronoi()

Voronoi Pattern Generates Voronoi cells.

func ExampleNewVoronoiTiles added in v0.0.6

func ExampleNewVoronoiTiles()

Voronoi Tiles Uses Voronoi cells to define tiles, raises the centers, darkens the gaps, and sprinkles dust noise.

func ExampleNewWarp added in v0.0.3

func ExampleNewWarp()

func ExampleNewWarp_clouds added in v0.0.3

func ExampleNewWarp_clouds() image.Image

func ExampleNewWarp_marble added in v0.0.3

func ExampleNewWarp_marble() image.Image

func ExampleNewWarp_terrain added in v0.0.3

func ExampleNewWarp_terrain() image.Image

func ExampleNewWarp_wood added in v0.0.3

func ExampleNewWarp_wood() image.Image

func ExampleNewWater added in v0.0.5

func ExampleNewWater() image.Image

func ExampleNewWater_surface added in v0.0.5

func ExampleNewWater_surface() image.Image

func ExampleNewWaveBorder added in v0.0.6

func ExampleNewWaveBorder() image.Image

Wave Border: Repeating sinusoidal edge

func ExampleNewWindRidges added in v0.0.6

func ExampleNewWindRidges()

ExampleNewWindRidges writes a wind-swept noise PNG showcasing parameterized streaks.

func ExampleNewWindowsDither added in v0.0.3

func ExampleNewWindowsDither() image.Image

ExampleNewWindowsDither demonstrates the classic Windows 16-color dithering using standard Bayer ordered dithering (comparable to what the user requested). This uses a 4x4 matrix which was common, or 8x8. The user linked article discusses standard ordered dithering with Bayer matrix.

func ExampleNewWindowsDither4x4 added in v0.0.3

func ExampleNewWindowsDither4x4() image.Image

ExampleNewWindowsDither4x4 demonstrates 4x4 variant.

func ExampleNewWindowsDitherHalftone added in v0.0.3

func ExampleNewWindowsDitherHalftone() image.Image

ExampleNewWindowsDitherHalftone uses a halftone pattern.

func ExampleNewWood added in v0.0.3

func ExampleNewWood() image.Image

ExampleNewWood demonstrates a procedural wood texture using domain warping on a distance field.

func ExampleNewWorleyNoise added in v0.0.3

func ExampleNewWorleyNoise()

WorleyNoise Pattern Generates Worley (cellular) noise.

func ExampleNewWorleyTiles added in v0.0.6

func ExampleNewWorleyTiles() image.Image

ExampleNewWorleyTiles tiles Worley/Voronoi stones with rounded edges and mortar. Parameters:

  • stone size (pixels): SetTileStoneSize
  • gap width (0-1): SetTileGapWidth
  • color palette spread (0-1): SetTilePaletteSpread

func ExampleNewXorGrid added in v0.0.2

func ExampleNewXorGrid()

func ExampleNewYliluoma1Dither added in v0.0.3

func ExampleNewYliluoma1Dither() image.Image

func ExampleNewYliluoma2Dither added in v0.0.3

func ExampleNewYliluoma2Dither() image.Image

func ExampleRect_blue added in v0.0.2

func ExampleRect_blue()

func ExampleRect_border_demo added in v0.0.2

func ExampleRect_border_demo()

func ExampleRect_bounded added in v0.0.2

func ExampleRect_bounded()

func ExampleRect_image_stroke added in v0.0.2

func ExampleRect_image_stroke()

func ExampleRect_stroked added in v0.0.2

func ExampleRect_stroked()

func ExampleSpeedLines_GopherBurst added in v0.0.2

func ExampleSpeedLines_GopherBurst()

ExampleSpeedLines_GopherBurst shows speed lines coming out of the Gopher's mouth.

func FixedSize added in v0.0.2

func FixedSize(w, h int) any

func GenerateAbstractArt added in v0.0.6

func GenerateAbstractArt(rect image.Rectangle) image.Image

func GenerateAmbientOcclusion added in v0.0.6

func GenerateAmbientOcclusion(rect image.Rectangle) image.Image

func GenerateBayer2x2Dither added in v0.0.2

func GenerateBayer2x2Dither(b image.Rectangle) image.Image

func GenerateBayer2x2DitherReferences added in v0.0.2

func GenerateBayer2x2DitherReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateBayerDither added in v0.0.2

func GenerateBayerDither(b image.Rectangle) image.Image

func GenerateBayerDitherReferences added in v0.0.2

func GenerateBayerDitherReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateBayerInt added in v0.0.3

func GenerateBayerInt(n int) []int

func GenerateBitwiseAnd added in v0.0.2

func GenerateBitwiseAnd(b image.Rectangle) image.Image

func GenerateBitwiseAndReferences added in v0.0.2

func GenerateBitwiseAndReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateBlueNoise added in v0.0.2

func GenerateBlueNoise(b image.Rectangle) image.Image

func GenerateBlueNoiseReferences added in v0.0.2

func GenerateBlueNoiseReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateBooleanAnd added in v0.0.2

func GenerateBooleanAnd(b image.Rectangle) image.Image

func GenerateBooleanAndReferences added in v0.0.2

func GenerateBooleanAndReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateBooleanModes added in v0.0.6

func GenerateBooleanModes(b image.Rectangle) image.Image

func GenerateBooleanModesReferences added in v0.0.6

func GenerateBooleanModesReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateBooleanNot added in v0.0.2

func GenerateBooleanNot(b image.Rectangle) image.Image

func GenerateBooleanNotReferences added in v0.0.2

func GenerateBooleanNotReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateBooleanOr added in v0.0.2

func GenerateBooleanOr(b image.Rectangle) image.Image

func GenerateBooleanOrReferences added in v0.0.2

func GenerateBooleanOrReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateBooleanXor added in v0.0.2

func GenerateBooleanXor(b image.Rectangle) image.Image

func GenerateBooleanXorReferences added in v0.0.2

func GenerateBooleanXorReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateBrickReferences added in v0.0.3

func GenerateBrickReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateBuffer added in v0.0.6

func GenerateBuffer(b image.Rectangle) image.Image

GenerateBuffer creates a buffer pattern for the gallery.

func GenerateCamouflage added in v0.0.4

func GenerateCamouflage(b image.Rectangle) image.Image

func GenerateCandy added in v0.0.3

func GenerateCandy(b image.Rectangle) image.Image

func GenerateCarpet added in v0.0.6

func GenerateCarpet(rect image.Rectangle) image.Image

func GenerateCells added in v0.0.3

func GenerateCells(b image.Rectangle) image.Image

func GenerateChecker added in v0.0.2

func GenerateChecker(b image.Rectangle) image.Image

func GenerateCheckerBorder added in v0.0.6

func GenerateCheckerBorder(rect image.Rectangle) image.Image

func GenerateChippedBrick added in v0.0.6

func GenerateChippedBrick(bounds image.Rectangle) image.Image

GenerateChippedBrick builds a chipped brick wall example with hue variation and recessed mortar.

func GenerateChunkyBands added in v0.0.6

func GenerateChunkyBands(b image.Rectangle) image.Image

func GenerateCircle added in v0.0.2

func GenerateCircle(b image.Rectangle) image.Image

func GenerateCircleReferences added in v0.0.2

func GenerateCircleReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateCircuit added in v0.0.6

func GenerateCircuit(rect image.Rectangle) image.Image

func GenerateCircuitImpl added in v0.0.6

func GenerateCircuitImpl(rect image.Rectangle) image.Image

Circuit: Thin orthogonal traces with small nodes (Redesigned from foundations)

func GenerateClouds added in v0.0.4

func GenerateClouds(rect image.Rectangle) image.Image

func GenerateCloudsReferences added in v0.0.4

func GenerateCloudsReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateCloudsReferences_Empty added in v0.0.4

func GenerateCloudsReferences_Empty() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateClouds_cirrus added in v0.0.4

func GenerateClouds_cirrus(rect image.Rectangle) image.Image

func GenerateClouds_cumulus added in v0.0.4

func GenerateClouds_cumulus(rect image.Rectangle) image.Image

func GenerateClouds_storm added in v0.0.4

func GenerateClouds_storm(rect image.Rectangle) image.Image

func GenerateClouds_sunset added in v0.0.4

func GenerateClouds_sunset(rect image.Rectangle) image.Image

func GenerateColorMap added in v0.0.2

func GenerateColorMap(b image.Rectangle) image.Image

func GenerateColorMapReferences added in v0.0.2

func GenerateColorMapReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateConcentricRings added in v0.0.2

func GenerateConcentricRings(b image.Rectangle) image.Image

func GenerateConcentricRingsReferences added in v0.0.2

func GenerateConcentricRingsReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateConcentricWater added in v0.0.6

func GenerateConcentricWater(b image.Rectangle) image.Image

func GenerateConcentricWaterReferences added in v0.0.6

func GenerateConcentricWaterReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateConicGradient added in v0.0.2

func GenerateConicGradient(b image.Rectangle) image.Image

func GenerateCrackedMud added in v0.0.3

func GenerateCrackedMud(b image.Rectangle) image.Image

func GenerateCrossHatch added in v0.0.2

func GenerateCrossHatch(rect image.Rectangle) image.Image

func GenerateCrossHatchReferences added in v0.0.2

func GenerateCrossHatchReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateCurvature added in v0.0.6

func GenerateCurvature(rect image.Rectangle) image.Image

func GenerateDamascus added in v0.0.4

func GenerateDamascus(b image.Rectangle) image.Image

func GenerateDirt added in v0.0.5

func GenerateDirt(rect image.Rectangle) image.Image

func GenerateDirt_mud added in v0.0.5

func GenerateDirt_mud(rect image.Rectangle) image.Image

func GenerateDitherColorReduction added in v0.0.3

func GenerateDitherColorReduction(b image.Rectangle) image.Image

func GenerateDitherColorReductionReferences added in v0.0.3

func GenerateDitherColorReductionReferences() (map[string]func(image.Rectangle) image.Image, []string)

GenerateDitherColorReductionReferences generates examples of color reduction.

func GenerateDitherStages added in v0.0.3

func GenerateDitherStages(b image.Rectangle) image.Image

GenerateDitherStages is the generator function for the main example image.

func GenerateDitherStagesReferences added in v0.0.3

func GenerateDitherStagesReferences() (map[string]func(image.Rectangle) image.Image, []string)

GenerateDitherStagesReferences generates a comprehensive set of dithering examples using a gradient source to visualize the patterns.

func GenerateDungeon added in v0.0.6

func GenerateDungeon(rect image.Rectangle) image.Image

func GenerateEarthTexture added in v0.0.4

func GenerateEarthTexture(b image.Rectangle) image.Image

GenerateEarthTexture creates a simple earth-like texture map

func GenerateEdgeDetect added in v0.0.2

func GenerateEdgeDetect(b image.Rectangle) image.Image

func GenerateEdgeDetectReferences added in v0.0.2

func GenerateEdgeDetectReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateErrorDiffusion added in v0.0.2

func GenerateErrorDiffusion(b image.Rectangle) image.Image

func GenerateErrorDiffusionReferences added in v0.0.2

func GenerateErrorDiffusionReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateFantasyFrame added in v0.0.6

func GenerateFantasyFrame(rect image.Rectangle) image.Image

Fantasy Frame: Ornate (Fixed Bounds)

func GenerateFence added in v0.0.6

func GenerateFence(rect image.Rectangle) image.Image

func GenerateFibonacci added in v0.0.2

func GenerateFibonacci(b image.Rectangle) image.Image

func GenerateFibonacciReferences added in v0.0.2

func GenerateFibonacciReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateFineGrid added in v0.0.6

func GenerateFineGrid(b image.Rectangle) image.Image

GenerateFineGrid returns a preconfigured fine grid for the registry and CLI.

func GenerateFineGridMagenta added in v0.0.6

func GenerateFineGridMagenta(b image.Rectangle) image.Image

GenerateFineGridMagenta variant showcases a denser grid and different hue.

func GenerateFineGridReferences added in v0.0.6

func GenerateFineGridReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateFineGridWarm added in v0.0.6

func GenerateFineGridWarm(b image.Rectangle) image.Image

GenerateFineGridWarm variant showcases hue customization.

func GenerateFloor added in v0.0.5

func GenerateFloor(rect image.Rectangle) image.Image

func GenerateFog added in v0.0.6

func GenerateFog(b image.Rectangle) image.Image

func GenerateFogReferences added in v0.0.6

func GenerateFogReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateGlobe added in v0.0.4

func GenerateGlobe(b image.Rectangle) image.Image

func GenerateGlobe_Grid added in v0.0.4

func GenerateGlobe_Grid(b image.Rectangle) image.Image

func GenerateGlobe_Projected added in v0.0.4

func GenerateGlobe_Projected(b image.Rectangle) image.Image

func GenerateGlobe_Simple added in v0.0.4

func GenerateGlobe_Simple(b image.Rectangle) image.Image

func GenerateGlyphRing added in v0.0.6

func GenerateGlyphRing(rect image.Rectangle) image.Image

GenerateGlyphRing renders the circular glyph band pattern.

func GenerateGlyphRingReferences added in v0.0.6

func GenerateGlyphRingReferences() (map[string]func(image.Rectangle) image.Image, []string)

GenerateGlyphRingReferences returns no additional reference patterns.

func GenerateGopher added in v0.0.2

func GenerateGopher(b image.Rectangle) image.Image

func GenerateGopherReferences added in v0.0.2

func GenerateGopherReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateGradientQuantization added in v0.0.2

func GenerateGradientQuantization(b image.Rectangle) image.Image

func GenerateGradientQuantizationReferences added in v0.0.2

func GenerateGradientQuantizationReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateGrass added in v0.0.3

func GenerateGrass(b image.Rectangle) image.Image

func GenerateGrassClose added in v0.0.3

func GenerateGrassClose(b image.Rectangle) image.Image

func GenerateGrassCloseReferences added in v0.0.3

func GenerateGrassCloseReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateHeatmap added in v0.0.2

func GenerateHeatmap(b image.Rectangle) image.Image

func GenerateHexGrid added in v0.0.6

func GenerateHexGrid(b image.Rectangle) image.Image

func GenerateHorizontalLine added in v0.0.2

func GenerateHorizontalLine(b image.Rectangle) image.Image

func GenerateIce added in v0.0.6

func GenerateIce(rect image.Rectangle) image.Image

func GenerateIslands added in v0.0.3

func GenerateIslands(b image.Rectangle) image.Image

func GenerateKnollDither added in v0.0.3

func GenerateKnollDither(b image.Rectangle) image.Image

func GenerateLava added in v0.0.4

func GenerateLava(b image.Rectangle) image.Image

func GenerateLavaFlow added in v0.0.6

func GenerateLavaFlow(rect image.Rectangle) image.Image

func GenerateLinearGradient added in v0.0.2

func GenerateLinearGradient(b image.Rectangle) image.Image

func GenerateLinearGradientReferences added in v0.0.2

func GenerateLinearGradientReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateMathsJulia added in v0.0.2

func GenerateMathsJulia(b image.Rectangle) image.Image

func GenerateMathsMandelbrot added in v0.0.2

func GenerateMathsMandelbrot(b image.Rectangle) image.Image

func GenerateMathsSine added in v0.0.2

func GenerateMathsSine(b image.Rectangle) image.Image

func GenerateMathsWaves added in v0.0.2

func GenerateMathsWaves(b image.Rectangle) image.Image

func GenerateMetal added in v0.0.5

func GenerateMetal(rect image.Rectangle) image.Image

func GenerateMetalPlate added in v0.0.6

func GenerateMetalPlate(rect image.Rectangle) image.Image

func GenerateMetal_scratched added in v0.0.5

func GenerateMetal_scratched(rect image.Rectangle) image.Image

func GenerateMirror added in v0.0.2

func GenerateMirror(b image.Rectangle) image.Image

func GenerateMirrorReferences added in v0.0.2

func GenerateMirrorReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateModuloStripe added in v0.0.2

func GenerateModuloStripe(b image.Rectangle) image.Image

func GenerateModuloStripeReferences added in v0.0.2

func GenerateModuloStripeReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateMolecules added in v0.0.3

func GenerateMolecules(b image.Rectangle) image.Image

func GenerateMudTracks added in v0.0.6

func GenerateMudTracks(b image.Rectangle) image.Image

GenerateMudTracks builds the pattern for registry-driven generation.

func GenerateNoise added in v0.0.2

func GenerateNoise(b image.Rectangle) image.Image

func GenerateNoiseReferences added in v0.0.2

func GenerateNoiseReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateNormalMap added in v0.0.5

func GenerateNormalMap(rect image.Rectangle) image.Image

Generators need to match func(image.Rectangle) image.Image signature

func GenerateNormalMap_sphere added in v0.0.5

func GenerateNormalMap_sphere(rect image.Rectangle) image.Image

func GenerateNull added in v0.0.2

func GenerateNull(b image.Rectangle) image.Image

func GenerateOrderedDither added in v0.0.2

func GenerateOrderedDither(b image.Rectangle) image.Image

func GenerateOrderedDitherReferences added in v0.0.2

func GenerateOrderedDitherReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GeneratePCBTraces added in v0.0.6

func GeneratePCBTraces(bounds image.Rectangle) image.Image

GeneratePCBTraces creates a PCB trace layout in the provided bounds.

func GeneratePaintedPlanks added in v0.0.6

func GeneratePaintedPlanks(rect image.Rectangle) image.Image

func GeneratePaintedPlanksReferences added in v0.0.6

func GeneratePaintedPlanksReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GeneratePebbles added in v0.0.3

func GeneratePebbles(b image.Rectangle) image.Image

func GeneratePersianRug added in v0.0.6

func GeneratePersianRug(rect image.Rectangle) image.Image

func GeneratePersianRugImpl added in v0.0.6

func GeneratePersianRugImpl(rect image.Rectangle) image.Image

Persian Rug: Ornate patterns (Redesigned + Internals Improved)

func GeneratePixelCamo added in v0.0.6

func GeneratePixelCamo(rect image.Rectangle) image.Image

func GeneratePlasma added in v0.0.2

func GeneratePlasma(b image.Rectangle) image.Image

func GeneratePlasmaReferences added in v0.0.2

func GeneratePlasmaReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GeneratePolka added in v0.0.2

func GeneratePolka(b image.Rectangle) image.Image

func GenerateQuantize added in v0.0.2

func GenerateQuantize(b image.Rectangle) image.Image

func GenerateQuantizeReferences added in v0.0.2

func GenerateQuantizeReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateRadialGradient added in v0.0.2

func GenerateRadialGradient(b image.Rectangle) image.Image

func GenerateRect added in v0.0.2

func GenerateRect(b image.Rectangle) image.Image

func GenerateRectReferences added in v0.0.2

func GenerateRectReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateRoad added in v0.0.5

func GenerateRoad(rect image.Rectangle) image.Image

func GenerateRoad_marked added in v0.0.5

func GenerateRoad_marked(rect image.Rectangle) image.Image

func GenerateRoad_terrain added in v0.0.5

func GenerateRoad_terrain(rect image.Rectangle) image.Image

func GenerateRotate added in v0.0.2

func GenerateRotate(b image.Rectangle) image.Image

func GenerateRotateReferences added in v0.0.2

func GenerateRotateReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateSand added in v0.0.5

func GenerateSand(rect image.Rectangle) image.Image

func GenerateSand_dunes added in v0.0.5

func GenerateSand_dunes(rect image.Rectangle) image.Image

func GenerateSand_zoomed added in v0.0.5

func GenerateSand_zoomed(rect image.Rectangle) image.Image

func GenerateScales added in v0.0.3

func GenerateScales(b image.Rectangle) image.Image

func GenerateScreenTone added in v0.0.2

func GenerateScreenTone(b image.Rectangle) image.Image

func GenerateShojo added in v0.0.2

func GenerateShojo(rect image.Rectangle) image.Image

GenerateShojo generates a Shojo Sparkles pattern.

func GenerateShojoReferences added in v0.0.2

func GenerateShojoReferences() (map[string]func(image.Rectangle) image.Image, []string)

GenerateShojoReferences generates reference images for the Shojo Sparkles pattern.

func GenerateShojo_blue added in v0.0.2

func GenerateShojo_blue(rect image.Rectangle) image.Image

func GenerateShojo_pink added in v0.0.2

func GenerateShojo_pink(rect image.Rectangle) image.Image

func GenerateSierpinskiCarpet added in v0.0.2

func GenerateSierpinskiCarpet(b image.Rectangle) image.Image

func GenerateSierpinskiTriangle added in v0.0.2

func GenerateSierpinskiTriangle(b image.Rectangle) image.Image

func GenerateSimpleZoom added in v0.0.2

func GenerateSimpleZoom(b image.Rectangle) image.Image

func GenerateSlate added in v0.0.5

func GenerateSlate(rect image.Rectangle) image.Image

func GenerateSnow added in v0.0.5

func GenerateSnow(rect image.Rectangle) image.Image

func GenerateSnow_tracks added in v0.0.5

func GenerateSnow_tracks(rect image.Rectangle) image.Image

func GenerateSpeedLines added in v0.0.2

func GenerateSpeedLines(b image.Rectangle) image.Image

func GenerateSpeedLinesReferences added in v0.0.2

func GenerateSpeedLinesReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateStarfield added in v0.0.4

func GenerateStarfield(b image.Rectangle) image.Image

func GenerateStone added in v0.0.5

func GenerateStone(rect image.Rectangle) image.Image

func GenerateStone_cobble added in v0.0.5

func GenerateStone_cobble(rect image.Rectangle) image.Image

func GenerateStones added in v0.0.3

func GenerateStones(b image.Rectangle) image.Image

func GenerateStripe added in v0.0.6

func GenerateStripe(rect image.Rectangle) image.Image

func GenerateSubpixelLines added in v0.0.6

func GenerateSubpixelLines(b image.Rectangle) image.Image

func GenerateThreadBands added in v0.0.6

func GenerateThreadBands(rect image.Rectangle) image.Image

func GenerateThreadBandsReferences added in v0.0.6

func GenerateThreadBandsReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateTransposed added in v0.0.2

func GenerateTransposed(b image.Rectangle) image.Image

func GenerateTransposedReferences added in v0.0.2

func GenerateTransposedReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateVHS added in v0.0.2

func GenerateVHS(b image.Rectangle) image.Image

func GenerateVerticalLine added in v0.0.2

func GenerateVerticalLine(b image.Rectangle) image.Image

func GenerateVoronoi added in v0.0.2

func GenerateVoronoi(b image.Rectangle) image.Image

func GenerateVoronoiTiles added in v0.0.6

func GenerateVoronoiTiles(b image.Rectangle) image.Image

func GenerateWarp added in v0.0.3

func GenerateWarp(rect image.Rectangle) image.Image

func GenerateWarpReferences added in v0.0.3

func GenerateWarpReferences() (map[string]func(image.Rectangle) image.Image, []string)

GenerateWarpReferences registers the examples for documentation generation (for the main Warp pattern references if needed).

func GenerateWarpReferences_Empty added in v0.0.3

func GenerateWarpReferences_Empty() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateWarp_clouds added in v0.0.3

func GenerateWarp_clouds(rect image.Rectangle) image.Image

func GenerateWarp_marble added in v0.0.3

func GenerateWarp_marble(rect image.Rectangle) image.Image

func GenerateWarp_terrain added in v0.0.3

func GenerateWarp_terrain(rect image.Rectangle) image.Image

func GenerateWarp_wood added in v0.0.3

func GenerateWarp_wood(rect image.Rectangle) image.Image

func GenerateWater added in v0.0.5

func GenerateWater(rect image.Rectangle) image.Image

func GenerateWater_surface added in v0.0.5

func GenerateWater_surface(rect image.Rectangle) image.Image

func GenerateWaveBorder added in v0.0.6

func GenerateWaveBorder(rect image.Rectangle) image.Image

func GenerateWindRidges added in v0.0.6

func GenerateWindRidges(b image.Rectangle) image.Image

GenerateWindRidges builds a directional streaked noise with soft shadow ridges.

func GenerateWindRidgesReferences added in v0.0.6

func GenerateWindRidgesReferences() (map[string]func(image.Rectangle) image.Image, []string)

GenerateWindRidgesReferences returns variations focusing on the key tunables.

func GenerateWindowsDither added in v0.0.3

func GenerateWindowsDither(b image.Rectangle) image.Image

func GenerateWindowsDither4x4 added in v0.0.3

func GenerateWindowsDither4x4(b image.Rectangle) image.Image

func GenerateWindowsDitherHalftone added in v0.0.3

func GenerateWindowsDitherHalftone(b image.Rectangle) image.Image

func GenerateWindowsDitherReferences added in v0.0.4

func GenerateWindowsDitherReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateWood added in v0.0.3

func GenerateWood(rect image.Rectangle) image.Image

func GenerateWoodReferences added in v0.0.3

func GenerateWoodReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateWorleyNoise added in v0.0.3

func GenerateWorleyNoise(b image.Rectangle) image.Image

func GenerateWorleyNoiseReferences added in v0.0.3

func GenerateWorleyNoiseReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateWorleyTiles added in v0.0.6

func GenerateWorleyTiles(bounds image.Rectangle) image.Image

GenerateWorleyTiles wires the example into the registry for bootstrapping.

func GenerateXorGrid added in v0.0.2

func GenerateXorGrid(b image.Rectangle) image.Image

func GenerateXorGridReferences added in v0.0.2

func GenerateXorGridReferences() (map[string]func(image.Rectangle) image.Image, []string)

func GenerateYliluoma1Dither added in v0.0.3

func GenerateYliluoma1Dither(b image.Rectangle) image.Image

func GenerateYliluoma2Dither added in v0.0.3

func GenerateYliluoma2Dither(b image.Rectangle) image.Image

func GradientCenter added in v0.0.5

func GradientCenter(x, y float64) func(any)

GradientCenter sets the center of the gradient (normalized 0..1).

func GradientVertical added in v0.0.2

func GradientVertical() func(any)

Option to set direction to vertical

func GridSize added in v0.0.2

func GridSize(cols, rows int) any

func HeightToNormal added in v0.0.6

func HeightToNormal(source image.Image, strength float64) image.Image

HeightToNormal is a utility function that wraps NewNormalMap to creates a normal map from a height map with the given strength.

func NewAligned added in v0.0.2

func NewAligned(img image.Image, width, height int, xAlign, yAlign float64, bg image.Image, padding ...int) image.Image

NewAligned returns an image padded to the specified width and height, with the inner image aligned according to xAlign and yAlign (0.0 to 1.0). 0.0 means Top/Left, 0.5 means Center, 1.0 means Bottom/Right. Optional padding arguments can be provided (following CSS standards): 1 arg: All sides 2 args: Vertical, Horizontal 4 args: Top, Right, Bottom, Left

func NewAmbientOcclusion added in v0.0.6

func NewAmbientOcclusion(source image.Image, ops ...func(any)) image.Image

func NewAnd added in v0.0.2

func NewAnd(inputs []image.Image, ops ...func(any)) image.Image

NewAnd creates a new And pattern.

func NewBayer2x2Dither added in v0.0.2

func NewBayer2x2Dither(img image.Image, palette color.Palette, ops ...func(any)) image.Image

NewBayer2x2Dither is a convenience function.

func NewBayer4x4Dither added in v0.0.2

func NewBayer4x4Dither(img image.Image, palette color.Palette, ops ...func(any)) image.Image

NewBayer4x4Dither is a convenience function.

func NewBayer8x8Dither added in v0.0.2

func NewBayer8x8Dither(img image.Image, palette color.Palette, ops ...func(any)) image.Image

NewBayer8x8Dither is a convenience function.

func NewBayerDither added in v0.0.2

func NewBayerDither(input image.Image, size int, ops ...func(any)) image.Image

NewBayerDither creates a new BayerDither pattern.

func NewBitwiseAnd added in v0.0.2

func NewBitwiseAnd(inputs []image.Image, ops ...func(any)) image.Image

NewBitwiseAnd creates a new Bitwise And pattern.

func NewBitwiseNot added in v0.0.2

func NewBitwiseNot(input image.Image, ops ...func(any)) image.Image

NewBitwiseNot creates a new Bitwise Not pattern.

func NewBitwiseOr added in v0.0.2

func NewBitwiseOr(inputs []image.Image, ops ...func(any)) image.Image

NewBitwiseOr creates a new Bitwise Or pattern.

func NewBitwiseXor added in v0.0.2

func NewBitwiseXor(inputs []image.Image, ops ...func(any)) image.Image

NewBitwiseXor creates a new Bitwise Xor pattern.

func NewBlend added in v0.0.3

func NewBlend(i1, i2 image.Image, mode BlendMode, ops ...func(any)) image.Image

NewBlend creates a new Blend pattern.

func NewBlueNoise added in v0.0.2

func NewBlueNoise(ops ...func(any)) image.Image

NewBlueNoise creates a new BlueNoise pattern.

func NewBlueNoiseDither added in v0.0.2

func NewBlueNoiseDither(img image.Image, palette color.Palette, ops ...func(any)) image.Image

NewBlueNoiseDither creates a blue noise dither pattern. Uses a generated 16x16 Blue Noise mask.

func NewBrick added in v0.0.3

func NewBrick(ops ...func(any)) image.Image

NewBrick creates a new Brick pattern.

func NewCenter added in v0.0.2

func NewCenter(img image.Image, width, height int, bg image.Image) image.Image

Helper for "Center"

func NewChecker

func NewChecker(color1, color2 color.Color, ops ...func(any)) image.Image

NewChecker creates a new Checker with the given colors and square size.

func NewChippedBrick added in v0.0.6

func NewChippedBrick(ops ...func(any)) image.Image

NewChippedBrick creates a weathered brick wall.

func NewChunkyBands added in v0.0.6

func NewChunkyBands(ops ...func(any)) image.Image

NewChunkyBands creates a new ChunkyBands pattern.

func NewCircle added in v0.0.2

func NewCircle(ops ...func(any)) image.Image

NewCircle creates a new Circle pattern.

func NewColorMap added in v0.0.2

func NewColorMap(source image.Image, stops ...ColorStop) image.Image

NewColorMap creates a new ColorMap pattern. It sorts the stops by position.

func NewConcentricRings added in v0.0.2

func NewConcentricRings(colors []color.Color, ops ...func(any)) image.Image

NewConcentricRings creates a new ConcentricRings pattern.

func NewConcentricWater added in v0.0.6

func NewConcentricWater(ops ...func(any)) image.Image

NewConcentricWater creates a concentric ripple height field rendered with water tinting.

func NewConicGradient added in v0.0.2

func NewConicGradient(ops ...func(any)) image.Image

NewConicGradient creates a new ConicGradient pattern.

func NewCrop added in v0.0.2

func NewCrop(img image.Image, rect image.Rectangle) image.Image

func NewCrossHatch added in v0.0.2

func NewCrossHatch(ops ...func(any)) image.Image

NewCrossHatch creates a new CrossHatch pattern.

func NewCurvature added in v0.0.6

func NewCurvature(source image.Image, ops ...func(any)) image.Image

func NewDemoAnd added in v0.0.2

func NewDemoAnd(ops ...func(any)) image.Image

func NewDemoChecker

func NewDemoChecker(ops ...func(any)) image.Image

NewDemoChecker produces a demo variant for readme.md pre-populated values

func NewDemoChunkyBands added in v0.0.6

func NewDemoChunkyBands(ops ...func(any)) image.Image

NewDemoChunkyBands produces a demo variant for readme.md pre-populated values.

func NewDemoCircle added in v0.0.2

func NewDemoCircle(ops ...func(any)) image.Image

NewDemoCircle produces a demo variant for readme.md pre-populated values

func NewDemoCrossHatch added in v0.0.2

func NewDemoCrossHatch(ops ...func(any)) image.Image

NewDemoCrossHatch produces a demo variant for readme.md pre-populated values

func NewDemoEdgeDetect added in v0.0.2

func NewDemoEdgeDetect(ops ...func(any)) image.Image

NewDemoEdgeDetect produces a demo variant for readme.md

func NewDemoErrorDiffusion added in v0.0.2

func NewDemoErrorDiffusion(ops ...func(any)) image.Image

func NewDemoFibonacci added in v0.0.2

func NewDemoFibonacci(ops ...func(any)) image.Image

NewDemoFibonacci produces a demo variant for readme.md pre-populated values

func NewDemoFineGrid added in v0.0.6

func NewDemoFineGrid(ops ...func(any)) image.Image

NewDemoFineGrid produces a demo variant for readme.md pre-populated values.

func NewDemoGlyphRing added in v0.0.6

func NewDemoGlyphRing(ops ...func(any)) image.Image

NewDemoGlyphRing produces a demo variant for readme.md pre-populated values.

func NewDemoGridAdvanced added in v0.0.2

func NewDemoGridAdvanced(ops ...func(any)) image.Image

func NewDemoGridBounded added in v0.0.2

func NewDemoGridBounded(ops ...func(any)) image.Image

func NewDemoGridColumns added in v0.0.2

func NewDemoGridColumns(ops ...func(any)) image.Image

func NewDemoGridFixed added in v0.0.2

func NewDemoGridFixed(ops ...func(any)) image.Image

func NewDemoGridFlexible added in v0.0.2

func NewDemoGridFlexible(ops ...func(any)) image.Image

func NewDemoGridRows added in v0.0.2

func NewDemoGridRows(ops ...func(any)) image.Image

func NewDemoHorizontalLine added in v0.0.2

func NewDemoHorizontalLine(ops ...func(any)) image.Image

NewDemoHorizontalLine produces a demo variant for readme.md pre-populated values

func NewDemoMirrorInput added in v0.0.2

func NewDemoMirrorInput(b image.Rectangle) image.Image

func NewDemoNot added in v0.0.2

func NewDemoNot(ops ...func(any)) image.Image

func NewDemoNull

func NewDemoNull(ops ...func(any)) image.Image

NewDemoNull produces a demo variant for readme.md pre-populated values

func NewDemoOr added in v0.0.2

func NewDemoOr(ops ...func(any)) image.Image

func NewDemoOrderedDither added in v0.0.2

func NewDemoOrderedDither(ops ...func(any)) image.Image

func NewDemoPaddingAlignedWithOffset added in v0.0.2

func NewDemoPaddingAlignedWithOffset(ops ...func(any)) image.Image

func NewDemoPaddingBottomRight added in v0.0.2

func NewDemoPaddingBottomRight(ops ...func(any)) image.Image

func NewDemoPaddingBounded added in v0.0.2

func NewDemoPaddingBounded(ops ...func(any)) image.Image

func NewDemoPaddingCentered added in v0.0.2

func NewDemoPaddingCentered(ops ...func(any)) image.Image

func NewDemoPaddingColor added in v0.0.2

func NewDemoPaddingColor(ops ...func(any)) image.Image

func NewDemoPaddingRight added in v0.0.2

func NewDemoPaddingRight(ops ...func(any)) image.Image

func NewDemoPaddingTopLeft added in v0.0.2

func NewDemoPaddingTopLeft(ops ...func(any)) image.Image

func NewDemoPolka added in v0.0.2

func NewDemoPolka(ops ...func(any)) image.Image

NewDemoPolka produces a demo variant for readme.md pre-populated values

func NewDemoRect added in v0.0.2

func NewDemoRect(ops ...func(any)) image.Image

NewDemoRect produces a demo variant for readme.md pre-populated values

func NewDemoRotateInput added in v0.0.2

func NewDemoRotateInput(b image.Rectangle) image.Image

func NewDemoSimpleZoom

func NewDemoSimpleZoom(img image.Image, ops ...func(any)) image.Image

NewDemoSimpleZoom produces a demo variant for readme.md pre-populated values

func NewDemoSubpixelLines added in v0.0.6

func NewDemoSubpixelLines(ops ...func(any)) image.Image

NewDemoSubpixelLines produces a demo variant for readme.md pre-populated values.

func NewDemoThreadBands added in v0.0.6

func NewDemoThreadBands(ops ...func(any)) image.Image

NewDemoThreadBands produces a demo variant for readme.md pre-populated values.

func NewDemoTransposed

func NewDemoTransposed(ops ...func(any)) image.Image

NewDemoTransposed produces a demo variant for readme.md pre-populated values

func NewDemoVerticalLine added in v0.0.2

func NewDemoVerticalLine(ops ...func(any)) image.Image

NewDemoVerticalLine produces a demo variant for readme.md pre-populated values

func NewDemoVoronoi added in v0.0.2

func NewDemoVoronoi(ops ...func(any)) image.Image

NewDemoVoronoi produces a demo variant for readme.md pre-populated values.

func NewDemoXor added in v0.0.2

func NewDemoXor(ops ...func(any)) image.Image

func NewEdgeDetect added in v0.0.2

func NewEdgeDetect(img image.Image, ops ...func(any)) image.Image

NewEdgeDetect creates a new EdgeDetect pattern from an existing image.

func NewErrorDiffusion added in v0.0.2

func NewErrorDiffusion(img image.Image, kernel DiffusionKernel, p color.Palette, ops ...func(any)) image.Image

NewErrorDiffusion creates a new ErrorDiffusion pattern. If palette is nil, it defaults to Black and White (1-bit). Supports SetSerpentine(bool) and SetGamma(float64) options.

func NewFibonacci added in v0.0.2

func NewFibonacci(ops ...func(any)) image.Image

NewFibonacci creates a new Fibonacci pattern.

func NewFineGrid added in v0.0.6

func NewFineGrid(ops ...func(any)) image.Image

NewFineGrid builds a grid with glow and chromatic aberration.

func NewFog added in v0.0.6

func NewFog(ops ...func(any)) image.Image

NewFog creates a fog pattern using Perlin fBm and radial attenuation.

func NewGeneric added in v0.0.6

func NewGeneric(f func(x, y int) color.Color) image.Image

func NewGlobe added in v0.0.4

func NewGlobe(ops ...func(any)) image.Image

NewGlobe creates a new Globe pattern.

func NewGlyphRing added in v0.0.6

func NewGlyphRing(ops ...func(any)) image.Image

NewGlyphRing constructs a GlyphRing with optional configuration.

func NewGoLogo() image.Image

NewGoLogo returns an image of the Go Logo (or a Gopher related image).

func NewGopher added in v0.0.2

func NewGopher() image.Image

NewGopher returns an image of the Go Gopher. If the embedded asset cannot be decoded, it panics (should not happen in production).

func NewGrassClose added in v0.0.3

func NewGrassClose(ops ...func(any)) image.Image

NewGrassClose creates a new GrassClose pattern.

func NewGrid added in v0.0.2

func NewGrid(ops ...any) image.Image

func NewHalftoneDither added in v0.0.2

func NewHalftoneDither(img image.Image, size int, palette color.Palette, ops ...func(any)) image.Image

NewHalftoneDither creates a halftone dither effect using a clustered dot matrix. size determines the grid size of the dots (e.g. 8x8).

func NewHeatmap added in v0.0.2

func NewHeatmap(f HeatmapFunc, ops ...func(any)) image.Image

NewHeatmap creates a new Heatmap pattern.

func NewHexGrid added in v0.0.6

func NewHexGrid(ops ...func(any)) image.Image

NewHexGrid creates a new HexGrid pattern.

func NewHorizontalLine added in v0.0.2

func NewHorizontalLine(ops ...func(any)) image.Image

NewHorizontalLine creates a new HorizontalLine pattern.

func NewKnollDither added in v0.0.3

func NewKnollDither(img image.Image, palette color.Palette, size int, ops ...func(any)) image.Image

NewKnollDither creates a new KnollDither pattern.

func NewLinearGradient added in v0.0.2

func NewLinearGradient(ops ...func(any)) image.Image

NewLinearGradient creates a new LinearGradient pattern.

func NewMaths added in v0.0.2

func NewMaths(f MathsFunc, ops ...func(any)) image.Image

NewMaths creates a new Maths pattern with the given function.

func NewMirror added in v0.0.2

func NewMirror(img image.Image, horizontal, vertical bool, ops ...func(any)) image.Image

NewMirror creates a new Mirror from an existing image. horizontal: flips left-right vertical: flips top-bottom

func NewModuloStripe added in v0.0.2

func NewModuloStripe(colors []color.Color, ops ...func(any)) image.Image

NewModuloStripe creates a new ModuloStripe pattern.

func NewMultiScaleOrderedDither added in v0.0.2

func NewMultiScaleOrderedDither(img image.Image, palette color.Palette, ops ...func(any)) image.Image

func NewNoise added in v0.0.2

func NewNoise(ops ...func(any)) image.Image

NewNoise creates a new Noise pattern.

func NewNormalMap added in v0.0.5

func NewNormalMap(source image.Image, ops ...func(any)) image.Image

NewNormalMap creates a new NormalMap from a source image. Default Strength is 1.0.

func NewNot added in v0.0.2

func NewNot(input image.Image, ops ...func(any)) image.Image

NewNot creates a new Not pattern. It enforces exactly 1 input.

func NewNull

func NewNull(ops ...func(any)) image.Image

func NewOr added in v0.0.2

func NewOr(inputs []image.Image, ops ...func(any)) image.Image

NewOr creates a new Or pattern.

func NewOrderedDither added in v0.0.2

func NewOrderedDither(img image.Image, matrix []float64, dim int, palette color.Palette, spread float64, ops ...func(any)) image.Image

NewOrderedDither creates a new OrderedDither pattern. matrix should be a square matrix flattened. dim is the width/height. values in matrix should be normalized 0..1. spread controls the intensity of dithering. If 0, it auto-calculates based on palette size.

func NewPCBTraces added in v0.0.6

func NewPCBTraces(ops ...func(any)) image.Image

NewPCBTraces builds the PCB trace pattern with configurable parameters.

func NewPadding added in v0.0.2

func NewPadding(img image.Image, opts ...PaddingOption) image.Image

func NewPaintedPlanks added in v0.0.6

func NewPaintedPlanks(ops ...func(any)) image.Image

NewPaintedPlanks creates a plank wall pattern with configurable wood grain and paint wear.

func NewPlasma added in v0.0.2

func NewPlasma(ops ...func(any)) image.Image

NewPlasma creates a new Plasma pattern.

func NewPolka added in v0.0.2

func NewPolka(ops ...func(any)) image.Image

NewPolka creates a new Polka pattern. Default Radius is 10. Default Spacing is 40. Default FillColor is Black. Default SpaceColor is White.

func NewQuantize added in v0.0.2

func NewQuantize(img image.Image, levels int, ops ...func(any)) image.Image

NewQuantize creates a new Quantize pattern. levels is the number of levels per channel. e.g. 2 means 2 levels (0 and 255).

func NewRadialGradient added in v0.0.2

func NewRadialGradient(ops ...func(any)) image.Image

NewRadialGradient creates a new RadialGradient pattern.

func NewRandomDither added in v0.0.2

func NewRandomDither(img image.Image, palette color.Palette, seed int64, ops ...func(any)) image.Image

NewRandomDither creates a new RandomDither pattern.

func NewRect added in v0.0.2

func NewRect(ops ...func(any)) image.Image

NewRect creates a new Rect pattern with the given options.

func NewRotate added in v0.0.2

func NewRotate(img image.Image, degrees int, ops ...func(any)) image.Image

NewRotate creates a new Rotate from an existing image. degrees: 90, 180, 270 (values are normalized to these).

func NewScale added in v0.0.2

func NewScale(img image.Image, opts ...ScaleOption) image.Image

NewScale creates a new scaled image. Note: This eagerly computes the scaled image because advanced interpolation requires neighborhood access.

func NewScales added in v0.0.3

func NewScales(ops ...func(any)) image.Image

NewScales creates a new Scales pattern.

func NewScatter added in v0.0.3

func NewScatter(ops ...func(any)) image.Image

NewScatter creates a new Scatter pattern.

func NewScreenTone added in v0.0.2

func NewScreenTone(ops ...func(any)) image.Image

NewScreenTone creates a new ScreenTone pattern. Default Radius is 2. Default Spacing is 10. Default Angle is 45 degrees. Default FillColor is Black. Default SpaceColor is White.

func NewShojo added in v0.0.2

func NewShojo(ops ...func(any)) image.Image

NewShojo creates a new Shojo Sparkles pattern.

func NewSierpinskiCarpet added in v0.0.2

func NewSierpinskiCarpet(ops ...func(any)) image.Image

NewSierpinskiCarpet creates a new SierpinskiCarpet pattern.

func NewSierpinskiTriangle added in v0.0.2

func NewSierpinskiTriangle(ops ...func(any)) image.Image

NewSierpinskiTriangle creates a new SierpinskiTriangle pattern.

func NewSimpleZoom

func NewSimpleZoom(img image.Image, factor int, ops ...func(any)) image.Image

NewSimpleZoom creates a new SimpleZoom with the given image and zoom factor.

func NewSolid added in v0.0.6

func NewSolid(c color.Color) image.Image

NewSolid creates a uniform color pattern. Helper for the example.

func NewSpeedLines added in v0.0.2

func NewSpeedLines(ops ...func(any)) image.Image

NewSpeedLines creates a new SpeedLines pattern.

func NewSubpixelLines added in v0.0.6

func NewSubpixelLines(ops ...func(any)) image.Image

NewSubpixelLines creates a new SubpixelLines pattern.

func NewText added in v0.0.2

func NewText(s string, opts ...TextOption) image.Image

func NewThreadBands added in v0.0.6

func NewThreadBands(ops ...func(any)) image.Image

NewThreadBands creates a thread weave pattern with sensible defaults.

func NewTile added in v0.0.2

func NewTile(img image.Image, bounds image.Rectangle) image.Image

func NewTransposed

func NewTransposed(img image.Image, x, y int, ops ...func(any)) image.Image

NewTransposed creates a new Transposed from an existing image.

func NewUniform added in v0.0.3

func NewUniform(c color.Color) image.Image

Helper for uniform color image

func NewVHS added in v0.0.2

func NewVHS(img image.Image, ops ...func(any)) image.Image

NewVHS creates a new VHS pattern.

func NewVerticalLine added in v0.0.2

func NewVerticalLine(ops ...func(any)) image.Image

NewVerticalLine creates a new VerticalLine pattern.

func NewVoronoi added in v0.0.2

func NewVoronoi(points []image.Point, colors []color.Color, ops ...func(any)) image.Image

NewVoronoi creates a new Voronoi pattern.

func NewVoronoiTiles added in v0.0.6

func NewVoronoiTiles(bounds image.Rectangle, cellSize, gapWidth, heightBoost float64, seed int64) image.Image

NewVoronoiTiles builds a tileable material using Voronoi cells as tiles. Cell centers are lifted slightly, edges are darkened, and subtle dust noise is overlaid. Parameters:

  • cellSize: Distance in pixels between Voronoi sites.
  • gapWidth: How wide (0-1) the dark gap between tiles appears. Higher widens the shadow band.
  • heightBoost: How much to lighten the tile centers and deepen the edges.

func NewWarp added in v0.0.3

func NewWarp(source image.Image, ops ...func(any)) image.Image

NewWarp creates a new Warp pattern. If only Distortion is provided, it displaces both X and Y using the same map (usually diagonal if not handled). However, typically you want different noise for X and Y, so DistortionX and DistortionY are preferred for independent axis warping.

func NewWindRidges added in v0.0.6

func NewWindRidges(ops ...func(any)) image.Image

NewWindRidges builds a wind-swept noise field.

func NewWorleyNoise added in v0.0.3

func NewWorleyNoise(ops ...func(any)) image.Image

NewWorleyNoise creates a new WorleyNoise pattern.

func NewWorleyTiles added in v0.0.6

func NewWorleyTiles(ops ...func(any)) image.Image

NewWorleyTiles creates a new WorleyTiles pattern.

func NewXor added in v0.0.2

func NewXor(inputs []image.Image, ops ...func(any)) image.Image

NewXor creates a new Xor pattern. It enforces exactly 2 inputs.

func NewXorPattern added in v0.0.2

func NewXorPattern(ops ...func(any)) image.Image

NewXorPattern creates a new XorPattern.

func NewYliluoma1Dither added in v0.0.3

func NewYliluoma1Dither(input image.Image, palette color.Palette, size int, ops ...func(any)) image.Image

NewYliluoma1Dither creates a new Yliluoma1Dither pattern.

func NewYliluoma2Dither added in v0.0.3

func NewYliluoma2Dither(input image.Image, palette color.Palette, size int, ops ...func(any)) image.Image

NewYliluoma2Dither creates a new Yliluoma2Dither pattern.

func NoiseSeed deprecated added in v0.0.2

func NoiseSeed(seed int64) func(any)

NoiseSeed sets the seed for the noise algorithm. If the current algorithm is CryptoNoise, it switches to HashNoise.

Deprecated: Use Seed() instead.

func NormalMapStrength added in v0.0.5

func NormalMapStrength(strength float64) func(any)

NormalMapStrength sets the strength of the normal map.

func PredicateAnyAlpha added in v0.0.2

func PredicateAnyAlpha(c color.Color) float64

PredicateAnyAlpha returns 1.0 if there is any alpha (opaque), 0.0 if transparent. Use average with threshold.

func PredicateInk added in v0.0.2

func PredicateInk(c color.Color) float64

PredicateInk returns 1.0 for Black (ink), 0.0 for White (paper). Used to perform logic on the "ink" rather than luminance.

func RegisterGenerator added in v0.0.2

func RegisterGenerator(name string, gen func(image.Rectangle) image.Image)

func RegisterReferences added in v0.0.2

func RegisterReferences(name string, refs func() (map[string]func(image.Rectangle) image.Image, []string))

func Row added in v0.0.2

func Row(cells ...any) any

func SetAngle added in v0.0.2

func SetAngle(v float64) func(any)

SetAngle creates an option to set the angle.

func SetAngles added in v0.0.2

func SetAngles(v ...float64) func(any)

SetAngles creates an option to set the angles.

func SetBackgroundColor added in v0.0.6

func SetBackgroundColor(v color.Color) func(any)

SetBackgroundColor creates an option to set the background color.

func SetBandColor added in v0.0.6

func SetBandColor(v color.Color) func(any)

SetBandColor creates an option to set the band color.

func SetBandThickness added in v0.0.6

func SetBandThickness(v int) func(any)

SetBandThickness creates an option to set the ring thickness.

func SetBladeHeight added in v0.0.3

func SetBladeHeight(h float64) func(any)

SetBladeHeight sets the average height of a grass blade.

func SetBladeWidth added in v0.0.3

func SetBladeWidth(w float64) func(any)

SetBladeWidth sets the average width of a grass blade at the base.

func SetBlockSize added in v0.0.6

func SetBlockSize(v int) func(any)

SetBlockSize creates an option to set the block size.

func SetBooleanMode added in v0.0.6

func SetBooleanMode(m BooleanMode) func(any)

func SetBounds

func SetBounds(bounds image.Rectangle) func(ai any)

func SetBrickImages added in v0.0.3

func SetBrickImages(imgs ...image.Image) func(any)

func SetBrickOffset added in v0.0.3

func SetBrickOffset(o float64) func(any)

func SetBrickSize added in v0.0.3

func SetBrickSize(w, h int) func(any)

func SetCenter added in v0.0.2

func SetCenter(x, y int) func(any)

SetCenter creates an option to set the center.

func SetChipIntensity added in v0.0.6

func SetChipIntensity(v float64) func(any)

func SetColorOffset added in v0.0.2

func SetColorOffset(i int) func(any)

func SetColorVariance added in v0.0.6

func SetColorVariance(v float64) func(any)

func SetCopperColor added in v0.0.6

func SetCopperColor(v color.Color) func(any)

SetCopperColor creates an option to set the copper color used for traces and vias.

func SetCrossShadowDepth added in v0.0.6

func SetCrossShadowDepth(v float64) func(any)

func SetDarkThreadColor added in v0.0.6

func SetDarkThreadColor(col color.Color) func(any)

func SetDensity added in v0.0.2

func SetDensity(v float64) func(any)

SetDensity creates an option to set the density.

func SetDensitySource added in v0.0.3

func SetDensitySource(src image.Image) func(any)

SetDensitySource sets the pattern used for density.

func SetEdgeAwareness added in v0.0.2

func SetEdgeAwareness(v float64) func(any)

SetEdgeAwareness creates an option to set edge awareness.

func SetEndColor added in v0.0.2

func SetEndColor(v color.Color) func(any)

SetEndColor creates an option to set the end color.

func SetExpiry added in v0.0.6

func SetExpiry(v time.Duration) func(any)

SetExpiry creates an option to set the expiry.

func SetFalloffCurve added in v0.0.6

func SetFalloffCurve(v float64) func(any)

SetFalloffCurve creates an option to set the radial falloff curve strength.

func SetFalseColor added in v0.0.2

func SetFalseColor(v color.Color) func(any)

SetFalseColor creates an option to set the "false" color.

func SetFillColor added in v0.0.2

func SetFillColor(v color.Color) func(any)

SetFillColor creates an option to set the fill color.

func SetFillImageSource added in v0.0.2

func SetFillImageSource(v image.Image) func(any)

SetFillImageSource creates an option to set the fill image source.

func SetFineGridAberration added in v0.0.6

func SetFineGridAberration(offset int) func(any)

SetFineGridAberration configures how many pixels each color channel is offset for chromatic aberration.

func SetFineGridBackgroundFade added in v0.0.6

func SetFineGridBackgroundFade(fade float64) func(any)

SetFineGridBackgroundFade lets the glow darken into the background (0=no fade, 1=full transparent).

func SetFineGridCellSize added in v0.0.6

func SetFineGridCellSize(size int) func(any)

SetFineGridCellSize configures the cell spacing of the grid.

func SetFineGridGlowRadius added in v0.0.6

func SetFineGridGlowRadius(radius float64) func(any)

SetFineGridGlowRadius configures the softness of the glow.

func SetFineGridGlowStrength added in v0.0.6

func SetFineGridGlowStrength(strength float64) func(any)

SetFineGridGlowStrength configures how strong the falloff glow is.

func SetFineGridHue added in v0.0.6

func SetFineGridHue(h float64) func(any)

SetFineGridHue configures the hue (in degrees 0..360) of the glow.

func SetFineGridLineStrength added in v0.0.6

func SetFineGridLineStrength(strength float64) func(any)

SetFineGridLineStrength configures the thickness of the core line profile.

func SetFloatCenter added in v0.0.5

func SetFloatCenter(x, y float64) func(any)

SetFloatCenter creates an option to set the float center.

func SetFrequency added in v0.0.3

func SetFrequency(v float64) func(any)

SetFrequency creates an option to set the frequency.

func SetFrequencyX added in v0.0.3

func SetFrequencyX(v float64) func(any)

SetFrequencyX creates an option to set the X frequency.

func SetFrequencyY added in v0.0.3

func SetFrequencyY(v float64) func(any)

SetFrequencyY creates an option to set the Y frequency.

func SetGamma added in v0.0.2

func SetGamma(v float64) func(any)

SetGamma creates an option to set gamma.

func SetGlowColor added in v0.0.6

func SetGlowColor(v color.Color) func(any)

SetGlowColor creates an option to set the glow color.

func SetGlowSize added in v0.0.6

func SetGlowSize(v int) func(any)

SetGlowSize creates an option to set the glow falloff width.

func SetGlyphSize added in v0.0.6

func SetGlyphSize(v int) func(any)

SetGlyphSize creates an option to set the glyph scale.

func SetGrainIntensity added in v0.0.6

func SetGrainIntensity(v float64) func(any)

func SetHexBevelDepth added in v0.0.6

func SetHexBevelDepth(depth float64) func(any)

SetHexBevelDepth creates an option to set the depth of the soft inner shadow.

func SetHexPalette added in v0.0.6

func SetHexPalette(pal color.Palette) func(any)

SetHexPalette creates an option to set the palette used by the HexGrid.

func SetHueJitter added in v0.0.6

func SetHueJitter(v float64) func(any)

func SetLatitudeLines added in v0.0.4

func SetLatitudeLines(v int) func(any)

SetLatitudeLines creates an option to set the latitude lines.

func SetLightThreadColor added in v0.0.6

func SetLightThreadColor(col color.Color) func(any)

func SetLineColor added in v0.0.2

func SetLineColor(v color.Color) func(any)

SetLineColor creates an option to set the line color.

func SetLineImageSource added in v0.0.2

func SetLineImageSource(v image.Image) func(any)

SetLineImageSource creates an option to set the line image source.

func SetLineSize added in v0.0.2

func SetLineSize(v int) func(any)

SetLineSize creates an option to set the line size.

func SetLineThickness added in v0.0.6

func SetLineThickness(thickness int) func(any)

SetLineThickness configures the thickness of each horizontal band.

func SetLongitudeLines added in v0.0.4

func SetLongitudeLines(v int) func(any)

SetLongitudeLines creates an option to set the longitude lines.

func SetMaxRadius added in v0.0.2

func SetMaxRadius(v float64) func(any)

SetMaxRadius creates an option to set the maximum radius.

func SetMinRadius added in v0.0.2

func SetMinRadius(v float64) func(any)

SetMinRadius creates an option to set the minimum radius.

func SetMortarDepth added in v0.0.6

func SetMortarDepth(v float64) func(any)

func SetMortarImage added in v0.0.3

func SetMortarImage(img image.Image) func(any)

func SetMortarSize added in v0.0.3

func SetMortarSize(s int) func(any)

func SetNoiseAlgorithm added in v0.0.2

func SetNoiseAlgorithm(algo NoiseAlgorithm) func(any)

func SetNoiseIntensity added in v0.0.2

func SetNoiseIntensity(f float64) func(any)

func SetOffsetStrength added in v0.0.6

func SetOffsetStrength(strength float64) func(any)

SetOffsetStrength controls the per-channel vertical offset used when sampling the alternating lines.

func SetPCBPadDensity added in v0.0.6

func SetPCBPadDensity(v float64) func(any)

SetPCBPadDensity creates an option to set pad density for PCBTraces.

func SetPaintColor added in v0.0.6

func SetPaintColor(c color.RGBA) func(any)

func SetPaintWear added in v0.0.6

func SetPaintWear(v float64) func(any)

func SetPalette added in v0.0.6

func SetPalette(v ...color.Color) func(any)

SetPalette creates an option to set a color palette.

func SetPhase added in v0.0.2

func SetPhase(v float64) func(any)

SetPhase creates an option to set the phase.

func SetPlankBaseWidth added in v0.0.6

func SetPlankBaseWidth(w int) func(any)

func SetPlankWidthVariance added in v0.0.6

func SetPlankWidthVariance(v float64) func(any)

func SetPredicate added in v0.0.2

func SetPredicate(p ColorPredicate) func(any)

func SetRadius added in v0.0.2

func SetRadius(v int) func(any)

SetRadius creates an option to set the radius.

func SetRuneColor added in v0.0.6

func SetRuneColor(v color.Color) func(any)

SetRuneColor creates an option to set the rune color.

func SetScaleRadius added in v0.0.3

func SetScaleRadius(v int) func(any)

func SetScaleXSpacing added in v0.0.3

func SetScaleXSpacing(v int) func(any)

func SetScaleYSpacing added in v0.0.3

func SetScaleYSpacing(v int) func(any)

func SetScanlineFrequency added in v0.0.2

func SetScanlineFrequency(f float64) func(any)

func SetScanlineIntensity added in v0.0.2

func SetScanlineIntensity(f float64) func(any)

func SetScatterDensity added in v0.0.3

func SetScatterDensity(d float64) func(any)

SetScatterDensity sets the probability (0-1) of an item appearing in a cell.

func SetScatterFrequency added in v0.0.3

func SetScatterFrequency(f float64) func(any)

SetScatterFrequency sets the frequency (density of grid cells).

func SetScatterGenerator added in v0.0.3

func SetScatterGenerator(g ScatterGenerator) func(any)

SetScatterGenerator sets the item generator function.

func SetScatterMaxOverlap added in v0.0.3

func SetScatterMaxOverlap(overlap int) func(any)

SetScatterMaxOverlap sets the radius of neighbor cells to check.

func SetSeed added in v0.0.2

func SetSeed(v int64) func(any)

SetSeed creates an option to set the seed.

func SetSerpentine added in v0.0.2

func SetSerpentine(v bool) func(any)

SetSerpentine creates an option to set serpentine scanning.

func SetSolderMaskTint added in v0.0.6

func SetSolderMaskTint(v color.Color) func(any)

SetSolderMaskTint creates an option to tint the solder mask.

func SetSpaceColor added in v0.0.2

func SetSpaceColor(v color.Color) func(any)

SetSpaceColor creates an option to set the space color.

func SetSpaceImageSource added in v0.0.2

func SetSpaceImageSource(v image.Image) func(any)

SetSpaceImageSource creates an option to set the space image source.

func SetSpaceSize added in v0.0.2

func SetSpaceSize(v int) func(any)

SetSpaceSize creates an option to set the space size.

func SetSpacing added in v0.0.2

func SetSpacing(v int) func(any)

SetSpacing creates an option to set the spacing.

func SetStartColor added in v0.0.2

func SetStartColor(v color.Color) func(any)

SetStartColor creates an option to set the start color.

func SetStreakLength added in v0.0.6

func SetStreakLength(length int) func(any)

SetStreakLength sets how far the streaking extends along the wind.

func SetThreadWidth added in v0.0.6

func SetThreadWidth(v int) func(any)

func SetThreshold added in v0.0.6

func SetThreshold(t float64) func(any)

func SetTileGapWidth added in v0.0.6

func SetTileGapWidth(v float64) func(any)

SetTileGapWidth configures the mortar gap width in Worley distance space (0-1).

func SetTileJitter added in v0.0.6

func SetTileJitter(j float64) func(any)

SetTileJitter sets the Worley point jitter inside each cell (0-1).

func SetTilePalette added in v0.0.6

func SetTilePalette(colors ...color.RGBA) func(any)

SetTilePalette overrides the default palette used for stones.

func SetTilePaletteSpread added in v0.0.6

func SetTilePaletteSpread(v float64) func(any)

SetTilePaletteSpread configures how much each stone jitters its color palette (0-1).

func SetTileStoneSize added in v0.0.6

func SetTileStoneSize(v float64) func(any)

SetTileStoneSize sets the desired average stone size (in pixels).

func SetTilt added in v0.0.4

func SetTilt(v float64) func(any)

SetTilt creates an option to set the tilt.

func SetTrueColor added in v0.0.2

func SetTrueColor(v color.Color) func(any)

SetTrueColor creates an option to set the "true" color.

func SetVignetteRadius added in v0.0.6

func SetVignetteRadius(radius float64) func(any)

SetVignetteRadius adjusts the radius (in normalized 0..1 units of the shortest canvas dimension) where the vignette falloff begins.

func SetWindAngle added in v0.0.6

func SetWindAngle(angle float64) func(any)

SetWindAngle sets the wind direction in degrees.

func SetWindContrast added in v0.0.6

func SetWindContrast(contrast float64) func(any)

SetWindContrast adjusts the luminance exponent applied after streaking.

func SetWindNoise added in v0.0.6

func SetWindNoise(img image.Image) func(any)

SetWindNoise swaps the underlying noise source.

func SetWindSource added in v0.0.3

func SetWindSource(src image.Image) func(any)

SetWindSource sets the pattern used for wind (bending).

func SetWorleyJitter added in v0.0.3

func SetWorleyJitter(j float64) func(any)

SetWorleyJitter sets the jitter amount (0.0 to 1.0).

func SetWorleyMetric added in v0.0.3

func SetWorleyMetric(m DistanceMetric) func(any)

SetWorleyMetric sets the distance metric.

func SetWorleyOutput added in v0.0.3

func SetWorleyOutput(o WorleyOutput) func(any)

SetWorleyOutput sets the output type.

func SetXRange added in v0.0.2

func SetXRange(min, max float64) func(any)

SetXRange sets the logical X range for the heatmap.

func SetYRange added in v0.0.2

func SetYRange(min, max float64) func(any)

SetYRange sets the logical Y range for the heatmap.

func SetZRange added in v0.0.2

func SetZRange(min, max float64) func(any)

SetZRange sets the expected Z range (value range) for the heatmap color mapping.

func SpeedLinesLinearType added in v0.0.2

func SpeedLinesLinearType() func(any)

Option for setting Linear Type

func StableHash added in v0.0.6

func StableHash(x, y int, seed uint64) uint64

StableHash is a stateless, deterministic hash function based on coordinates and a seed. It serves as the standard "random" source for stochastic patterns in this library, ensuring that the same coordinates and seed always produce the same output.

The algorithm is a variant of SplitMix64, chosen for its good distribution and speed.

func WarpDistortion added in v0.0.3

func WarpDistortion(img image.Image) func(any)

WarpDistortion sets the distortion map (affects both X and Y).

func WarpDistortionScale added in v0.0.3

func WarpDistortionScale(scale float64) func(any)

WarpDistortionScale sets the scale for sampling the distortion image (zooming into noise).

func WarpDistortionX added in v0.0.3

func WarpDistortionX(img image.Image) func(any)

WarpDistortionX sets the distortion map for the X axis.

func WarpDistortionY added in v0.0.3

func WarpDistortionY(img image.Image) func(any)

WarpDistortionY sets the distortion map for the Y axis.

func WarpScale added in v0.0.3

func WarpScale(scale float64) func(any)

WarpScale sets the global distortion scale (magnitude).

func WarpXScale added in v0.0.3

func WarpXScale(scale float64) func(any)

WarpXScale sets the X distortion scale (magnitude).

func WarpYScale added in v0.0.3

func WarpYScale(scale float64) func(any)

WarpYScale sets the Y distortion scale (magnitude).

func WithSeed added in v0.0.6

func WithSeed(v uint64) func(any)

WithSeed creates an option to set the seed using uint64. This is the preferred option for consistency.

Types

type AmbientOcclusion added in v0.0.6

type AmbientOcclusion struct {
	Source image.Image
	Radius int
}

AmbientOcclusion calculates AO from a height map using a sampling kernel.

func (*AmbientOcclusion) At added in v0.0.6

func (ao *AmbientOcclusion) At(x, y int) color.Color

func (*AmbientOcclusion) Bounds added in v0.0.6

func (ao *AmbientOcclusion) Bounds() image.Rectangle

func (*AmbientOcclusion) ColorModel added in v0.0.6

func (ao *AmbientOcclusion) ColorModel() color.Model

type And added in v0.0.2

type And struct {
	BooleanImage
}

And represents a boolean AND operation.

type Angle added in v0.0.2

type Angle struct {
	Angle float64
}

Angle configures an angle option.

func (*Angle) SetAngle added in v0.0.2

func (s *Angle) SetAngle(v float64)

type Angles added in v0.0.2

type Angles struct {
	Angles []float64
}

Angles configures a list of angles in degrees.

func (*Angles) SetAngles added in v0.0.2

func (s *Angles) SetAngles(v []float64)

type BayerDither added in v0.0.2

type BayerDither struct {
	Null
	Input   image.Image
	Matrix  []uint8
	Size    int // 2, 4, 8
	Palette []color.Color
}

BayerDither applies ordered dithering using a Bayer matrix.

func (*BayerDither) At added in v0.0.2

func (p *BayerDither) At(x, y int) color.Color

type Blend added in v0.0.3

type Blend struct {
	Null
	Image1 image.Image // Background
	Image2 image.Image // Foreground
	Mode   BlendMode
}

Blend combines two images using a specified blend mode.

func (*Blend) At added in v0.0.3

func (b *Blend) At(x, y int) color.Color

type BlendMode added in v0.0.3

type BlendMode int
const (
	BlendAdd BlendMode = iota
	BlendMultiply
	BlendAverage
	BlendScreen
	BlendOverlay
	BlendNormal // Standard Alpha Blending (Source Over Destination)
)

type BlockSize added in v0.0.6

type BlockSize struct {
	BlockSize int
}

BlockSize configures the size of pixel blocks in a pattern.

func (*BlockSize) SetBlockSize added in v0.0.6

func (s *BlockSize) SetBlockSize(v int)

type BlueNoise added in v0.0.2

type BlueNoise struct {
	Null
	Seed   int64
	Values []uint8
	// contains filtered or unexported fields
}

BlueNoise generates a blue noise texture approximation. We use Mitchell's Best-Candidate Algorithm to generate points, then rasterize them with a slight Gaussian blur (conceptually) or return high-frequency noise.

Blue noise is characterized by minimal low-frequency components and no spectral peaks.

For this implementation, we will generate a set of points that are well-separated (Poisson Disk-like) and then return a value based on the distance to the nearest point, or simply fill pixels.

A better "Blue Noise Mask" for dithering is usually a dense array of values 0-255 arranged such that thresholding at any level produces a blue noise distribution. Generating such a mask (e.g. via Void-and-Cluster) is expensive (O(N^2) or O(N^3)).

We will implement a simplified generator that tries to maintain separation.

func (*BlueNoise) At added in v0.0.2

func (p *BlueNoise) At(x, y int) color.Color

func (*BlueNoise) SetSeed added in v0.0.2

func (p *BlueNoise) SetSeed(v int64)

func (*BlueNoise) SetSeedUint64 added in v0.0.6

func (p *BlueNoise) SetSeedUint64(v uint64)

type BooleanImage added in v0.0.2

type BooleanImage struct {
	Null
	Op        BooleanOpType
	Inputs    []image.Image
	Predicate ColorPredicate
	TrueColor
	FalseColor
	Mode      BooleanMode
	Threshold float64
}

BooleanImage represents a boolean or fuzzy logic operation on input images.

func (*BooleanImage) At added in v0.0.2

func (bi *BooleanImage) At(x, y int) color.Color

func (*BooleanImage) SetBooleanMode added in v0.0.6

func (bi *BooleanImage) SetBooleanMode(m BooleanMode)

func (*BooleanImage) SetPredicate added in v0.0.2

func (bi *BooleanImage) SetPredicate(p ColorPredicate)

func (*BooleanImage) SetThreshold added in v0.0.6

func (bi *BooleanImage) SetThreshold(t float64)

type BooleanMode added in v0.0.6

type BooleanMode int
const (
	ModeAuto          BooleanMode = iota // Infer mode based on configuration
	ModeFuzzy                            // Predicate -> Float Logic -> Interpolate
	ModeThreshold                        // Predicate -> Threshold (0/1) -> Boolean Logic -> Select Color (Strict True/False)
	ModeComponentWise                    // R=Min(Ra, Rb), etc.
	ModeBitwise                          // R=Ra & Rb, etc.
)

type BooleanOpType added in v0.0.2

type BooleanOpType int
const (
	OpAnd BooleanOpType = iota
	OpOr
	OpXor
	OpNot
	OpBitwiseAnd
	OpBitwiseOr
	OpBitwiseXor
	OpBitwiseNot
)

type Bounded added in v0.0.2

type Bounded interface {
	PatternBounds() Bounds
}

Bounded is the interface that bounded objects should implement. Note: The method is named PatternBounds to avoid conflict with image.Image.Bounds().

type Bounds added in v0.0.2

type Bounds struct {
	Left, Right, Top, Bottom *Range
}

Bounds defines the boundaries of an object using Ranges.

type Brick added in v0.0.3

type Brick struct {
	Null
	Width, Height int
	MortarSize    int
	Offset        float64
	BrickImages   []image.Image
	MortarImage   image.Image
	Seed
}

Brick is a pattern that simulates a brick wall with running bond layout. It supports configurable brick size, mortar size, row offset, and multiple brick textures.

func (*Brick) At added in v0.0.3

func (b *Brick) At(x, y int) color.Color

func (*Brick) SetBrickImages added in v0.0.3

func (b *Brick) SetBrickImages(imgs []image.Image)

func (*Brick) SetBrickOffset added in v0.0.3

func (b *Brick) SetBrickOffset(o float64)

func (*Brick) SetBrickSize added in v0.0.3

func (b *Brick) SetBrickSize(w, h int)

func (*Brick) SetMortarImage added in v0.0.3

func (b *Brick) SetMortarImage(img image.Image)

func (*Brick) SetMortarSize added in v0.0.3

func (b *Brick) SetMortarSize(s int)

type BrickOffset added in v0.0.3

type BrickOffset struct{ Offset float64 }

func (*BrickOffset) SetBrickOffset added in v0.0.3

func (p *BrickOffset) SetBrickOffset(o float64)

type BrickSize added in v0.0.3

type BrickSize struct{ Width, Height int }

func (*BrickSize) SetBrickSize added in v0.0.3

func (p *BrickSize) SetBrickSize(w, h int)

type Buffer added in v0.0.6

type Buffer struct {
	Null
	Expiry
	Source      image.Image
	Cached      image.Image
	LastRefresh time.Time
	// contains filtered or unexported fields
}

Buffer acts as a cache for a source image.

func NewBuffer added in v0.0.6

func NewBuffer(source image.Image, ops ...func(any)) *Buffer

NewBuffer creates a new Buffer pattern.

func (*Buffer) At added in v0.0.6

func (b *Buffer) At(x, y int) color.Color

At returns the color of the pixel at (x, y).

func (*Buffer) IsDirty added in v0.0.6

func (b *Buffer) IsDirty() bool

IsDirty checks if the buffer needs refreshing.

func (*Buffer) Refresh added in v0.0.6

func (b *Buffer) Refresh()

Refresh updates the cached image from the source.

func (*Buffer) SetDirty added in v0.0.6

func (b *Buffer) SetDirty()

SetDirty explicitly marks the buffer as dirty.

type Center added in v0.0.2

type Center struct {
	CenterX, CenterY int
}

Center configures the center point of a pattern (integer coordinates).

func (*Center) SetCenter added in v0.0.2

func (c *Center) SetCenter(x, y int)

type Checker

type Checker struct {
	Null
	SpaceSize
	// contains filtered or unexported fields
}

Checker is a pattern that alternates between two colors in a checkerboard fashion.

func (*Checker) At

func (c *Checker) At(x, y int) color.Color

func (*Checker) Bounds

func (c *Checker) Bounds() image.Rectangle

func (*Checker) ColorModel

func (c *Checker) ColorModel() color.Model

type ChipIntensity added in v0.0.6

type ChipIntensity struct{ Amount float64 }

func (*ChipIntensity) SetChipIntensity added in v0.0.6

func (c *ChipIntensity) SetChipIntensity(v float64)

type ChippedBrick added in v0.0.6

type ChippedBrick struct {
	Null
	BrickWidth, BrickHeight int
	MortarSize              int
	ChipIntensity           float64
	MortarDepth             float64
	HueJitter               float64
	Offset                  float64
	Seed
}

ChippedBrick renders a brick wall with hue jitter per brick, chipped edges, and uneven mortar shading.

func (*ChippedBrick) At added in v0.0.6

func (b *ChippedBrick) At(x, y int) color.Color

func (*ChippedBrick) ColorModel added in v0.0.6

func (b *ChippedBrick) ColorModel() color.Model

func (*ChippedBrick) SetBounds added in v0.0.6

func (b *ChippedBrick) SetBounds(r image.Rectangle)

func (*ChippedBrick) SetBrickOffset added in v0.0.6

func (b *ChippedBrick) SetBrickOffset(v float64)

func (*ChippedBrick) SetBrickSize added in v0.0.6

func (b *ChippedBrick) SetBrickSize(w, h int)

func (*ChippedBrick) SetChipIntensity added in v0.0.6

func (b *ChippedBrick) SetChipIntensity(v float64)

func (*ChippedBrick) SetHueJitter added in v0.0.6

func (b *ChippedBrick) SetHueJitter(v float64)

func (*ChippedBrick) SetMortarDepth added in v0.0.6

func (b *ChippedBrick) SetMortarDepth(v float64)

func (*ChippedBrick) SetMortarSize added in v0.0.6

func (b *ChippedBrick) SetMortarSize(v int)

func (*ChippedBrick) SetSeed added in v0.0.6

func (b *ChippedBrick) SetSeed(v int64)

func (*ChippedBrick) SetSeedUint64 added in v0.0.6

func (b *ChippedBrick) SetSeedUint64(v uint64)

type ChunkyBands added in v0.0.6

type ChunkyBands struct {
	Null
	Angle
	BlockSize
	Palette
}

ChunkyBands composes chunky pixel bands at a configurable angle.

func (*ChunkyBands) At added in v0.0.6

func (p *ChunkyBands) At(x, y int) color.Color

type Circle added in v0.0.2

Circle is a pattern that draws a circle fitting within its bounds. It supports a border (LineSize, LineColor, LineImageSource) and a fill (FillColor, FillImageSource).

func (*Circle) At added in v0.0.2

func (p *Circle) At(x, y int) color.Color

type ColorMap added in v0.0.2

type ColorMap struct {
	Null
	Source image.Image
	Stops  []ColorStop
}

ColorMap applies a color ramp to the luminance of the source image.

func (*ColorMap) At added in v0.0.2

func (c *ColorMap) At(x, y int) color.Color

At returns the color at (x, y).

func (*ColorMap) Bounds added in v0.0.2

func (c *ColorMap) Bounds() image.Rectangle

type ColorPredicate added in v0.0.2

type ColorPredicate func(c color.Color) float64

ColorPredicate converts a color to a fuzzy value between 0.0 and 1.0.

func PredicateAlphaThreshold added in v0.0.2

func PredicateAlphaThreshold(threshold uint8) ColorPredicate

AlphaThreshold returns 1.0 if alpha >= threshold, else 0.0

func PredicateAverageGrayAbove added in v0.0.2

func PredicateAverageGrayAbove(threshold uint8) ColorPredicate

AverageGrayAbove returns 1.0 if average of RGB >= threshold, else 0.0

func PredicateFuzzyAlpha added in v0.0.2

func PredicateFuzzyAlpha() ColorPredicate

FuzzyAlpha returns the alpha value as a float 0-1

func PredicateFuzzyRed added in v0.0.2

func PredicateFuzzyRed() ColorPredicate

FuzzyRed returns the red value as a float 0-1

func PredicateRedAbove added in v0.0.2

func PredicateRedAbove(threshold uint8) ColorPredicate

RedAbove returns 1.0 if red >= threshold, else 0.0

type ColorStop added in v0.0.2

type ColorStop struct {
	Position float64
	Color    color.Color
}

ColorStop defines a color at a specific position (0.0 to 1.0) in the map.

type ConcentricRings added in v0.0.2

type ConcentricRings struct {
	Null
	Center
	Frequency
	FrequencyX
	FrequencyY
	Colors []color.Color
}

ConcentricRings generates concentric rings using sqrt(x^2 + y^2) % n.

func (*ConcentricRings) At added in v0.0.2

func (p *ConcentricRings) At(x, y int) color.Color

type ConcentricWater added in v0.0.6

type ConcentricWater struct {
	Null
	Center

	RingSpacing      float64
	Amplitude        float64
	AmplitudeFalloff float64
	BaseTint         color.RGBA
	NormalStrength   float64
	// contains filtered or unexported fields
}

ConcentricWater renders concentric distance-field ripples with sine-driven height that modulates both tint and inferred normals for a water-like look.

func (*ConcentricWater) At added in v0.0.6

func (cw *ConcentricWater) At(x, y int) color.Color

func (*ConcentricWater) Bounds added in v0.0.6

func (cw *ConcentricWater) Bounds() image.Rectangle

func (*ConcentricWater) ColorModel added in v0.0.6

func (cw *ConcentricWater) ColorModel() color.Model

type ConicGradient added in v0.0.2

type ConicGradient struct {
	Null
	StartColor
	EndColor
	FloatCenter
	UseFloatCenter bool
}

ConicGradient represents a conic (angular) color gradient.

func (*ConicGradient) At added in v0.0.2

func (g *ConicGradient) At(x, y int) color.Color

At returns the color at (x, y).

type Crop added in v0.0.2

type Crop struct {
	// contains filtered or unexported fields
}

func (*Crop) At added in v0.0.2

func (c *Crop) At(x, y int) color.Color

func (*Crop) Bounds added in v0.0.2

func (c *Crop) Bounds() image.Rectangle

func (*Crop) ColorModel added in v0.0.2

func (c *Crop) ColorModel() color.Model

type CrossHatch added in v0.0.2

CrossHatch is a pattern that draws layered diagonal hatch lines.

func (*CrossHatch) At added in v0.0.2

func (p *CrossHatch) At(x, y int) color.Color

func (*CrossHatch) SetAngle added in v0.0.2

func (p *CrossHatch) SetAngle(v float64)

type CrossShadow added in v0.0.6

type CrossShadow struct{ Depth float64 }

func (*CrossShadow) SetCrossShadowDepth added in v0.0.6

func (c *CrossShadow) SetCrossShadowDepth(v float64)

type CryptoNoise added in v0.0.2

type CryptoNoise struct{}

CryptoNoise uses crypto/rand.

func (*CryptoNoise) At added in v0.0.2

func (c *CryptoNoise) At(x, y int) color.Color

type Curvature added in v0.0.6

type Curvature struct {
	Source image.Image
}

Curvature calculates curvature (convex/concave) from a height map.

func (*Curvature) At added in v0.0.6

func (c *Curvature) At(x, y int) color.Color

func (*Curvature) Bounds added in v0.0.6

func (c *Curvature) Bounds() image.Rectangle

func (*Curvature) ColorModel added in v0.0.6

func (c *Curvature) ColorModel() color.Model

type DarkColor added in v0.0.6

type DarkColor struct{ Color color.Color }

func (*DarkColor) SetDarkThreadColor added in v0.0.6

func (c *DarkColor) SetDarkThreadColor(col color.Color)

type Density added in v0.0.2

type Density struct {
	Density float64
}

Density configures the density of a pattern.

func (*Density) SetDensity added in v0.0.2

func (s *Density) SetDensity(v float64)

type DiffusionItem added in v0.0.2

type DiffusionItem struct {
	DX, DY int
	Weight float64
}

DiffusionItem represents a single weight in the kernel.

type DiffusionKernel added in v0.0.2

type DiffusionKernel struct {
	Items   []DiffusionItem
	Divisor float64
}

DiffusionKernel represents the error diffusion kernel. It consists of a list of weights applied to neighboring pixels.

type DirtyAware added in v0.0.6

type DirtyAware interface {
	IsDirty() bool
}

DirtyAware is an interface for patterns that can report if they are dirty.

type DistanceMetric added in v0.0.3

type DistanceMetric int
const (
	MetricEuclidean DistanceMetric = iota
	MetricManhattan
	MetricChebyshev
)

type EdgeAwareness added in v0.0.2

type EdgeAwareness struct {
	EdgeAwareness float64
}

EdgeAwareness configures the strength of edge-aware diffusion.

func (*EdgeAwareness) SetEdgeAwareness added in v0.0.2

func (e *EdgeAwareness) SetEdgeAwareness(v float64)

type EdgeDetect added in v0.0.2

type EdgeDetect struct {
	// contains filtered or unexported fields
}

EdgeDetect is a pattern that applies edge detection (Sobel operator) to an underlying image.

func (*EdgeDetect) At added in v0.0.2

func (e *EdgeDetect) At(x, y int) color.Color

func (*EdgeDetect) Bounds added in v0.0.2

func (e *EdgeDetect) Bounds() image.Rectangle

func (*EdgeDetect) ColorModel added in v0.0.2

func (e *EdgeDetect) ColorModel() color.Model

type EndColor added in v0.0.2

type EndColor struct {
	EndColor color.Color
}

EndColor configures the end color for a gradient.

func (*EndColor) SetEndColor added in v0.0.2

func (s *EndColor) SetEndColor(v color.Color)

type ErrorDiffusion added in v0.0.2

type ErrorDiffusion struct {
	Null
	// contains filtered or unexported fields
}

ErrorDiffusion applies error diffusion dithering to an image.

func (*ErrorDiffusion) At added in v0.0.2

func (e *ErrorDiffusion) At(x, y int) color.Color

func (*ErrorDiffusion) SetEdgeAwareness added in v0.0.2

func (e *ErrorDiffusion) SetEdgeAwareness(v float64)

func (*ErrorDiffusion) SetGamma added in v0.0.2

func (e *ErrorDiffusion) SetGamma(v float64)

func (*ErrorDiffusion) SetSerpentine added in v0.0.2

func (e *ErrorDiffusion) SetSerpentine(v bool)

type Expiry added in v0.0.6

type Expiry struct {
	Expiry time.Duration
}

Expiry configures the expiry duration.

func (*Expiry) SetExpiry added in v0.0.6

func (s *Expiry) SetExpiry(v time.Duration)

type FalloffCurve added in v0.0.6

type FalloffCurve struct {
	FalloffCurve float64
}

FalloffCurve configures an exponent used for radial falloff calculations.

func (*FalloffCurve) SetFalloffCurve added in v0.0.6

func (f *FalloffCurve) SetFalloffCurve(v float64)

type FalseColor added in v0.0.2

type FalseColor struct {
	FalseColor color.Color
}

FalseColor configures the color used for "false" values in boolean/fuzzy operations.

func (*FalseColor) SetFalseColor added in v0.0.2

func (s *FalseColor) SetFalseColor(v color.Color)

type Fibonacci added in v0.0.2

type Fibonacci struct {
	Null
	LineSize
	LineColor
	SpaceColor
}

Fibonacci is a pattern that draws a Fibonacci (Golden) spiral. It uses the logarithmic spiral equation r = a * e^(b * theta) with b = 2*ln(Phi)/pi. It supports LineSize, LineColor, and SpaceColor.

func (*Fibonacci) At added in v0.0.2

func (p *Fibonacci) At(x, y int) color.Color

type FillColor added in v0.0.2

type FillColor struct {
	FillColor color.Color
}

FillColor configures the fill color in a pattern (e.g. for dots).

func (*FillColor) SetFillColor added in v0.0.2

func (s *FillColor) SetFillColor(v color.Color)

type FillImageSource added in v0.0.2

type FillImageSource struct {
	FillImageSource image.Image
}

FillImageSource configures an image source for fill in a pattern.

func (*FillImageSource) SetFillImageSource added in v0.0.2

func (s *FillImageSource) SetFillImageSource(v image.Image)

type FineGrid added in v0.0.6

type FineGrid struct {
	Null
	CellSize          int
	GlowRadius        float64
	Hue               float64
	AberrationOffset  int
	GlowStrength      float64
	LineCoreStrength  float64
	BackgroundOpacity float64
}

FineGrid renders a thin grid on black with a soft outer glow and mild chromatic aberration.

func (*FineGrid) At added in v0.0.6

func (g *FineGrid) At(x, y int) color.Color

func (*FineGrid) Bounds added in v0.0.6

func (g *FineGrid) Bounds() image.Rectangle

func (*FineGrid) ColorModel added in v0.0.6

func (g *FineGrid) ColorModel() color.Model

func (*FineGrid) SetFineGridCellSize added in v0.0.6

func (g *FineGrid) SetFineGridCellSize(size int)

func (*FineGrid) SetFineGridGlowRadius added in v0.0.6

func (g *FineGrid) SetFineGridGlowRadius(radius float64)

func (*FineGrid) SetFineGridHue added in v0.0.6

func (g *FineGrid) SetFineGridHue(h float64)

type FloatCenter added in v0.0.5

type FloatCenter struct {
	CenterX, CenterY float64
}

FloatCenter configures the center point of a pattern (float coordinates).

func (*FloatCenter) SetFloatCenter added in v0.0.5

func (c *FloatCenter) SetFloatCenter(x, y float64)

type Fog added in v0.0.6

type Fog struct {
	Null
	FillColor
	Density
	FloatCenter
	FalloffCurve
	// contains filtered or unexported fields
}

Fog renders a tinted, noise-driven fog with radial falloff. The center stays clearer than the edges to focus the viewer's eye.

func (*Fog) At added in v0.0.6

func (f *Fog) At(x, y int) color.Color

func (*Fog) ColorModel added in v0.0.6

func (f *Fog) ColorModel() color.Model

func (*Fog) SetFloatCenter added in v0.0.6

func (f *Fog) SetFloatCenter(x, y float64)

SetFloatCenter selects the normalized center for the falloff.

func (*Fog) SetNoiseAlgorithm added in v0.0.6

func (f *Fog) SetNoiseAlgorithm(algo NoiseAlgorithm)

SetNoiseAlgorithm allows swapping the underlying noise source.

type Frequency added in v0.0.3

type Frequency struct {
	Frequency float64
}

Frequency configures the frequency of a pattern.

func (*Frequency) SetFrequency added in v0.0.3

func (s *Frequency) SetFrequency(v float64)

type FrequencyX added in v0.0.3

type FrequencyX struct {
	FrequencyX float64
}

FrequencyX configures the X frequency of a pattern.

func (*FrequencyX) SetFrequencyX added in v0.0.3

func (s *FrequencyX) SetFrequencyX(v float64)

type FrequencyY added in v0.0.3

type FrequencyY struct {
	FrequencyY float64
}

FrequencyY configures the Y frequency of a pattern.

func (*FrequencyY) SetFrequencyY added in v0.0.3

func (s *FrequencyY) SetFrequencyY(v float64)

type Gamma added in v0.0.2

type Gamma struct {
	Gamma float64
}

Gamma configures gamma correction.

func (*Gamma) SetGamma added in v0.0.2

func (g *Gamma) SetGamma(v float64)

type Generic added in v0.0.6

type Generic struct {
	Func func(x, y int) color.Color
}

func (*Generic) At added in v0.0.6

func (p *Generic) At(x, y int) color.Color

func (*Generic) Bounds added in v0.0.6

func (p *Generic) Bounds() image.Rectangle

func (*Generic) ColorModel added in v0.0.6

func (p *Generic) ColorModel() color.Model

type Globe added in v0.0.4

type Globe struct {
	Null
	FillImageSource
	LatitudeLines  // Number of lines along latitude
	LongitudeLines // Number of lines along longitude
	Angle          // Rotation around Y axis (in degrees)
	Tilt           // Rotation around X axis (in degrees)
	LineColor
	SpaceColor
}

Globe renders a 3D sphere projected onto 2D. It supports configurable latitude and longitude grid lines, 3D rotation via Angle (Y-axis) and Tilt (X-axis/Z-axis), and texture mapping via FillImageSource with UV coordinates.

func (*Globe) At added in v0.0.4

func (p *Globe) At(x, y int) color.Color

type GlyphRing added in v0.0.6

type GlyphRing struct {
	Null
	Radius
	Density
	Seed
	GlowColor     color.Color
	RuneColor     color.Color
	BandColor     color.Color
	Background    color.Color
	BandThickness int
	GlowSize      int
	GlyphSize     int
	// contains filtered or unexported fields
}

GlyphRing renders a circular band with glyphs stamped around its circumference and a soft outer glow. Parameters of interest:

  • Radius (via SetRadius): controls the ring radius relative to the bounds.
  • Density (via SetDensity): controls how many runes appear around the circle.
  • GlowColor (via SetGlowColor): sets the tint of the exterior glow.

Additional styling controls (rune, band, and background colors plus sizing) are provided via setters.

func (*GlyphRing) At added in v0.0.6

func (p *GlyphRing) At(x, y int) color.Color

func (*GlyphRing) Bounds added in v0.0.6

func (p *GlyphRing) Bounds() image.Rectangle

func (*GlyphRing) ColorModel added in v0.0.6

func (p *GlyphRing) ColorModel() color.Model

func (*GlyphRing) SetBackgroundColor added in v0.0.6

func (p *GlyphRing) SetBackgroundColor(v color.Color)

SetBackgroundColor sets the background color.

func (*GlyphRing) SetBandColor added in v0.0.6

func (p *GlyphRing) SetBandColor(v color.Color)

SetBandColor sets the ring body color.

func (*GlyphRing) SetBandThickness added in v0.0.6

func (p *GlyphRing) SetBandThickness(v int)

SetBandThickness adjusts the ring thickness.

func (*GlyphRing) SetGlowColor added in v0.0.6

func (p *GlyphRing) SetGlowColor(v color.Color)

SetGlowColor sets the outer glow color.

func (*GlyphRing) SetGlowSize added in v0.0.6

func (p *GlyphRing) SetGlowSize(v int)

SetGlowSize adjusts the glow falloff width.

func (*GlyphRing) SetGlyphSize added in v0.0.6

func (p *GlyphRing) SetGlyphSize(v int)

SetGlyphSize adjusts the glyph scale.

func (*GlyphRing) SetRuneColor added in v0.0.6

func (p *GlyphRing) SetRuneColor(v color.Color)

SetRuneColor sets the glyph fill color.

type GrassClose added in v0.0.3

type GrassClose struct {
	Null
	BladeWidth  float64
	BladeHeight float64
	FillColor               // Blade color
	Source      image.Image // Background
	Wind        image.Image // Controls bend
	Density     image.Image // Controls density
	Seed        int64
}

GrassClose is a pattern that generates procedural grass blades.

func (*GrassClose) At added in v0.0.3

func (p *GrassClose) At(x, y int) color.Color

func (*GrassClose) Bounds added in v0.0.3

func (p *GrassClose) Bounds() image.Rectangle

func (*GrassClose) ColorModel added in v0.0.3

func (p *GrassClose) ColorModel() color.Model

type Grid added in v0.0.2

type Grid struct {
	// contains filtered or unexported fields
}

func (*Grid) At added in v0.0.2

func (g *Grid) At(x, y int) color.Color

func (*Grid) Bounds added in v0.0.2

func (g *Grid) Bounds() image.Rectangle

func (*Grid) ColorModel added in v0.0.2

func (g *Grid) ColorModel() color.Model

func (*Grid) SetBounds added in v0.0.2

func (g *Grid) SetBounds(b image.Rectangle)

type HashNoise added in v0.0.2

type HashNoise struct {
	Seed int64
}

HashNoise uses a high-quality, stateless pseudo-random number generator based on coordinates. It produces a non-repeating pattern derived algorithmically.

func (*HashNoise) At added in v0.0.2

func (h *HashNoise) At(x, y int) color.Color

type Heatmap added in v0.0.2

type Heatmap struct {
	Null
	StartColor
	EndColor
	Func       HeatmapFunc
	MinX, MaxX float64
	MinY, MaxY float64
	MinZ, MaxZ float64
}

Heatmap generates a color gradient based on a 2D scalar function.

func (*Heatmap) At added in v0.0.2

func (h *Heatmap) At(x, y int) color.Color

At returns the color at (x, y).

type HeatmapFunc added in v0.0.2

type HeatmapFunc func(x, y float64) float64

HeatmapFunc is the function signature for the heatmap generator. It accepts logical coordinates (x, y) and returns a scalar value z.

type HexGrid added in v0.0.6

type HexGrid struct {
	Null
	Radius
	Palette    color.Palette
	BevelDepth float64
}

HexGrid renders an axial-coordinate hexagonal grid with alternating colors and a soft inner shadow near the cell edges.

func (*HexGrid) At added in v0.0.6

func (h *HexGrid) At(x, y int) color.Color

func (*HexGrid) Bounds added in v0.0.6

func (h *HexGrid) Bounds() image.Rectangle

func (*HexGrid) ColorModel added in v0.0.6

func (h *HexGrid) ColorModel() color.Model

func (*HexGrid) SetHexBevelDepth added in v0.0.6

func (h *HexGrid) SetHexBevelDepth(depth float64)

func (*HexGrid) SetHexPalette added in v0.0.6

func (h *HexGrid) SetHexPalette(pal color.Palette)

type HorizontalLine added in v0.0.2

HorizontalLine is a pattern that draws horizontal lines.

func (*HorizontalLine) At added in v0.0.2

func (p *HorizontalLine) At(x, y int) color.Color

type KnollDither added in v0.0.3

type KnollDither struct {
	Null
	Input   image.Image
	Palette []color.Color
	Matrix  []int // Integer matrix 0..63 for 8x8
	Size    int
	// contains filtered or unexported fields
}

KnollDither implements Thomas Knoll's pattern dithering (Photoshop).

func (*KnollDither) At added in v0.0.3

func (p *KnollDither) At(x, y int) color.Color

type LatitudeLines added in v0.0.4

type LatitudeLines struct {
	LatitudeLines int
}

LatitudeLines configures the number of latitude lines.

func (*LatitudeLines) SetLatitudeLines added in v0.0.4

func (s *LatitudeLines) SetLatitudeLines(v int)

type LightColor added in v0.0.6

type LightColor struct{ Color color.Color }

func (*LightColor) SetLightThreadColor added in v0.0.6

func (c *LightColor) SetLightThreadColor(col color.Color)

type LineColor added in v0.0.2

type LineColor struct {
	LineColor color.Color
}

LineColor configures the color of lines in a pattern.

func (*LineColor) SetLineColor added in v0.0.2

func (s *LineColor) SetLineColor(v color.Color)

type LineImageSource added in v0.0.2

type LineImageSource struct {
	LineImageSource image.Image
}

LineImageSource configures an image source for lines in a pattern.

func (*LineImageSource) SetLineImageSource added in v0.0.2

func (s *LineImageSource) SetLineImageSource(v image.Image)

type LineSize added in v0.0.2

type LineSize struct {
	LineSize int
}

LineSize configures the thickness of lines in a pattern.

func (*LineSize) SetLineSize added in v0.0.2

func (s *LineSize) SetLineSize(v int)

type LinearGradient added in v0.0.2

type LinearGradient struct {
	Null
	StartColor
	EndColor
	Vertical bool
}

LinearGradient represents a linear color gradient.

func (*LinearGradient) At added in v0.0.2

func (g *LinearGradient) At(x, y int) color.Color

At returns the color at (x, y).

type LongitudeLines added in v0.0.4

type LongitudeLines struct {
	LongitudeLines int
}

LongitudeLines configures the number of longitude lines.

func (*LongitudeLines) SetLongitudeLines added in v0.0.4

func (s *LongitudeLines) SetLongitudeLines(v int)

type Material added in v0.0.6

type Material struct {
	Albedo    image.Image
	Normal    image.Image
	Roughness image.Image
	Metalness image.Image
	AO        image.Image
	Height    image.Image
}

Material is a collection of images representing different PBR channels.

type Maths added in v0.0.2

type Maths struct {
	Null
	Func MathsFunc
}

Maths is a pattern that generates colors based on a provided function.

func (*Maths) At added in v0.0.2

func (m *Maths) At(x, y int) color.Color

type MathsFunc added in v0.0.2

type MathsFunc func(x, y int) color.Color

MathsFunc is the function signature for the pattern generator.

type MaxRadius added in v0.0.2

type MaxRadius struct {
	MaxRadius float64
}

MaxRadius configures the maximum radius.

func (*MaxRadius) SetMaxRadius added in v0.0.2

func (s *MaxRadius) SetMaxRadius(v float64)

type MinRadius added in v0.0.2

type MinRadius struct {
	MinRadius float64
}

MinRadius configures the minimum radius.

func (*MinRadius) SetMinRadius added in v0.0.2

func (s *MinRadius) SetMinRadius(v float64)

type Mirror added in v0.0.2

type Mirror struct {
	// contains filtered or unexported fields
}

Mirror is a pattern that mirrors (flips) the X and/or Y coordinates of an underlying image.

func (*Mirror) At added in v0.0.2

func (m *Mirror) At(x, y int) color.Color

func (*Mirror) Bounds added in v0.0.2

func (m *Mirror) Bounds() image.Rectangle

func (*Mirror) ColorModel added in v0.0.2

func (m *Mirror) ColorModel() color.Model

type ModuloStripe added in v0.0.2

type ModuloStripe struct {
	Null
	Colors []color.Color
}

ModuloStripe generates a pattern based on (x + y) % n.

func (*ModuloStripe) At added in v0.0.2

func (p *ModuloStripe) At(x, y int) color.Color

type MortarDepth added in v0.0.6

type MortarDepth struct{ Depth float64 }

func (*MortarDepth) SetMortarDepth added in v0.0.6

func (m *MortarDepth) SetMortarDepth(v float64)

type MortarSize added in v0.0.3

type MortarSize struct{ Size int }

func (*MortarSize) SetMortarSize added in v0.0.3

func (p *MortarSize) SetMortarSize(s int)

type MudTracksOption added in v0.0.6

type MudTracksOption func(*mudTracksConfig)

MudTracksOption configures the appearance of the mud tracks example/generator.

func SetMudTracksBandWidth added in v0.0.6

func SetMudTracksBandWidth(width int) MudTracksOption

SetMudTracksBandWidth sets the width of each compacted band.

func SetMudTracksDarkness added in v0.0.6

func SetMudTracksDarkness(value float64) MudTracksOption

SetMudTracksDarkness darkens the compacted mud and embedded pebbles (0 = light, 1 = dark).

func SetMudTracksWobble added in v0.0.6

func SetMudTracksWobble(amount float64) MudTracksOption

SetMudTracksWobble controls how much the bands meander vertically.

type MultiScaleOrderedDither added in v0.0.2

type MultiScaleOrderedDither struct {
	Null
	// contains filtered or unexported fields
}

MultiScaleOrderedDither blends between two matrices based on local variance.

func (*MultiScaleOrderedDither) At added in v0.0.2

func (d *MultiScaleOrderedDither) At(x, y int) color.Color

type Noise added in v0.0.2

type Noise struct {
	Null
	// contains filtered or unexported fields
}

Noise pattern generates random noise based on a selected algorithm.

func (*Noise) At added in v0.0.2

func (n *Noise) At(x, y int) color.Color

func (*Noise) SetNoiseAlgorithm added in v0.0.2

func (n *Noise) SetNoiseAlgorithm(algo NoiseAlgorithm)

func (*Noise) SetSeed added in v0.0.6

func (n *Noise) SetSeed(v int64)

SetSeed sets the seed for the noise algorithm. It switches to HashNoise if the current algo is CryptoNoise.

func (*Noise) SetSeedUint64 added in v0.0.6

func (n *Noise) SetSeedUint64(v uint64)

SetSeedUint64 sets the seed for the noise algorithm. It switches to HashNoise if the current algo is CryptoNoise.

type NoiseAlgorithm added in v0.0.2

type NoiseAlgorithm interface {
	At(x, y int) color.Color
}

NoiseAlgorithm defines the source of randomness for the Noise pattern.

type NormalMap added in v0.0.5

type NormalMap struct {
	Source   image.Image
	Strength float64
}

NormalMap generates a tangent-space normal map from a source height map. The red channel represents the X (horizontal) vector. The green channel represents the Y (vertical) vector. The blue channel represents the Z (depth) vector.

func (*NormalMap) At added in v0.0.5

func (nm *NormalMap) At(x, y int) color.Color

At returns the normal map color at the specified coordinates.

func (*NormalMap) Bounds added in v0.0.5

func (nm *NormalMap) Bounds() image.Rectangle

Bounds delegates to the source image.

func (*NormalMap) ColorModel added in v0.0.5

func (nm *NormalMap) ColorModel() color.Model

ColorModel returns RGB.

type Not added in v0.0.2

type Not struct {
	BooleanImage
}

Not represents a boolean NOT operation.

type Null

type Null struct {
	// contains filtered or unexported fields
}

Null is a pattern that returns a transparent color for all pixels.

func (*Null) At

func (i *Null) At(x, y int) color.Color

func (*Null) Bounds

func (i *Null) Bounds() image.Rectangle

func (*Null) ColorModel

func (i *Null) ColorModel() color.Model

func (*Null) SetBounds

func (i *Null) SetBounds(bounds image.Rectangle)

type Or added in v0.0.2

type Or struct {
	BooleanImage
}

Or represents a boolean OR operation.

type OrderedDither added in v0.0.2

type OrderedDither struct {
	Null
	// contains filtered or unexported fields
}

OrderedDither applies ordered dithering using a threshold matrix.

func (*OrderedDither) At added in v0.0.2

func (d *OrderedDither) At(x, y int) color.Color

type PCBTraces added in v0.0.6

type PCBTraces struct {
	Null
	LineSize
	Seed
	// contains filtered or unexported fields
}

PCBTraces renders an orthogonal trace grid with vias and a solder-mask-tinted background.

func (*PCBTraces) At added in v0.0.6

func (p *PCBTraces) At(x, y int) color.Color

func (*PCBTraces) Bounds added in v0.0.6

func (p *PCBTraces) Bounds() image.Rectangle

func (*PCBTraces) ColorModel added in v0.0.6

func (p *PCBTraces) ColorModel() color.Model

func (*PCBTraces) SetBounds added in v0.0.6

func (p *PCBTraces) SetBounds(b image.Rectangle)

func (*PCBTraces) SetCopperColor added in v0.0.6

func (p *PCBTraces) SetCopperColor(c color.Color)

SetCopperColor customizes the copper color for traces and vias.

func (*PCBTraces) SetPadDensity added in v0.0.6

func (p *PCBTraces) SetPadDensity(v float64)

SetPadDensity adjusts how frequently vias appear (0..1 range recommended).

func (*PCBTraces) SetSolderMaskTint added in v0.0.6

func (p *PCBTraces) SetSolderMaskTint(c color.Color)

SetSolderMaskTint customizes the base solder mask color.

type Padding added in v0.0.2

type Padding struct {
	// contains filtered or unexported fields
}

func (*Padding) At added in v0.0.2

func (p *Padding) At(x, y int) color.Color

func (*Padding) Bounds added in v0.0.2

func (p *Padding) Bounds() image.Rectangle

func (*Padding) ColorModel added in v0.0.2

func (p *Padding) ColorModel() color.Model

type PaddingOption added in v0.0.2

type PaddingOption func(*paddingConfig)

func PaddingBackground added in v0.0.2

func PaddingBackground(bg image.Image) PaddingOption

func PaddingBottom added in v0.0.2

func PaddingBottom(m int) PaddingOption

func PaddingBoundary added in v0.0.2

func PaddingBoundary(r image.Rectangle) PaddingOption

func PaddingCenter added in v0.0.2

func PaddingCenter() PaddingOption

PaddingCenter attempts to center the image within the provided boundary. It requires PaddingBoundary to be set OR assumes the output size will be large enough. Actually, if we don't know the output size yet, "Center" is ambiguous. But we can define "Center" as: Calculate padding such that image is centered in `bounds`. This requires `bounds` to be known. If used with `PaddingBoundary`, we can calculate margins.

func PaddingCenterBox added in v0.0.2

func PaddingCenterBox(bounds image.Rectangle) PaddingOption

func PaddingCenterIn added in v0.0.2

func PaddingCenterIn(bounds image.Rectangle, imgBounds image.Rectangle) PaddingOption

func PaddingLeft added in v0.0.2

func PaddingLeft(m int) PaddingOption

func PaddingMargin added in v0.0.2

func PaddingMargin(m int) PaddingOption

func PaddingRight added in v0.0.2

func PaddingRight(m int) PaddingOption

func PaddingTop added in v0.0.2

func PaddingTop(m int) PaddingOption

type PaintedPlanks added in v0.0.6

type PaintedPlanks struct {
	Null

	BaseWidth      int
	WidthVariance  float64
	GrainIntensity float64
	PaintWear      float64

	PaintColor color.RGBA
	SeamColor  color.RGBA
	WoodDark   color.RGBA
	WoodLight  color.RGBA

	Seed
	// contains filtered or unexported fields
}

PaintedPlanks composes a set of vertical boards with wood grain and a chipped paint overlay.

func (*PaintedPlanks) At added in v0.0.6

func (p *PaintedPlanks) At(x, y int) color.Color

func (*PaintedPlanks) SetGrainIntensity added in v0.0.6

func (p *PaintedPlanks) SetGrainIntensity(v float64)

func (*PaintedPlanks) SetPaintColor added in v0.0.6

func (p *PaintedPlanks) SetPaintColor(c color.RGBA)

func (*PaintedPlanks) SetPaintWear added in v0.0.6

func (p *PaintedPlanks) SetPaintWear(v float64)

func (*PaintedPlanks) SetPlankBaseWidth added in v0.0.6

func (p *PaintedPlanks) SetPlankBaseWidth(w int)

Implement setters

func (*PaintedPlanks) SetPlankWidthVariance added in v0.0.6

func (p *PaintedPlanks) SetPlankWidthVariance(v float64)

type Palette added in v0.0.6

type Palette struct {
	Palette []color.Color
}

Palette configures a list of colors used by a pattern.

func (*Palette) SetPalette added in v0.0.6

func (s *Palette) SetPalette(v []color.Color)

type PerlinNoise added in v0.0.2

type PerlinNoise struct {
	Seed        int64
	Octaves     int
	Persistence float64 // Alpha
	Lacunarity  float64 // Beta
	Frequency   float64
	// contains filtered or unexported fields
}

PerlinNoise implements Improved Perlin Noise with Fractional Brownian Motion (fBm).

func (*PerlinNoise) At added in v0.0.2

func (n *PerlinNoise) At(x, y int) color.Color

type Phase added in v0.0.2

type Phase struct {
	Phase float64
}

Phase configures the phase/offset of a pattern.

func (*Phase) SetPhase added in v0.0.2

func (s *Phase) SetPhase(v float64)

type Plasma added in v0.0.2

type Plasma struct {
	Null
	Seed      int64
	Roughness float64
	Color     bool // If true, generates RGB plasma. If false, grayscale.
	// contains filtered or unexported fields
}

Plasma generates a plasma noise texture using Diamond-Square algorithm. It supports RGB (independent channels) or Grayscale.

func (*Plasma) At added in v0.0.2

func (p *Plasma) At(x, y int) color.Color

func (*Plasma) SetSeed added in v0.0.2

func (p *Plasma) SetSeed(v int64)

func (*Plasma) SetSeedUint64 added in v0.0.6

func (p *Plasma) SetSeedUint64(v uint64)

type Polka added in v0.0.2

type Polka struct {
	Null
	Radius
	Spacing
	FillColor
	SpaceColor
}

Polka is a pattern that displays a grid of circles (polka dots).

func (*Polka) At added in v0.0.2

func (p *Polka) At(x, y int) color.Color

func (*Polka) Bounds added in v0.0.2

func (p *Polka) Bounds() image.Rectangle

func (*Polka) ColorModel added in v0.0.2

func (p *Polka) ColorModel() color.Model

type Quantize added in v0.0.2

type Quantize struct {
	Null
	// contains filtered or unexported fields
}

Quantize reduces the number of colors in an image by quantizing each channel to a specified number of levels.

func (*Quantize) At added in v0.0.2

func (q *Quantize) At(x, y int) color.Color

func (*Quantize) Bounds added in v0.0.2

func (q *Quantize) Bounds() image.Rectangle

func (*Quantize) ColorModel added in v0.0.2

func (q *Quantize) ColorModel() color.Model

type RadialGradient added in v0.0.2

type RadialGradient struct {
	Null
	StartColor
	EndColor
	FloatCenter
	UseFloatCenter bool
}

RadialGradient represents a radial color gradient.

func (*RadialGradient) At added in v0.0.2

func (g *RadialGradient) At(x, y int) color.Color

At returns the color at (x, y).

type Radius added in v0.0.2

type Radius struct {
	Radius int
}

Radius configures the radius of circles/dots in a pattern.

func (*Radius) SetRadius added in v0.0.2

func (s *Radius) SetRadius(v int)

type RandomDither added in v0.0.2

type RandomDither struct {
	Null
	// contains filtered or unexported fields
}

RandomDither applies random noise dithering.

func (*RandomDither) At added in v0.0.2

func (d *RandomDither) At(x, y int) color.Color

type Range added in v0.0.2

type Range struct {
	Low, High *int
}

Range defines a range with optional low and high bounds. If Low or High is nil, it represents an unbounded range in that direction.

type Rect added in v0.0.2

Rect is a pattern that draws a filled rectangle.

func (*Rect) At added in v0.0.2

func (r *Rect) At(x, y int) color.Color

type Rotate added in v0.0.2

type Rotate struct {
	// contains filtered or unexported fields
}

Rotate is a pattern that rotates an underlying image by 90, 180, or 270 degrees.

func (*Rotate) At added in v0.0.2

func (r *Rotate) At(x, y int) color.Color

func (*Rotate) Bounds added in v0.0.2

func (r *Rotate) Bounds() image.Rectangle

func (*Rotate) ColorModel added in v0.0.2

func (r *Rotate) ColorModel() color.Model

type ScaleOption added in v0.0.2

type ScaleOption func(*scaleConfig)

ScaleOption defines options for the Scale pattern

func ScaleAlg deprecated added in v0.0.2

func ScaleAlg(s draw.Scaler) ScaleOption

Deprecated: Use ScaleUsing

func ScaleFactor deprecated added in v0.0.2

func ScaleFactor(f float64) ScaleOption

Deprecated: Use ScaleToRatio

func ScaleSize added in v0.0.2

func ScaleSize(w, h int) ScaleOption

Alias for backwards compatibility if needed, but user requested new names

func ScaleToFraction added in v0.0.2

func ScaleToFraction(f float64) ScaleOption

func ScaleToMultiple added in v0.0.2

func ScaleToMultiple(f int) ScaleOption

func ScaleToRatio added in v0.0.2

func ScaleToRatio(f float64) ScaleOption

func ScaleToSize added in v0.0.2

func ScaleToSize(w, h int) ScaleOption

func ScaleUsing added in v0.0.2

func ScaleUsing(s draw.Scaler) ScaleOption

func ScaleX added in v0.0.5

func ScaleX(f float64) ScaleOption

ScaleX sets independent X scaling factor

func ScaleY added in v0.0.5

func ScaleY(f float64) ScaleOption

ScaleY sets independent Y scaling factor

type ScaleRadius added in v0.0.3

type ScaleRadius struct{ Radius int }

func (*ScaleRadius) SetScaleRadius added in v0.0.3

func (s *ScaleRadius) SetScaleRadius(v int)

type ScaleXSpacing added in v0.0.3

type ScaleXSpacing struct{ SpacingX int }

func (*ScaleXSpacing) SetScaleXSpacing added in v0.0.3

func (s *ScaleXSpacing) SetScaleXSpacing(v int)

type ScaleYSpacing added in v0.0.3

type ScaleYSpacing struct{ SpacingY int }

func (*ScaleYSpacing) SetScaleYSpacing added in v0.0.3

func (s *ScaleYSpacing) SetScaleYSpacing(v int)

type ScaledImage added in v0.0.2

type ScaledImage struct {
	image.Image
}

We need a wrapper that holds the Result image.

type Scales added in v0.0.3

type Scales struct {
	Null
	Radius   int
	SpacingX int
	SpacingY int
}

Scales generates an overlapping scales pattern.

func (*Scales) At added in v0.0.3

func (s *Scales) At(x, y int) color.Color

func (*Scales) SetScaleRadius added in v0.0.3

func (s *Scales) SetScaleRadius(v int)

Implement interfaces on Scales struct

func (*Scales) SetScaleXSpacing added in v0.0.3

func (s *Scales) SetScaleXSpacing(v int)

func (*Scales) SetScaleYSpacing added in v0.0.3

func (s *Scales) SetScaleYSpacing(v int)

type Scatter added in v0.0.3

type Scatter struct {
	Null
	SpaceColor         // Background color
	Frequency  float64 // Controls cell size (1/Frequency)
	Density    float64 // 0.0 to 1.0, chance of item appearing in a cell
	Generator  ScatterGenerator
	Seed       int64
	MaxOverlap int // Radius of neighbor cells to check (default 1 for 3x3)
}

Scatter places generated items in a grid with random offsets. It supports overlapping items by sorting them by a Z-index derived from the hash.

func (*Scatter) At added in v0.0.3

func (s *Scatter) At(x, y int) color.Color

func (*Scatter) SetSeed added in v0.0.6

func (s *Scatter) SetSeed(v int64)

func (*Scatter) SetSeedUint64 added in v0.0.6

func (s *Scatter) SetSeedUint64(v uint64)

type ScatterGenerator added in v0.0.3

type ScatterGenerator func(u, v float64, hash uint64) (color.Color, float64)

ScatterGenerator is a function that returns the color/alpha of an item at a given local coordinate. u, v: Local coordinates relative to the item's center (approx -0.5 to 0.5 range depending on cell). hash: Random hash for this specific item instance. returns: The color of the pixel. If Alpha is 0, it's transparent.

type ScatterItem added in v0.0.3

type ScatterItem struct {
	Color color.Color
	Z     float64 // Depth for sorting (higher is on top)
}

ScatterItem represents a single item placed by the Scatter pattern. It is calculated by the user-provided generator function.

type ScreenTone added in v0.0.2

type ScreenTone struct {
	Null
	Radius  // Size of the dots
	Spacing // Distance between dots (frequency)
	Angle   // Angle of the grid in degrees
	FillColor
	SpaceColor
}

ScreenTone is a pattern that displays a grid of dots (halftone) at a specified angle.

func (*ScreenTone) At added in v0.0.2

func (p *ScreenTone) At(x, y int) color.Color

func (*ScreenTone) Bounds added in v0.0.2

func (p *ScreenTone) Bounds() image.Rectangle

func (*ScreenTone) ColorModel added in v0.0.2

func (p *ScreenTone) ColorModel() color.Model

type Seed added in v0.0.2

type Seed struct {
	Seed int64
}

Seed configures the seed for a pattern.

func (*Seed) SetSeed added in v0.0.2

func (s *Seed) SetSeed(v int64)

func (*Seed) SetSeedUint64 added in v0.0.6

func (s *Seed) SetSeedUint64(v uint64)

type Serpentine added in v0.0.2

type Serpentine struct {
	Serpentine bool
}

Serpentine configures the error diffusion to use serpentine scanning.

func (*Serpentine) SetSerpentine added in v0.0.2

func (s *Serpentine) SetSerpentine(v bool)

type Shojo added in v0.0.2

type Shojo struct {
	Null
	FillColor  // Sparkle color
	SpaceColor // Background color
	Seed       int64
}

Shojo is a pattern that generates scattered starbursts with glow halos ("Shōjo Sparkles").

func (*Shojo) At added in v0.0.2

func (p *Shojo) At(x, y int) color.Color

At returns the color of the pixel at (x, y). It implements a grid-based scattered point algorithm to render starbursts.

func (*Shojo) Bounds added in v0.0.2

func (p *Shojo) Bounds() image.Rectangle

func (*Shojo) ColorModel added in v0.0.2

func (p *Shojo) ColorModel() color.Model

func (*Shojo) SetSeed added in v0.0.6

func (p *Shojo) SetSeed(v int64)

SetSeed sets the seed for the Shojo pattern.

func (*Shojo) SetSeedUint64 added in v0.0.6

func (p *Shojo) SetSeedUint64(v uint64)

SetSeedUint64 sets the seed for the Shojo pattern.

type SierpinskiCarpet added in v0.0.2

type SierpinskiCarpet struct {
	Null
	FillColor
	SpaceColor
}

SierpinskiCarpet represents a pattern generated using the Sierpinski Carpet fractal algorithm.

func (*SierpinskiCarpet) At added in v0.0.2

func (p *SierpinskiCarpet) At(x, y int) color.Color

At returns the color at the given coordinates. It recursively checks if the coordinate belongs to a "hole" in the carpet.

type SierpinskiTriangle added in v0.0.2

type SierpinskiTriangle struct {
	Null
	FillColor
	SpaceColor
}

SierpinskiTriangle represents a pattern generated using the Sierpinski Triangle fractal algorithm. It uses a bitwise operation equivalent to Pascal's Triangle modulo 2.

func (*SierpinskiTriangle) At added in v0.0.2

func (p *SierpinskiTriangle) At(x, y int) color.Color

At returns the color at the given coordinates. If (x & y) == 0, it returns the fill color (part of the triangle). Otherwise, it returns the space color.

type SimpleZoom

type SimpleZoom struct {
	Null
	// contains filtered or unexported fields
}

SimpleZoom is a pattern that zooms in on an underlying image.

func (*SimpleZoom) At

func (s *SimpleZoom) At(x, y int) color.Color

func (*SimpleZoom) Bounds

func (s *SimpleZoom) Bounds() image.Rectangle

func (*SimpleZoom) ColorModel

func (s *SimpleZoom) ColorModel() color.Model

type SpaceColor added in v0.0.2

type SpaceColor struct {
	SpaceColor color.Color
}

SpaceColor configures the color of spaces in a pattern.

func (*SpaceColor) SetSpaceColor added in v0.0.2

func (s *SpaceColor) SetSpaceColor(v color.Color)

type SpaceImageSource added in v0.0.2

type SpaceImageSource struct {
	SpaceImageSource image.Image
}

SpaceImageSource configures an image source for spaces in a pattern.

func (*SpaceImageSource) SetSpaceImageSource added in v0.0.2

func (s *SpaceImageSource) SetSpaceImageSource(v image.Image)

type SpaceSize added in v0.0.2

type SpaceSize struct {
	SpaceSize int
}

SpaceSize configures the size of spaces in a pattern.

func (*SpaceSize) SetSpaceSize added in v0.0.2

func (s *SpaceSize) SetSpaceSize(v int)

type Spacing added in v0.0.2

type Spacing struct {
	Spacing int
}

Spacing configures the spacing/periodicity in a pattern.

func (*Spacing) SetSpacing added in v0.0.2

func (s *Spacing) SetSpacing(v int)

type SpeedLines added in v0.0.2

SpeedLines pattern generates manga-style speed lines.

func (*SpeedLines) At added in v0.0.2

func (p *SpeedLines) At(x, y int) color.Color

type SpeedLinesType added in v0.0.2

type SpeedLinesType int

SpeedLinesType defines the type of speed lines (Radial or Linear).

const (
	SpeedLinesRadial SpeedLinesType = iota
	SpeedLinesLinear
)

type StartColor added in v0.0.2

type StartColor struct {
	StartColor color.Color
}

StartColor configures the start color for a gradient.

func (*StartColor) SetStartColor added in v0.0.2

func (s *StartColor) SetStartColor(v color.Color)

type SubpixelLines added in v0.0.6

type SubpixelLines struct {
	Null
	LineThickness  int
	OffsetStrength float64
	VignetteRadius float64
}

SubpixelLines renders alternating dark/light horizontal bands with subtle RGB channel offsets and a vignette falloff.

func (*SubpixelLines) At added in v0.0.6

func (p *SubpixelLines) At(x, y int) color.Color

func (*SubpixelLines) SetLineThickness added in v0.0.6

func (p *SubpixelLines) SetLineThickness(thickness int)

func (*SubpixelLines) SetOffsetStrength added in v0.0.6

func (p *SubpixelLines) SetOffsetStrength(strength float64)

func (*SubpixelLines) SetVignetteRadius added in v0.0.6

func (p *SubpixelLines) SetVignetteRadius(radius float64)

type TextOption added in v0.0.2

type TextOption func(*textConfig)

func TextBackgroundColor added in v0.0.2

func TextBackgroundColor(bg image.Image) TextOption

func TextBackgroundColorColor added in v0.0.2

func TextBackgroundColorColor(bg color.Color) TextOption

func TextColor added in v0.0.2

func TextColor(fg image.Image) TextOption

func TextColorColor added in v0.0.2

func TextColorColor(fg color.Color) TextOption

func TextDPI added in v0.0.2

func TextDPI(dpi float64) TextOption

func TextSize added in v0.0.2

func TextSize(size float64) TextOption

type ThreadBands added in v0.0.6

type ThreadBands struct {
	Null
	ThreadWidth      int
	CrossShadowDepth float64
	ColorVariance    float64
	LightThreadColor color.Color
	DarkThreadColor  color.Color
	Seed
}

ThreadBands renders orthogonal thread bands with alternating tones and subtle fiber noise. The pattern simulates a simple weave with configurable thread width, shadow strength, and color variation.

func (*ThreadBands) At added in v0.0.6

func (t *ThreadBands) At(x, y int) color.Color

func (*ThreadBands) SetColorVariance added in v0.0.6

func (t *ThreadBands) SetColorVariance(v float64)

func (*ThreadBands) SetCrossShadowDepth added in v0.0.6

func (t *ThreadBands) SetCrossShadowDepth(v float64)

func (*ThreadBands) SetDarkThreadColor added in v0.0.6

func (t *ThreadBands) SetDarkThreadColor(v color.Color)

func (*ThreadBands) SetLightThreadColor added in v0.0.6

func (t *ThreadBands) SetLightThreadColor(v color.Color)

func (*ThreadBands) SetThreadWidth added in v0.0.6

func (t *ThreadBands) SetThreadWidth(v int)

Option adapters for the ThreadBands pattern.

type ThreadColorVariance added in v0.0.6

type ThreadColorVariance struct{ Variance float64 }

func (*ThreadColorVariance) SetColorVariance added in v0.0.6

func (c *ThreadColorVariance) SetColorVariance(v float64)

type ThreadWidthOption added in v0.0.6

type ThreadWidthOption struct{ ThreadWidth int }

func (*ThreadWidthOption) SetThreadWidth added in v0.0.6

func (t *ThreadWidthOption) SetThreadWidth(v int)

type Tile added in v0.0.2

type Tile struct {
	// contains filtered or unexported fields
}

func (*Tile) At added in v0.0.2

func (t *Tile) At(x, y int) color.Color

func (*Tile) Bounds added in v0.0.2

func (t *Tile) Bounds() image.Rectangle

func (*Tile) ColorModel added in v0.0.2

func (t *Tile) ColorModel() color.Model

type Tilt added in v0.0.4

type Tilt struct {
	Tilt float64
}

Tilt configures the tilt angle (usually X axis rotation).

func (*Tilt) SetTilt added in v0.0.4

func (s *Tilt) SetTilt(v float64)

type Transposed

type Transposed struct {
	// contains filtered or unexported fields
}

Transposed is a pattern that transposes the X and Y coordinates of an underlying image.

func (*Transposed) At

func (t *Transposed) At(x, y int) color.Color

func (*Transposed) Bounds

func (t *Transposed) Bounds() image.Rectangle

func (*Transposed) ColorModel

func (t *Transposed) ColorModel() color.Model

type TrueColor added in v0.0.2

type TrueColor struct {
	TrueColor color.Color
}

TrueColor configures the color used for "true" values in boolean/fuzzy operations.

func (*TrueColor) SetTrueColor added in v0.0.2

func (s *TrueColor) SetTrueColor(v color.Color)

type VHS added in v0.0.2

type VHS struct {
	Null
	Image             image.Image
	ScanlineFrequency float64 // Frequency of the scanlines (e.g. 0.5 for every other line)
	ScanlineIntensity float64 // Intensity of the scanline darkening (0.0 to 1.0)
	ColorOffset       int     // Pixel offset for the red/blue channels
	NoiseIntensity    float64 // Intensity of the noise (0.0 to 1.0)
	Seed              int64   // Seed for the deterministic noise
	// contains filtered or unexported fields
}

VHS applies a retro VHS effect with scanlines, chromatic aberration, and noise.

func (*VHS) At added in v0.0.2

func (p *VHS) At(x, y int) color.Color

func (*VHS) SetColorOffset added in v0.0.2

func (p *VHS) SetColorOffset(i int)

func (*VHS) SetNoiseIntensity added in v0.0.2

func (p *VHS) SetNoiseIntensity(f float64)

func (*VHS) SetScanlineFrequency added in v0.0.2

func (p *VHS) SetScanlineFrequency(f float64)

func (*VHS) SetScanlineIntensity added in v0.0.2

func (p *VHS) SetScanlineIntensity(f float64)

func (*VHS) SetSeed added in v0.0.2

func (p *VHS) SetSeed(s int64)

func (*VHS) SetSeedUint64 added in v0.0.6

func (p *VHS) SetSeedUint64(s uint64)

type VerticalLine added in v0.0.2

VerticalLine is a pattern that draws vertical lines.

func (*VerticalLine) At added in v0.0.2

func (p *VerticalLine) At(x, y int) color.Color

type Voronoi added in v0.0.2

type Voronoi struct {
	Null
	Points []image.Point
	Colors []color.Color
}

Voronoi is a pattern that generates Voronoi cells based on a set of points and colors.

func (*Voronoi) At added in v0.0.2

func (v *Voronoi) At(x, y int) color.Color

type Warp added in v0.0.3

type Warp struct {
	Null
	Source          image.Image
	Distortion      image.Image
	DistortionX     image.Image
	DistortionY     image.Image
	Scale           float64
	XScale          float64
	YScale          float64
	DistortionScale float64 // Scale factor for sampling the distortion image (zooming into noise)
}

Warp distorts the coordinates of the Source image using the Distortion image. It maps the color intensity of the Distortion image to a coordinate offset.

func (*Warp) At added in v0.0.3

func (p *Warp) At(x, y int) color.Color

type WindRidges added in v0.0.6

type WindRidges struct {
	Null
	Noise          image.Image
	Angle          float64
	StreakLength   int
	Contrast       float64
	ShadowDistance float64
	ShadowStrength float64
}

WindRidges turns white noise into stretched, wind-swept streaks with soft shadow ridges.

It starts from a noise source (default HashNoise), streaks it along a wind angle, then applies a subtle perpendicular shadow to give the impression of depth.

Tunable parameters:

  • Angle: wind direction in degrees (0° is to the right, 90° is downward).
  • StreakLength: how far each sample smears along the wind direction.
  • Contrast: exponent applied to the final luminance for crisper ridges (>1) or softer (<1).

ShadowDistance and ShadowStrength are secondary controls to keep the ridges soft by default.

func (*WindRidges) At added in v0.0.6

func (p *WindRidges) At(x, y int) color.Color

type WorleyNoise added in v0.0.3

type WorleyNoise struct {
	Null
	Seed
	Frequency
	Jitter float64
	Metric DistanceMetric
	Output WorleyOutput
}

WorleyNoise generates cellular noise (Worley noise).

func (*WorleyNoise) At added in v0.0.3

func (w *WorleyNoise) At(x, y int) color.Color

type WorleyOutput added in v0.0.3

type WorleyOutput int
const (
	OutputF1 WorleyOutput = iota
	OutputF2
	OutputF2MinusF1
	OutputCellID
)

type WorleyTiles added in v0.0.6

type WorleyTiles struct {
	Null
	Seed
	Frequency
	StoneSize     float64
	GapWidth      float64
	PaletteSpread float64
	Jitter        float64
	Palette       []color.RGBA
}

WorleyTiles generates tiled Voronoi/Worley stones with mortar. Cells are rounded with a smooth transition near the gaps and each cell receives a small palette jitter for natural variation.

func (*WorleyTiles) At added in v0.0.6

func (w *WorleyTiles) At(x, y int) color.Color

func (*WorleyTiles) Bounds added in v0.0.6

func (w *WorleyTiles) Bounds() image.Rectangle

func (*WorleyTiles) ColorModel added in v0.0.6

func (w *WorleyTiles) ColorModel() color.Model

type Xor added in v0.0.2

type Xor struct {
	BooleanImage
}

Xor represents a boolean XOR operation.

type XorPattern added in v0.0.2

type XorPattern struct {
	Null
	Colors []color.Color
}

XorPattern generates an XOR texture pattern.

func (*XorPattern) At added in v0.0.2

func (p *XorPattern) At(x, y int) color.Color

type Yliluoma1Dither added in v0.0.3

type Yliluoma1Dither struct {
	Null
	Input   image.Image
	Palette []color.Color
	Matrix  []float64 // 0..1 values
	Size    int       // e.g. 8 for 8x8
	// contains filtered or unexported fields
}

Yliluoma1Dither implements Yliluoma's ordered dithering algorithm 1. It mixes two colors from the palette to approximate the input color.

func (*Yliluoma1Dither) At added in v0.0.3

func (p *Yliluoma1Dither) At(x, y int) color.Color

type Yliluoma2Dither added in v0.0.3

type Yliluoma2Dither struct {
	Null
	Input   image.Image
	Palette []color.Color
	Matrix  []float64
	Size    int
	// contains filtered or unexported fields
}

Yliluoma2Dither implements Yliluoma's ordered dithering algorithm 2. It builds a candidate list of colors that average to the input color.

func (*Yliluoma2Dither) At added in v0.0.3

func (p *Yliluoma2Dither) At(x, y int) color.Color

Source Files

Directories

Path Synopsis
cmd
bootstrap command
pattern-cli command
pkg
pattern-cli
Code generated by cmd/bootstrap/main.go; DO NOT EDIT.
Code generated by cmd/bootstrap/main.go; DO NOT EDIT.

Jump to

Keyboard shortcuts

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