Documentation ¶
Index ¶
- Constants
- type DrawText
- func (drawtxt *DrawText) AddText(drawer *font.Drawer, max image.Point, text string) error
- func (drawtxt *DrawText) CreateBgImage(imgW, imgH int) *image.RGBA
- func (drawtxt *DrawText) CreateImageWithText(text, saveAs string) error
- func (drawtxt *DrawText) GetFont() (*truetype.Font, error)
- func (drawtxt *DrawText) GetFontDrawer(rgba *image.RGBA) (*font.Drawer, error)
- func (drawtxt *DrawText) LoadBgImage(imgpath string) (*image.RGBA, error)
- func (drawtxt *DrawText) SaveImage(rgba *image.RGBA, outFilepath string) error
- func (drawtxt *DrawText) SetFgColor()
Constants ¶
View Source
const ( DefaultDpi = 72 DefaultFontFile = "fonts/FFF_Tusj.ttf" DefaultHinting = "none" // values: none, full DefaultFontSize = 12 // value in points DefaultFontSpacing = 1.25 // e.g. 2 means double spaced DefaultMaxCharsPerLine = 16 DefaultWhiteOnBlack = false // useful when creating image as well DefaultTextPointX = 10 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DrawText ¶
type DrawText struct { SrcImgPath string `json:"src_img_path"` Dpi float64 `json:"dpi"` FontPath string `json:"font_path"` // only TTF for now Hinting string `json:"hinting"` FontSize float64 `json:"font_size"` FontSpacing float64 `json:"font_spacing"` FontColorName string `json:"font_color_name"` // for names in colorname MaxCharsPerLine int `json:"max_chars_per_line"` WhiteOnBlack bool `json:"white_on_black"` TextTitle string `json:"text_title"` FontColor *image.Uniform }
func (*DrawText) CreateBgImage ¶
Draw the background and the guidelines.
func (*DrawText) CreateImageWithText ¶
func (*DrawText) GetFontDrawer ¶
Get Font Drawer instance with destination image & font configs
func (*DrawText) LoadBgImage ¶
Load an existing Background image
Click to show internal directories.
Click to hide internal directories.