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 Mode
- type Model
- func (model *Model) Add(shape Shape)
- func (model *Model) BestHillClimbState(buffer *image.RGBA, t Mode, n, age, m int, rnd *rand.Rand) *State
- func (model *Model) BestRandomState(buffer *image.RGBA, t Mode, n int, rnd *rand.Rand) *State
- func (model *Model) Energy(shape Shape, buffer *image.RGBA) float64
- func (model *Model) Frames(scoreDelta float64) []image.Image
- func (model *Model) RandomState(buffer *image.RGBA, t Mode, rnd *rand.Rand) *State
- func (model *Model) SVG() string
- func (model *Model) Step()
- type Rectangle
- type RotatedRectangle
- type Scanline
- type Shape
- 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 Ellipse ¶
type Model ¶
type Model struct {
W, H int
Background Color
Target *image.RGBA
Current *image.RGBA
Buffer *image.RGBA
Context *gg.Context
Score float64
Alpha int
Size int
Mode Mode
Shapes []Shape
Scores []float64
SVGs []string
}
func (*Model) BestHillClimbState ¶
func (*Model) BestRandomState ¶
func (*Model) RandomState ¶
type RotatedRectangle ¶
type RotatedRectangle struct {
W, H int
X, Y int
Sx, Sy int
Angle int
// contains filtered or unexported fields
}
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()
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
Click to show internal directories.
Click to hide internal directories.