Documentation ¶
Overview ¶
Package tiler converts a standard image.Image to a tiled representation. Tiles are read as 8x8 pixel images starting a the top-left of the image (0,0).
This package is currently marked as 'internal' as it has very rough and untested code. Once this has been improved, and its API has been better defined, it may be moved to a public package.
Index ¶
- type Orientation
- type Palette
- type Tile
- func (t *Tile) AddDuplicateInfo(row, col int, orientation Orientation)
- func (i Tile) Col() int
- func (t *Tile) ColPosInPixels() int
- func (t *Tile) DuplicateCount() int
- func (t *Tile) GetDuplicateInfo(id int) (*info, error)
- func (t *Tile) IsDuplicate(tile *Tile) (Orientation, bool)
- func (i Tile) Orientation() Orientation
- func (t *Tile) OrientationAt(y, x int, orientation Orientation) (color.Color, error)
- func (t *Tile) Palette() (colours []color.Color)
- func (i Tile) Row() int
- func (t *Tile) RowPosInPixels() int
- func (t *Tile) Size() int
- type Tiled
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Orientation ¶
type Orientation uint16
Orientation is used to indicate what flipped/rotated orientation a duplicate tile has.
const ( OrientationNormal Orientation = iota OrientationFlippedV OrientationFlippedH OrientationFlippedVH )
type Tile ¶
type Tile struct {
// contains filtered or unexported fields
}
Tile is an 8x8 pixel image tile.
func NewWithOrientations ¶
NewWithOrientations a new tile, with all its different flipped orientations generated
func (*Tile) AddDuplicateInfo ¶
func (t *Tile) AddDuplicateInfo(row, col int, orientation Orientation)
AddDuplicateInfo tile to the duplicates slice.
func (*Tile) ColPosInPixels ¶
ColPosInPixels is the tile column location in pixels, as located in the source image.
func (*Tile) DuplicateCount ¶
DuplicateCount returns number of duplicates for the tile.
func (*Tile) GetDuplicateInfo ¶
GetDuplicateInfo returns the duplicate at the given index number.
func (*Tile) IsDuplicate ¶
func (t *Tile) IsDuplicate(tile *Tile) (Orientation, bool)
IsDuplicate tests the tile image for matching colours. If no match is found, then the image is flipped vertically, horizontally, and in both planes, and tested again after each.
func (Tile) Orientation ¶
func (i Tile) Orientation() Orientation
func (*Tile) OrientationAt ¶
func (*Tile) RowPosInPixels ¶
RowPosInPixels is the tile row location in pixels, as located in the source image.
type Tiled ¶
type Tiled struct {
// contains filtered or unexported fields
}
Tiled represents a tiled version of a the original image, consisting of unique 8x8 tiles.
func FromImage ¶
FromImage returns a new tile set from the given image data. The tile size is the width/height of a tile in pixels, and must in be multiples of 8px.
func (*Tiled) ColourCount ¶
ColourCount is the total number of unique colours in the image.