Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInputTooLarge = errors.New("input too large, can not be processed")
ErrInputTooLarge means that a given block was larger than the max size of the packer - it can not possibly fit
var ErrOutOfRoom = errors.New("out of room")
ErrOutOfRoom indicates that the packer does not have enough room left for the block to be packed successfully.
Functions ¶
This section is empty.
Types ¶
type BinPacker ¶
type BinPacker struct {
// contains filtered or unexported fields
}
func NewBinPacker ¶
NewBinPacker returns a packer with the given width and height
type Block ¶
Block is the interface that represents a unit of space that can be packed alongside other Blocks.
Size returns the width and height of the block.
Place is called by the packer to indicate that the block has successfully been placed at the given position.
type ByArea ¶
type ByArea []Block
ByArea implements sort Interface for []Block based on the Area of each block.
type ByMaxSide ¶
type ByMaxSide []Block
ByMaxSide implements sort interface for []Block by comparing the maximum side (width or height) of each block
type GrowingPacker ¶
type GrowingPacker struct {
// contains filtered or unexported fields
}