internal

package
v0.4.40 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HttpGet = http.Get

Functions

This section is empty.

Types

type BackgroundMaker

type BackgroundMaker func(width, height int, color string) image.Image
var MakeBackground BackgroundMaker = func(width, height int, color string) image.Image {
	backgroundConfig := blank.Config{Color: color}
	return backgroundConfig.GenerateImage(width, height)
}

type Context

type Context interface {
	Image() image.Image
	DrawString(s string, x, y float64)
	DrawStringAnchored(s string, x, y, ax, ay float64)
	DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align gg.Align)
	LoadFontFace(path string, points float64) error
	MeasureString(s string) (w, h float64)
	MeasureMultilineString(s string, lineSpacing float64) (w, h float64)
	SetColor(c color.Color)
	WordWrap(s string, w float64) []string
}

type ContextMaker

type ContextMaker func(i image.Image) Context
var NewContext ContextMaker = func(i image.Image) Context {
	return gg.NewContextForImage(i)
}

type FontFinder added in v0.3.1

type FontFinder func(font string) (filePath string, err error)
var FindFont FontFinder = findfont.Find

type HttpGetter

type HttpGetter func(path string) (*http.Response, error)

type ImageEncoder

type ImageEncoder func(w io.Writer, i image.Image) error
var EncodeImage ImageEncoder = png.Encode

type ImageWriter

type ImageWriter func(file string, i image.Image) error
var WriteImage ImageWriter = func(file string, i image.Image) error {
	f, err := os.Create(file)
	if err != nil {
		return err
	}
	err = EncodeImage(f, i)
	if err != nil {
		return err
	}
	return f.Close()
}

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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