Documentation ¶
Index ¶
- Variables
- func BlackWhite(c IterationCount) color.Color
- func ExportPNG(m *image.RGBA) error
- func Grayscale(resolution int, percentGray float64) color.Palette
- func Paint(p Painter, iterImg IterationImage) *image.RGBA
- func PaintWithPalette(c IterationCount, p color.Palette) color.Color
- func Render(params RenderParams) *image.RGBA
- type Algorithm
- type IterationCount
- type IterationImage
- type MandelParams
- type Painter
- type RenderParams
Constants ¶
This section is empty.
Variables ¶
var DefaultRender = RenderParams{ VP: viewport.New(), P: BlackWhite, Mandel: EscapeIterationCount, MandelP: MandelParams{ MaxIterations: 10000, }, }
Functions ¶
func BlackWhite ¶
func BlackWhite(c IterationCount) color.Color
The simplest possible coloring function. It colors points in the Mandelbrot set black, and those not in the set white
func Grayscale ¶
Generates a grayscale palette to a coloring spectrum which is mirrored. Max is the number of maximum interations, for selecting the number in the cycle. Finally, resolution is the number of grayscale colors to pick for generating the palette.
func Paint ¶
func Paint(p Painter, iterImg IterationImage) *image.RGBA
Paint applies a provided coloring function on an IterationImage and turns it into a colored image, which can be saved as a PNG or some other type of stored bitmap on a machine.
func PaintWithPalette ¶
func PaintWithPalette(c IterationCount, p color.Palette) color.Color
Colors a given index according to the maximum number of iterations, and additionally handles linearly interpolating between colors if a fractional portion of the interation count is present
func Render ¶
func Render(params RenderParams) *image.RGBA
Types ¶
type Algorithm ¶
type Algorithm = func(complex128, MandelParams) IterationCount
type IterationCount ¶
IterationCount is returned by coloring functions. More advanced ones will return a fractional portion. If the count returned is negative, then that should be interpreted as a point being in the set.
func EscapeIterationCount ¶
func EscapeIterationCount(c complex128, p MandelParams) IterationCount
EscapeIterationCount applies a simple algorithm to get an integer color for when a point escapes.
type IterationImage ¶
type IterationImage struct {
// contains filtered or unexported fields
}
type MandelParams ¶
type Painter ¶
type Painter = func(IterationCount) color.Color
type RenderParams ¶
type RenderParams struct { VP viewport.View P Painter Mandel Algorithm MandelP MandelParams }
Render is a workhorse function that generates a complex plane, uses the selected algorithm for running the mandelbrot, and colors every pixel concurrently