Documentation ¶
Index ¶
- func AddCenteredText(s string, f font.Face, fg color.Color, canvas *Canvas)
- func BreakLines(s string, f font.Face, canvas *Canvas) (lines []string, lineHeight float64)
- func DrawGrid(canvas *Canvas, n int)
- func ImageOf(canvas *Canvas) image.Image
- func MakeNewFontFace(f *opentype.Font, size int) font.Face
- func RenderCanvas(canvas *Canvas, filetype string) []byte
- func SetCursor(canvas *Canvas, xpos, ypos float64)
- func WriteLine(s string, align string, f font.Face, fg color.Color, canvas *Canvas)
- type Canvas
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCenteredText ¶
AddCenteredText adds a centered text.
func BreakLines ¶
BreakLines breaks s into one or more lines to make sure each part fits within the margins of canvas. It also returns the expected maximal line height.
func MakeNewFontFace ¶
MakeNewFontFace makes a new font face for writing.
func RenderCanvas ¶
RenderCanvas encodes the image of canvas. filetype is given as the extension ("png", "jpg"). Default filetype is "png".
func SetCursor ¶
SetCursor sets the position of the curser to xpos,ypos. The value should be between 0 and 1 representing the position relative to the printable size (canvas size minus the margins). (0,0) is top left, (1,1) is bottom right. And the cursor position represents the top left corner of the bounding box of next string to be written.