textile

package
v0.0.0-...-6d4d12d Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package textile weaves strings into a text image.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Draw

func Draw(dst *Textile, r image.Rectangle, src *Textile, sp image.Point)

Draw writes the text from a source textile onto a destination textile, within a rectangle of the destination textile, offset by a position within the source textile.

Types

type Textile

type Textile struct {
	Strings []string
	Stride  int
	Rect    image.Rectangle
}

Textile represents every cell in a display as a string that ideally renders as a single glyph. Like images and slices, the textile is a thin header that can share allocated memory with other textiles.

func New

func New(r image.Rectangle) *Textile

New returns a Textile with the given rectangle. As with images, the rectangle need not rest at the origin.

func (*Textile) At

func (t *Textile) At(x, y int) string

At returns the string at a given point.

func (*Textile) Bounds

func (t *Textile) Bounds() image.Rectangle

Bounds returns the bounding box of the textile.

func (*Textile) Fill

func (t *Textile) Fill(str string)

Fill overwrites every cell in the textile with the given string.

func (*Textile) Set

func (t *Textile) Set(x, y int, str string)

Set overwrites the string at a point.

func (*Textile) StringsOffset

func (t *Textile) StringsOffset(x, y int) int

StringOffset is a utility for seeking a slice of the underlying strings starting at the given position within the allocation.

func (*Textile) SubText

func (t *Textile) SubText(r image.Rectangle) *Textile

SubText returns a region of text within the textile.

Jump to

Keyboard shortcuts

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