Documentation
¶
Overview ¶
Package paint rasterises a laid-out box tree onto an *image.RGBA using go-opentype for anti-aliased text, go-widgets/painter for backgrounds and go-images-decoded bitmaps for <img>. It also provides the Measurer the layout package needs (advances + vertical metrics from real font faces).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Paint ¶
Paint draws the box tree onto dst. imgs supplies decoded <img> bitmaps keyed by node (already scaled to the layout size); a missing entry is skipped. The caller owns clearing dst to its base (e.g. white) beforehand. It is equivalent to PaintFull with no background-image bitmaps.
func PaintFull ¶
func PaintFull(dst *image.RGBA, box *layout.Box, f *Fonts, imgs map[*dom.Node]image.Image, bgImgs map[string]image.Image)
PaintFull draws the box tree onto dst, additionally painting CSS background-image layers (gradients and url() bitmaps). bgImgs supplies decoded background bitmaps keyed by their raw url() token; gradients need no bitmap.
Types ¶
type Fonts ¶
type Fonts struct {
// contains filtered or unexported fields
}
Fonts is a registry of parsed font families (per family × bold × italic) with a per-size Face cache. It is not safe for concurrent use (Faces cache glyphs); build one per render.
func NewFonts ¶
func NewFonts() *Fonts
NewFonts parses the bundled families in all four styles: sans = Inter, serif = Lora (both with real Bold/Italic/BoldItalic), mono = Go Mono (Regular only — bold/italic fall back to it, as the family ships no other styles). It panics only if a bundled font fails to parse, which would be a build-time defect in the fonts module, not a runtime condition.