tiles

package
v0.0.0-...-e64c4a3 Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyTile = image.NewAlpha(image.Rect(0, 0, 8, 16))
View Source
var Fallback = &fallback{}

Fallback is used when a FontTileSet cannot find a Glyph for a rune. By default Fallback is initialized to an internal fallback that implements Tiler such that all runes return EmptyTile.

Functions

This section is empty.

Types

type Bold

type Bold struct {
	*FontTileSet
}

func (Bold) DrawTile

func (b Bold) DrawTile(r rune, dst draw.Image, pt image.Point, fg color.Color, bg color.Color)

func (Bold) GetTile

func (b Bold) GetTile(r rune) image.Image

type FontTileSet

type FontTileSet struct {
	image.Rectangle
	// Glyphs maps a rune to a slice of alpha pixel data
	Glyphs map[rune][]uint8
}

func NewFontTileSet

func NewFontTileSet() *FontTileSet

func (*FontTileSet) DrawTile

func (fts *FontTileSet) DrawTile(r rune, dst draw.Image, pt image.Point, fg color.Color, bg color.Color)

func (*FontTileSet) GetTile

func (fts *FontTileSet) GetTile(r rune) image.Image

func (*FontTileSet) Glyph

func (fts *FontTileSet) Glyph(r rune) *image.Alpha

func (*FontTileSet) SetTile

func (fts *FontTileSet) SetTile(r rune, img image.Image)

type Italics

type Italics struct {
	*FontTileSet
}

Italics wraps a TileSet, adding a 10 degree rotation to each character to kinda sorta halfway fake an italic character set. Also makes your text-based drawings look drunk.

func (Italics) DrawTile

func (i Italics) DrawTile(r rune, dst draw.Image, pt image.Point, fg color.Color, bg color.Color)

func (Italics) GetTile

func (i Italics) GetTile(r rune) image.Image

type TileSet

type TileSet map[rune]image.Image

TileSet

func NewTileSet

func NewTileSet() TileSet

func (TileSet) DrawTile

func (ts TileSet) DrawTile(r rune, dst draw.Image, pt image.Point, fg color.Color, bg color.Color)

func (TileSet) GetTile

func (ts TileSet) GetTile(r rune) image.Image

func (TileSet) LoadTileFromFile

func (ts TileSet) LoadTileFromFile(r rune, file string)

func (TileSet) LoadTileFromReader

func (ts TileSet) LoadTileFromReader(r rune, rd io.Reader)

type Tiler

type Tiler interface {
	DrawTile(r rune, dst draw.Image, pt image.Point, fg color.Color, bg color.Color)
	GetTile(r rune) image.Image
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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