Documentation ¶
Index ¶
- func Generate(input string, width int, height int, whitePercent int, color int, random int, ...)
- func NewNeighbors(w, h int) neighbors
- func Place(colors []SampledColor, opts Options) error
- func SortBySimilarity(colors []SampledColor, opts SortOptions)
- type Canvas
- func (c *Canvas) ImageData() []uint8
- func (c *Canvas) Place(x SampledColor)
- func (c *Canvas) PlaceAt(code MortonCode, pos Pos)
- func (c *Canvas) PlaceSeed(color SampledColor, x, y int)
- func (c *Canvas) PlaceSeeds(colors []SampledColor, xys ...int) ([]SampledColor, error)
- func (c *Canvas) Reset()
- func (c *Canvas) SaveImage(path string, compressionLevel png.CompressionLevel) error
- type Color
- type Handle
- type ImageColor
- type MortonCode
- type Options
- type Pos
- type SampledColor
- type SortOptions
- type Work
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNeighbors ¶
func NewNeighbors(w, h int) neighbors
func Place ¶
func Place(colors []SampledColor, opts Options) error
func SortBySimilarity ¶
func SortBySimilarity(colors []SampledColor, opts SortOptions)
Types ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
A canvas represents a specific pixel-placed drawing
func (*Canvas) Place ¶
func (c *Canvas) Place(x SampledColor)
func (*Canvas) PlaceAt ¶
func (c *Canvas) PlaceAt(code MortonCode, pos Pos)
func (*Canvas) PlaceSeed ¶
func (c *Canvas) PlaceSeed(color SampledColor, x, y int)
func (*Canvas) PlaceSeeds ¶
func (c *Canvas) PlaceSeeds(colors []SampledColor, xys ...int) ([]SampledColor, error)
type Color ¶
type Color struct {
// contains filtered or unexported fields
}
Color represents a color in linear RGB or OkLab
type ImageColor ¶
func LoadImage ¶
func LoadImage(path string) ([]ImageColor, error)
Returns `ImageColor`s from the source in row major order.
type MortonCode ¶
type MortonCode uint32
type Options ¶
type Options struct {
Width, Height int
RandomSeed int64
Sort SortOptions
Seeds []int
Output string
CompressionLevel png.CompressionLevel
Video bool
}
type Pos ¶
type Pos int32
Pos represents an (x, y index) pair as a single uint32 index into a (padded) array.
type SampledColor ¶
type SampledColor struct {
// contains filtered or unexported fields
}
Represents a color sample in the RGB and OkLab color spaces, along with its Morton and Hilbert codes.
func SampleColors ¶
func SampleColors(src []ImageColor, nPixels int) []SampledColor
type SortOptions ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.