Documentation
¶
Index ¶
- func GetImageBase64(rgba image.Image) (image_base64 string)
- func GetImageMD5(rgba image.Image) (image_MD5 string)
- func GetMaxTextLength(text []string) (max_text_length int, count_line int)
- func GetTextLength(text string) (length int)
- func ImageToByte(rgba image.Image) (image_bytes []byte)
- func ReadFontFile(font_file_path string) (f *truetype.Font, err error)
- func SaveImageToFile(rgba image.Image, file_path string)
- type OptionFunc
- func WithChars(i int) OptionFunc
- func WithDPI(f float64) OptionFunc
- func WithFontFile(s string) OptionFunc
- func WithFontSize(f float64) OptionFunc
- func WithHeight(i int) OptionFunc
- func WithHingting(s string) OptionFunc
- func WithOptions(t TextDrawer) OptionFunc
- func WithPadding(i int) OptionFunc
- func WithSpacing(f float64) OptionFunc
- func WithWidth(i int) OptionFunc
- func WithWonb(b bool) OptionFunc
- type TextDrawer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetImageBase64 ¶
func GetImageMD5 ¶
func GetMaxTextLength ¶
func GetTextLength ¶
func ImageToByte ¶
func SaveImageToFile ¶
Types ¶
type OptionFunc ¶
type OptionFunc func(*TextDrawer)
func WithChars ¶
func WithChars(i int) OptionFunc
func WithDPI ¶
func WithDPI(f float64) OptionFunc
func WithFontFile ¶
func WithFontFile(s string) OptionFunc
func WithFontSize ¶
func WithFontSize(f float64) OptionFunc
func WithHeight ¶
func WithHeight(i int) OptionFunc
func WithHingting ¶
func WithHingting(s string) OptionFunc
func WithOptions ¶
func WithOptions(t TextDrawer) OptionFunc
func WithPadding ¶
func WithPadding(i int) OptionFunc
func WithSpacing ¶
func WithSpacing(f float64) OptionFunc
func WithWidth ¶
func WithWidth(i int) OptionFunc
func WithWonb ¶
func WithWonb(b bool) OptionFunc
type TextDrawer ¶
type TextDrawer struct { DPI float64 // screen resolution in Dots Per Inch FontFile string // filename of the ttf font Hinting string // none | full FontSize 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 New ¶
func New(options ...OptionFunc) *TextDrawer
func (*TextDrawer) TextToImage ¶
func (t *TextDrawer) TextToImage(text []string) (rgba *image.RGBA, err error)
Click to show internal directories.
Click to hide internal directories.