Documentation
¶
Overview ¶
Mint is a program for minting NFTs on the Chia Blockchain.
Index ¶
- func CenterOffset(center image.Point, bounds image.Rectangle) image.Point
- func GrowImage(orig image.Image, bounds image.Rectangle) image.Image
- func ScaleRectangle(sx, sy float64, orig image.Rectangle) image.Rectangle
- type Asset
- type Attribute
- type AttributeWeightInterval
- type AttributeWeightIntervals
- type AttributeWeightMap
- type Configuration
- type Generator
- type Minter
- type Piece
- type Region
- type Scale
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CenterOffset ¶
CenterOffset gets the offset required to center a rectangle, bounds, on a point, center
Types ¶
type Asset ¶
type Asset struct {
Kind string // @TODO: decide how this should be typed; Should this be many?
Path string
Image image.Image // @TODO: Consider embedding.
Parent *Region
Regions []*Region
}
Asset is a type of image asset which has an asset type, Kind, a filepath, Path, an image, Image and a slice of available overlay regions, Regions.
func (*Asset) Composite ¶
Composite climbs the current composition tree branch and composites down from the leaves. Returns image.Image, nil, when successful; nil, nil, at leaf; and nil/image.Image, error when there was a failure. @TODO: Find things to error about...
type AttributeWeightInterval ¶
type AttributeWeightIntervals ¶
type AttributeWeightIntervals []*AttributeWeightInterval
func (AttributeWeightIntervals) Attribute ¶
func (a AttributeWeightIntervals) Attribute(f float64) Attribute
Attribute returns the first attribute for which f is less than its computed distribution threshold. It assumes itself to be sorted.
type AttributeWeightMap ¶
func (AttributeWeightMap) Intervals ¶
func (a AttributeWeightMap) Intervals() AttributeWeightIntervals
Computes an array of intervals which represent the normalized, weighted distribution of an AttributeMap. The sum of the receiver, "a" should equal 1.0.
Here's a visual:
[]AttributeWeightMap{aV:0.2, aW:0.15, aX:0.25, aY:0.1, aZ:0.3}
Would become something like,
[]AttributeWeightIntervalMap{aV:0.2, aW:0.35, aX:0.60, aY:0.7, aZ:1.0}
Order is irrelevant.
This function returns the distribution as an *AttributeWeightInterval slice
func (AttributeWeightMap) Sum ¶
func (a AttributeWeightMap) Sum() (sum float64)
Sum returns the sum of the weight map.
type Configuration ¶
type Configuration struct {
Assets []*Assets
}
Configuration contains configuration data on assets to be used for generating Pieces.
type Generator ¶
type Generator interface {
Generate() (nft.Collection, error)
}
type Piece ¶
type Piece struct {
Id uint
// @TODO: add attributes and a way to set them. Perhaps, a func type.
*Asset
}
Piece represents a piece of artwork, with a *Region slice, Regions, for defining the composition tree, and an image.Image onto which it is to be composited, Canvas.
func NewPiece ¶
NewPiece creates a new piece from a base image.Image, canvas, or creates new image from bounds.
type Region ¶
Region defines an overlay region, with center-point coordinates, Coords, a slice of applicable kinds, Kinds, and an asset to overlay, Asset.
func (*Region) Coordinates ¶
Coordinates is a getter function for region coordinates. Defaults to center.