render

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package render provides visualization rendering for dependency graphs.

Overview

This package contains the rendering pipeline that transforms dependency graphs into visual outputs. It provides:

  • Generic format conversion (SVG to PDF/PNG)
  • Tower visualization (in [tower] subpackage)
  • Node-link diagrams (in [nodelink] subpackage)

Format Conversion

The ToPDF and ToPNG functions convert any SVG to other formats using the external rsvg-convert tool (from librsvg). These are used by both tower and node-link renderers.

svg := tower.RenderSVG(layout, opts...)
pdf, err := render.ToPDF(svg)
png, err := render.ToPNG(svg, 2.0)  // 2x scale

Tower Visualization

The [tower] subpackage renders dependency graphs as stacked physical towers where blocks rest on what they depend on. This is Stacktower's signature visualization style, inspired by XKCD #2347.

Key tower subpackages:

The [nodelink] subpackage renders traditional directed graph diagrams using Graphviz. Nodes appear as boxes connected by arrows.

dot := nodelink.ToDOT(g, nodelink.Options{})
svg, err := nodelink.RenderSVG(dot)
pdf, err := render.ToPDF(svg)

[tower]: github.com/matzehuels/stacktower/pkg/render/tower tower/layout: github.com/matzehuels/stacktower/pkg/render/tower/layout tower/ordering: github.com/matzehuels/stacktower/pkg/render/tower/ordering tower/sink: github.com/matzehuels/stacktower/pkg/render/tower/sink tower/styles: github.com/matzehuels/stacktower/pkg/render/tower/styles [nodelink]: github.com/matzehuels/stacktower/pkg/render/nodelink

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToPDF

func ToPDF(svg []byte) ([]byte, error)

ToPDF converts SVG bytes to PDF using rsvg-convert. Requires librsvg: brew install librsvg (macOS), apt install librsvg2-bin (Linux).

func ToPNG

func ToPNG(svg []byte, scale float64) ([]byte, error)

ToPNG converts SVG bytes to PNG using rsvg-convert with the given scale factor. Scale of 2.0 produces a 2x resolution image. Requires librsvg: brew install librsvg (macOS), apt install librsvg2-bin (Linux).

Types

This section is empty.

Directories

Path Synopsis
Package nodelink renders dependency graphs as traditional node-link diagrams.
Package nodelink renders dependency graphs as traditional node-link diagrams.
Package tower provides the physical tower visualization engine.
Package tower provides the physical tower visualization engine.
feature
Package feature provides analysis features for tower visualizations.
Package feature provides analysis features for tower visualizations.
layout
Package layout computes block positions for tower visualizations.
Package layout computes block positions for tower visualizations.
ordering
Package ordering provides algorithms for determining the left-to-right arrangement of nodes within each row of a layered graph.
Package ordering provides algorithms for determining the left-to-right arrangement of nodes within each row of a layered graph.
sink
Package sink provides output format renderers for tower visualizations.
Package sink provides output format renderers for tower visualizations.
styles
Package styles defines visual styles for tower rendering.
Package styles defines visual styles for tower rendering.
styles/handdrawn
Package handdrawn provides an XKCD-inspired hand-drawn visual style.
Package handdrawn provides an XKCD-inspired hand-drawn visual style.
transform
Package transform provides post-layout transformations for tower rendering.
Package transform provides post-layout transformations for tower rendering.

Jump to

Keyboard shortcuts

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