Documentation
¶
Overview ¶
Package svg encodes a display.Box as a standalone SVG document.
The encoder is an optional pure-Go output adapter. It consumes the visible commands exposed by render.Walk, resolves paint roles against a caller supplied Palette, and includes certified box overflow in its viewBox.
SVG output is intended for embedding and interchange, not as a stable wire protocol. Use an application-owned version if serialized output must be persisted across upgrades.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidBox reports a nil or structurally invalid display box. ErrInvalidBox = errors.New("svg: invalid box") // ErrInvalidOptions reports unsupported padding or numeric precision. ErrInvalidOptions = errors.New("svg: invalid options") // ErrInvalidWriter reports a nil output writer. ErrInvalidWriter = errors.New("svg: invalid writer") )
Functions ¶
Types ¶
type Options ¶
type Options struct {
Padding float32
Precision int
Background *color.NRGBA
Palette Palette
Title string
Description string
}
Options controls SVG sizing, colors, and metadata.
Padding is added on every side of Box.Bounds(). Precision is the maximum number of fractional digits; zero emits the shortest exact float32 form. A nil Background leaves the background transparent. An all-zero Palette uses DefaultPalette. Title and Description are escaped XML text.
func DefaultOptions ¶
func DefaultOptions() Options
DefaultOptions returns the default encoder options.