Documentation ¶
Index ¶
- Variables
- func AverageImageColor(im image.Image) color.NRGBA
- func Copy(dst, src *image.RGBA, lines []Scanline)
- func Draw(im *image.RGBA, c Color, lines []Scanline)
- func LoadImage(path string) (image.Image, error)
- func Log(level int, format string, a ...interface{})
- func PreAnneal(state Annealable, iterations int) float64
- func SaveFile(path, contents string) error
- func SaveGIF(path string, frames []image.Image, delay, lastDelay int) error
- func SaveGIFImageMagick(path string, frames []image.Image, delay, lastDelay int) error
- func SaveJPG(path string, im image.Image, quality int) error
- func SavePNG(path string, im image.Image) error
- type Annealable
- type Color
- type Ellipse
- type Model
- func (model *Model) Add(shape Shape, alpha int)
- func (model *Model) BestHillClimbState(buffer *image.RGBA, t ShapeType, a, n, age, m int, rnd *rand.Rand) *State
- func (model *Model) BestRandomState(buffer *image.RGBA, t ShapeType, a, n int, rnd *rand.Rand) *State
- func (model *Model) Energy(alpha int, shape Shape, buffer *image.RGBA) float64
- func (model *Model) Frames(scoreDelta float64) []image.Image
- func (model *Model) RandomState(buffer *image.RGBA, t ShapeType, a int, rnd *rand.Rand) *State
- func (model *Model) SVG() string
- func (model *Model) Step(shapeType ShapeType, alpha, numWorkers int)
- type Rectangle
- type RotatedRectangle
- type Scanline
- type Shape
- type ShapeType
- type State
- type Triangle
Constants ¶
This section is empty.
Variables ¶
View Source
var LogLevel int
Functions ¶
func PreAnneal ¶
func PreAnneal(state Annealable, iterations int) float64
func SaveGIFImageMagick ¶
Types ¶
type Annealable ¶
type Annealable interface { Energy() float64 DoMove() interface{} UndoMove(interface{}) Copy() Annealable }
func Anneal ¶
func Anneal(state Annealable, maxTemp, minTemp float64, steps int) Annealable
func HillClimb ¶
func HillClimb(state Annealable, maxAge int) Annealable
type Model ¶
type Model struct {
W, H int
Background Color
Target *image.RGBA
Current *image.RGBA
Buffer *image.RGBA
Context *gg.Context
Score float64
Size int
Shapes []Shape
Colors []Color
Scores []float64
}
func (*Model) BestHillClimbState ¶
func (*Model) BestRandomState ¶
func (*Model) RandomState ¶
type RotatedRectangle ¶
func NewRandomRotatedRectangle ¶
func NewRandomRotatedRectangle(w, h int, rnd *rand.Rand) *RotatedRectangle
func (*RotatedRectangle) Copy ¶
func (r *RotatedRectangle) Copy() Shape
func (*RotatedRectangle) Draw ¶
func (r *RotatedRectangle) Draw(dc *gg.Context)
func (*RotatedRectangle) Mutate ¶
func (r *RotatedRectangle) Mutate(rnd *rand.Rand)
func (*RotatedRectangle) Rasterize ¶
func (r *RotatedRectangle) Rasterize() []Scanline
func (*RotatedRectangle) SVG ¶
func (r *RotatedRectangle) SVG(attrs string) string
func (*RotatedRectangle) Valid ¶
func (r *RotatedRectangle) Valid() bool
type State ¶
type State struct { Model *Model Buffer *image.RGBA Alpha int Shape Shape MutateAlpha bool // contains filtered or unexported fields }
func (*State) Copy ¶
func (state *State) Copy() Annealable
Click to show internal directories.
Click to hide internal directories.