image

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTextDrawer = NewTextDrawer(0, 0, 0)

Functions

func GetMaxTextLength

func GetMaxTextLength(text []string) (max_text_length int, count_line int)

func GetTextLength

func GetTextLength(text string) (length int)

Types

type TextDrawer

type TextDrawer struct {
	DPI      float64 // screen resolution in Dots Per Inch
	FontFile string  // filename of the ttf font
	Hinting  string  // none | full
	Size     float64 // font size in points
	Height   int     // image height in points
	Width    int     // image width in points
	Padding  int     // text left and right padding
	Chars    int     // chars displayed per line
	Spacing  float64 // line spacing
	Wonb     bool    // white text on a black background
}

func NewTextDrawer

func NewTextDrawer(width int, height int, chars int) (t *TextDrawer)

func (*TextDrawer) GetImageBase64AndMD5

func (t *TextDrawer) GetImageBase64AndMD5(rgba image.Image) (image_base64 string, image_MD5 string)

func (*TextDrawer) ReadFontFile

func (t *TextDrawer) ReadFontFile() (f *truetype.Font, err error)

func (*TextDrawer) SaveImageToFile

func (t *TextDrawer) SaveImageToFile(rgba image.Image, fileName string)

func (*TextDrawer) TextToImage

func (t *TextDrawer) TextToImage(text []string) (rgba *image.RGBA, err error)

Jump to

Keyboard shortcuts

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