packing

package
v0.0.0-...-c151a14 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BySize

type BySize []Partition

func (BySize) Len

func (a BySize) Len() int

func (BySize) Less

func (a BySize) Less(i, j int) bool

func (BySize) Swap

func (a BySize) Swap(i, j int)

type Meta

type Meta struct {
	// contains filtered or unexported fields
}

Meta holds meta information about a particular image

func GenerateMetas

func GenerateMetas(paths []string) []Meta

func (Meta) Ratio

func (m Meta) Ratio() float32

type Metas

type Metas []Meta

func (Metas) Len

func (a Metas) Len() int

func (Metas) Less

func (a Metas) Less(i, j int) bool

func (Metas) Swap

func (a Metas) Swap(i, j int)

type Packer

type Packer struct {
	// contains filtered or unexported fields
}

func CreatePacker

func CreatePacker(width, height int) Packer

func (*Packer) GenerateMetas

func (p *Packer) GenerateMetas(paths []string)

func (*Packer) Pack

func (p *Packer) Pack()

func (Packer) ToFile

func (p Packer) ToFile(path string)

type Partition

type Partition struct {
	// contains filtered or unexported fields
}

Partition represent the single cell that an image can be inserted in.

func CreatePartition

func CreatePartition(p1, p2 Point) Partition

func (Partition) AddRectangle

func (p Partition) AddRectangle(width, height int, hMajor bool) (Partition, Partition)

A high level function that split up a partition based on the image added in the partition

func (Partition) BigEnough

func (p Partition) BigEnough(width, height int) bool

func (Partition) Height

func (p Partition) Height() int

func (Partition) IsValid

func (p Partition) IsValid() bool

func (Partition) P1

func (p Partition) P1() Point

func (Partition) P2

func (p Partition) P2() Point

func (Partition) Ratio

func (p Partition) Ratio() float32

func (Partition) Size

func (p Partition) Size() int

func (Partition) Width

func (p Partition) Width() int

type Point

type Point struct {
	// contains filtered or unexported fields
}

func (Point) X

func (p Point) X() int

func (Point) Y

func (p Point) Y() int

Jump to

Keyboard shortcuts

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