utils

package
v0.0.0-...-3971041 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcMonoFontSize

func CalcMonoFontSize(ttFont *truetype.Font, spacing float64, textLines []string, bounds image.Rectangle) int

CalcMonoFontSize calcula o tamanho maximo da fonte usada no bloco de texto para caber em bounds.

func CreateFontContext

func CreateFontContext(ttFont *truetype.Font, fontSize float64, clipRectangle image.Rectangle, canvas draw.Image, color color.Color) *freetype.Context

func DrawString

func DrawString(fc *freetype.Context, ttFont *truetype.Font, fontSize float64, clipRectangle image.Rectangle, alignment string, spacing float64, text []string, x, y int) error

DrawString calculates the widths and print to image

func HLine

func HLine(img *image.RGBA, col color.Color, x1, y, x2 int)

HLine draws a horizontal line

func ParseHexColor

func ParseHexColor(s string) (c color.RGBA, err error)

func ParseRGBA

func ParseRGBA(rgba string) color.RGBA

func Rect

func Rect(img *image.RGBA, col color.Color, x1, y1, x2, y2 int)

Rect draws a rectangle using HLine() and VLine()

func TextHeight

func TextHeight(fc *freetype.Context, size, spacing float64, lines []string) int

func TextWidthInPixels

func TextWidthInPixels(ttFont *truetype.Font, size float64, text string) int

func VLine

func VLine(img *image.RGBA, col color.Color, x, y1, y2 int)

VLine draws a vertical line

func WordWrap

func WordWrap(text string, lineWidth int) (lines []string)

Types

This section is empty.

Jump to

Keyboard shortcuts

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