tspl

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDriver = &Driver{}

Functions

This section is empty.

Types

type BitmapHeader

type BitmapHeader struct {
	RowBytes, Width, Height, HeaderEnd int
}

type Driver

type Driver struct{}

func (*Driver) Bytes2Image

func (t *Driver) Bytes2Image(body []byte) (*Image, error)

func (*Driver) Encode

func (t *Driver) Encode(w, h, dpm int, img image.Image, opt Options) ([]byte, error)

func (*Driver) Header

func (t *Driver) Header(w, h, dpm int, opt Options) string

func (*Driver) Image2Bytes

func (t *Driver) Image2Bytes(img image.Image) (headerSize int, bitmap []byte, err error)

func (*Driver) OverlayBinary

func (t *Driver) OverlayBinary(baseHeader *BitmapHeader, base []byte, overlay *bin_img.Binary, xOff, yOff int) ([]byte, error)

OverlayBinary overlays `overlay` (binary image) onto `base` bitmap raw data without decoding base into an image.

`base` must start with a TSPL `BITMAP ...` header followed by bitmap bytes. The overlay is written starting at (xOff,yOff) in pixels (bits). Overlay pixels overwrite base pixels (both 0 and 1 are applied).

func (*Driver) OverlayBinaryAtTopLeft

func (t *Driver) OverlayBinaryAtTopLeft(baseHeader *BitmapHeader, base []byte, overlay *bin_img.Binary) ([]byte, error)

OverlayBinaryAtTopLeft overlays `overlay` onto `base` starting at (0,0).

func (*Driver) ParseBitmapHeader

func (t *Driver) ParseBitmapHeader(body []byte) (*BitmapHeader, error)

type Image

type Image struct {
	Header []byte
	Bitmap *bin_img.Binary
	Tail   []byte
}

type Options

type Options struct {
	Peel bool `json:"peel"`
}

func DefaultOptions

func DefaultOptions() Options

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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