pic

package
v0.0.0-...-f494f79 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawPosition

func DrawPosition(col Collection, pos chess.Position, fromPerspective chess.PieceColor) draw.Image

DrawPosition creates a draw.Image from Position using Collection. If Collection is a CanvasCollection, its Canvas() method is used to create resulting image, otherwise image.NewRGBA() is used.

Types

type CanvasCollection

type CanvasCollection interface {
	Collection

	// Canvas returns draw.Image on which images from the collection should be drawn.
	// Bounds of returned image are exactly as Board().Bounds().
	Canvas() draw.Image
}

type Collection

type Collection interface {
	Board(fromPerspective chess.PieceColor) Image
	// Piece returns an image for the specified chess piece.
	// If p.Kind == None, Piece should return nil Image.
	Piece(p chess.Piece) Image
}

Collection represents a set of Images of all pieces (in both colors) and a board. All images must have square dimensions and all piece images must be the same size. The size of piece image must not exceed the size of board image divided by 8.

var DefaultCollection Collection = nil

func OpenCollection

func OpenCollection(dir fs.FS, prefix string) (Collection, error)

type Image

type Image image.Image

Jump to

Keyboard shortcuts

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