engrave

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2024 License: Unlicense Imports: 16 Imported by: 0

Documentation

Overview

package engrave transforms shapes such as text and QR codes into line and move commands for use with an engraver.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Measure added in v0.10.0

func Measure(c Command) image.Rectangle

func NewBitmap added in v0.10.0

func NewBitmap(w, h int) bitmap

Types

type Command

type Command interface {
	Engrave(p Program)
}

func ConstantQR added in v0.10.0

func ConstantQR(strokeWidth, scale int, level qr.Level, content []byte) (Command, error)

ConstantQR is like QR that engraves the QR code in a pattern independent of content, except for the QR code version (size).

func Offset

func Offset(x, y int, cmd Command) Command

func QR

func QR(strokeWidth int, scale int, level qr.Level, content []byte) (Command, error)

func Rotate

func Rotate(radians float64, cmd Command) Command

type Commands

type Commands []Command

func (Commands) Engrave

func (c Commands) Engrave(p Program)

type ConstantStringer added in v0.10.0

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

ConstantStringer can engrave text in a timing insensitive way.

func NewConstantStringer added in v0.10.0

func NewConstantStringer(face *vector.Face, em int, shortest, longest int) *ConstantStringer

func (*ConstantStringer) String added in v0.10.0

func (c *ConstantStringer) String(txt string) Command

type Program

type Program interface {
	Move(p image.Point)
	Line(p image.Point)
}

Program is an interface to output an engraving.

type Rasterizer

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

func NewRasterizer

func NewRasterizer(img draw.Image, dr image.Rectangle, scale, strokeWidth float32) *Rasterizer

func (*Rasterizer) Line

func (r *Rasterizer) Line(p image.Point)

func (*Rasterizer) Move

func (r *Rasterizer) Move(p image.Point)

func (*Rasterizer) Rasterize

func (r *Rasterizer) Rasterize()

type Rect added in v0.10.0

type Rect image.Rectangle

func (Rect) Engrave added in v0.10.0

func (r Rect) Engrave(p Program)

type StringCmd

type StringCmd struct {
	LineHeight int
	// contains filtered or unexported fields
}

func String

func String(face *vector.Face, em int, txt string) *StringCmd

func (*StringCmd) Engrave

func (s *StringCmd) Engrave(p Program)

func (*StringCmd) Measure added in v0.10.0

func (s *StringCmd) Measure() image.Point

Jump to

Keyboard shortcuts

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