package tiles

import "github.com/anaseto/gruid/tiles"

Package tiles provides common utilities for manipulation of graphical tiles, such as drawing fonts.

Index

Types

type Drawer

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

Drawer can be used to draw a text rune on an image of appropriate size to be used as a tile. See the example in examples/messages/tiles.go for an example of use.

func NewDrawer

func NewDrawer(face font.Face) (*Drawer, error)

NewDrawer returns a new tile Drawer given a monospace font face.

func (*Drawer) Draw

func (d *Drawer) Draw(r rune, fg, bg image.Image) image.Image

Draw draws a rune and returns the produced image with foreground and background colors given by images fg and bg.

func (*Drawer) Size

func (d *Drawer) Size() gruid.Point

Size returns the size of drawn tiles, in pixel points.

Source Files

drawer.go

Version
v0.22.0 (latest)
Published
Oct 23, 2022
Platform
linux/amd64
Imports
6 packages
Last checked
15 hours ago

Tools for package owners.