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)
Click to show internal directories.
Click to hide internal directories.