Documentation
¶
Overview ¶
Package file provides a output.Surface that encodes a single frame to disk (or any io.Writer) as PNG, SVG, or PDF.
Convenience functions Save and Encode build a output.Source and render it in one call. For lower-level control, blank-import this package and use output.NewSurface("file", ...) + output.Render.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encode ¶
func Encode(ctx context.Context, src output.Source, dst io.Writer, format string, width, height int, opts ...output.SurfaceOpt) (int64, error)
Encode builds src and writes encoded bytes to dst in the given format ("png" (default), "svg", "pdf"). If height ≤ 0 and the built figure implements output.Sizer, it is inferred from width. Returns the number of bytes written.
func Save ¶
func Save(ctx context.Context, src output.Source, filename string, width, height int, opts ...output.SurfaceOpt) error
Save builds src and renders to a file at the given dimensions. The output format is inferred from the file extension (.png, .svg, .pdf). If height ≤ 0 and the built figure implements output.Sizer, it is inferred from width.
Options: output.WithScale for HiDPI output, output.WithCPU to force the CPU rasterizer.
Types ¶
This section is empty.