artwork

package module
v0.0.0-...-2da380e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2023 License: MIT Imports: 17 Imported by: 0

README

Artwork

Artwork is a program for generating and minting NFTs, written in Go (https://golang.org/).

This project is in the early planning stages. Please be patient as it is built it out, or potentially destroyed.

The goal of this package is to provide a tool to make generating and minting your NFT on the Chia Blockchain, fairly simple. If you need something more fully-featured, check out HashLips (https://github.com/HashLips/hashlips_art_engine)

If you wish to donate toward the development of this project, please use any of the following addresses:

XCH (Chia): xch1d80tfje65xy97fpxg7kl89wugnd6svlv5uag2qays0um5ay5sn0qz8vph8
BTC (Bitcoin): 39AcR4aQtvBScT2DEgdqefiH3S8CQzMGfV
ETH (Ethereum): 0xeA01FC83cee4B89DbD1d27CA0A32bB7B4b1253d1
USDT (Tether): 0x6be549359f580BC1d8Db61C0CF13198eF14eD999
USDC (USD Coin): 0xfb9a45a7Fe781D4fc449e63532424bCfDfB086B4

Documentation

Overview

Mint is a program for minting NFTs on the Chia Blockchain.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CenterOffset

func CenterOffset(center image.Point, bounds image.Rectangle) image.Point

CenterOffset gets the offset required to center a rectangle, bounds, on a point, center

func GrowImage

func GrowImage(orig image.Image, bounds image.Rectangle) image.Image

GrowImage enlarges an image to match the supplied rectangle bounds. Returns the grown image.Image.

func ScaleRectangle

func ScaleRectangle(sx, sy float64, orig image.Rectangle) image.Rectangle

ScaleRectangle scales a rectangle, orig, base on a scale factor, s. returns an image.Rectangle.

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 NewAsset

func NewAsset() *Asset

func (*Asset) Composite

func (a *Asset) Composite() (image.Image, error)

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...

func (*Asset) IsLoaded

func (a *Asset) IsLoaded() bool

IsLoaded reports whether an *Asset.Image is not nil. Returns true if not nil, otherwise returns false.

func (*Asset) Load

func (a *Asset) Load() error

Load loads an Asset's image into *Asset.Image. Returns an error if something went wrong along the way.

type Attribute

type Attribute struct {
	Name
}

type AttributeWeightInterval

type AttributeWeightInterval struct {
	Attribute
	Weight float64
}

type AttributeWeightIntervals

type AttributeWeightIntervals []*AttributeWeightInterval

func (AttributeWeightIntervals) Attribute

Attribute returns the first attribute for which f is less than its computed distribution threshold. It assumes itself to be sorted.

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 Minter

type Minter interface {
	One(nft.Nft) error
	Many([]*nft.Nft) 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

func NewPiece(id uint, canvas image.Image, bounds *image.Rectangle) *Piece

NewPiece creates a new piece from a base image.Image, canvas, or creates new image from bounds.

func (*Piece) Build

func (p *Piece) Build() error

Build creates an asset tree from a set of asset configuration data. Returns nil on succes, error on failure.

func (*Piece) Composite

func (p *Piece) Composite() error

Composite walks Regions, attempting to composite the entire composition tree onto the canvas.

type Region

type Region struct {
	*Asset
	Coords *image.Point
	Kinds  []string
	Scale  *Scale
}

Region defines an overlay region, with center-point coordinates, Coords, a slice of applicable kinds, Kinds, and an asset to overlay, Asset.

func NewRegion

func NewRegion() *Region

func (*Region) Coordinates

func (r *Region) Coordinates() *image.Point

Coordinates is a getter function for region coordinates. Defaults to center.

type Scale

type Scale struct {
	X, Y float64
}

Directories

Path Synopsis
cmd
Package mint provides types and methods for minting NFTs on the chia blockchain.
Package mint provides types and methods for minting NFTs on the chia blockchain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL