image

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultEncode

func DefaultEncode(deps Deps, w io.Writer, img Image, s Save) error

func DoCrop

func DoCrop(crop Crop, img image.Image) (image.Image, error)

func GetExtension

func GetExtension(deps Deps, pth string) (string, error)

Types

type Buffer

type Buffer struct {
	Encoding string `json:"encoding"`
	Data     string `json:"data"`
}

func (Buffer) LoadKind

func (Buffer) LoadKind() LoadKind

type Crop

type Crop struct {
	Rectangle image.Rectangle
}

func (Crop) OpKind

func (Crop) OpKind() OpKind

type Decoder

type Decoder func(r io.Reader) (image.Image, error)

type DecoderFunc

type DecoderFunc func(r io.Reader, ext string) (image.Image, error)

type Decoders

type Decoders map[string]Decoder

func DefaultDecoders

func DefaultDecoders() Decoders

func (Decoders) Decode

func (d Decoders) Decode(r io.Reader, ext string) (image.Image, error)

type Deps

type Deps struct {
	FS  fs.FS
	Log *slog.Logger
}

type Encode

type Encode func(Deps, Image, Save) error

type EncodeError

type EncodeError struct {
	Path     string `json:"path"`
	Encoding string `json:"encoding"`
}

func (EncodeError) Error

func (e EncodeError) Error() string

type FontConfig

type FontConfig struct {
	Paths map[FontID]string
}

type FontID

type FontID string

type Image

type Image image.Image

type Inputs

type Inputs map[string]Loader

func (*Inputs) UnmarshalJSON

func (in *Inputs) UnmarshalJSON(b []byte) error

type LoadKind

type LoadKind int

ENUM(

Path
Buffer

)

const (
	LoadPath LoadKind = iota
	LoadBuffer
)

type Loader

type Loader interface {
	LoadKind() LoadKind
}

type Op

type Op interface {
	OpKind() OpKind
}

type OpKind

type OpKind int
const (
	OpCrop OpKind = iota
	OpAddText
)

type Path

type Path struct {
	Path string `json:"path"`
}

func (Path) LoadKind

func (Path) LoadKind() LoadKind

type Resolver

type Resolver struct {
	Decode DecoderFunc
	Encode Encode
}

type Rotate

type Rotate struct {
	Value float64 `json:"value"`
	Unit  string  `json:"unit"`
}

type Save

type Save struct {
	Path string `json:"path"`
}

type Step

type Step interface {
	StepKind() StepKind
}

type StepKind

type StepKind string
const (
	StepAddText StepKind = "step.addText"
)

type Task

type Task struct {
	InFile  string
	Ops     []Op
	OutFile OutFile
}

type TaskResolver

type TaskResolver func(Task) error

type Tasks

type Tasks struct {
	Inputs   Inputs
	Worflows []WorkFlow
}

type Text

type Text struct {
	Text      string    `json:"text"`
	Transform Transform `json:"transform"`
	FontID    FontID    `json:"font_id"`
}

func (Text) OpKind

func (Text) OpKind() OpKind

type Transform

type Transform struct {
	Rotate Rotate `json:"rotate"`
}

type UnrecognizedEncoding

type UnrecognizedEncoding string

func (UnrecognizedEncoding) Error

func (e UnrecognizedEncoding) Error() string

type WorkFlow

type WorkFlow struct {
	Input  string `json:"input"`
	Steps  []Step
	Output Save
}

Jump to

Keyboard shortcuts

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