packer

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtlasJson

type AtlasJson struct {
	Meta  *MetaJson             `json:"meta"`
	Atlas map[string]*ImageJson `json:"atlas"`
}

AtlasJson representation of all images

type Config

type Config struct {
	OutputWidth      int
	OutputHeight     int
	Padding          int
	OutputImagePath  string
	OutputSchemaPath string
	IgnoreLargeImage bool
	Quality          int
	MetaFilename     string
}

Config of the texture packer

type ImageInfo

type ImageInfo struct {
	ID     string `json:"id"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
	Left   int    `json:"x"`
	Top    int    `json:"y"`
	Name   string `json:"name"`
	// contains filtered or unexported fields
}

ImageInfo contains image file info and image properties

func NewImageInfoParseFrom

func NewImageInfoParseFrom(imagePath, name string, padding int) *ImageInfo

NewImageInfoParseFrom parse image info from input file

func (*ImageInfo) CopyToImage

func (img *ImageInfo) CopyToImage(canvas *image.RGBA, rc Rectangle)

CopyToImage copies a region of img to the canvas

func (*ImageInfo) PaddedHeight

func (img *ImageInfo) PaddedHeight() int

PaddedHeight returns image height with padding

func (*ImageInfo) PaddedWidth

func (img *ImageInfo) PaddedWidth() int

PaddedWidth returns image width with padding

func (*ImageInfo) String

func (img *ImageInfo) String() string

type ImageJson

type ImageJson struct {
	X int `json:"x"`
	Y int `json:"y"`
	W int `json:"width"`
	H int `json:"height"`
}

ImageJson representation of image info

type MetaJson

type MetaJson struct {
	Filename string `json:"filename"`
	W        int    `json:"width"`
	H        int    `json:"height"`
	Padding  int    `json:"padding"`
}

MetaJson representation of atlas meta info

type Node

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

Node represents a tree node of the packer

type Packer

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

func NewPacker

func NewPacker(cfg *Config) *Packer

NewPacker returns a new packer instance created with config

func (*Packer) Pack

func (p *Packer) Pack(images map[string]string) (err error)

type Rectangle

type Rectangle struct {
	Left   int
	Top    int
	Right  int
	Bottom int
}

Rectangle represents the place taken by a image file

func (Rectangle) Height

func (rc Rectangle) Height() int

Height returns the height of the rectangle

func (Rectangle) Width

func (rc Rectangle) Width() int

Width returns the width of the rectangle

Jump to

Keyboard shortcuts

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