canvas

package
v0.0.0-...-e61aa37 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BgColor

func BgColor(color *image.Uniform) textDrawOption

BgColor sets background color.

func BgHexColor

func BgHexColor(hex string) textDrawOption

BgHexColor sets background color hex.

func BoxAlign

func BoxAlign(align box.Align) textDrawOption

BoxAlign sets box align.

func BoxPadding

func BoxPadding(bp config.Padding) textDrawOption

BoxPadding sets box padding(px).

func BoxSpacing

func BoxSpacing(px int) textDrawOption

BoxSpacing sets box spacing(px).

func FgColor

func FgColor(color *image.Uniform) textDrawOption

FgColor sets foreground color.

func FgHexColor

func FgHexColor(hex string) textDrawOption

FgHexColor sets foreground color hex.

func FontFace

func FontFace(ff font.Face) textDrawOption

FontFace sets font face.

func FontFaceFromFFA

func FontFaceFromFFA(ffa *fontfamily.FontFamily, style fontfamily.Style, size float64) textDrawOption

FontFaceFromFFA sets font face from FontFamily.

func Hex

func Hex(hex string) (*image.Uniform, error)

Hex create image.Uniform from the specified color hex.

func LineSpacing

func LineSpacing(px int) textDrawOption

LineSpace sets line space(px) of multi-line text.

func LoadFromFile

func LoadFromFile(filename string) (image.Image, error)

LoadFromFile loads an image file and generate image.Image from it. Supported image types are JPEG and PNG.

func MaxWidth

func MaxWidth(max int) textDrawOption

MaxWidth sets maximum width of text. If the full text width exceeds the limit, drawer adds line breaks.

func SaveAsPNG

func SaveAsPNG(filename string, img image.Image) error

SaveAsPNG saves image object as a PNG image.

Types

type Canvas

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

func CreateCanvasFromImage

func CreateCanvasFromImage(tpl image.Image) (*Canvas, error)

func (*Canvas) DrawBoxTexts

func (c *Canvas) DrawBoxTexts(texts []string, start config.Point, opts ...textDrawOption) error

func (*Canvas) DrawTextAtPoint

func (c *Canvas) DrawTextAtPoint(text string, start config.Point, opts ...textDrawOption) error

DrawTextAtPoint draws text on this canvas at the specified point.

func (*Canvas) SaveAsPNG

func (c *Canvas) SaveAsPNG(filename string) error

SaveAsPNG saves this canvas as a PNG file into the specified path.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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