package d2isometricimg
Import Path
github.com/pancsta/d2/d2renderers/d2isometric/d2isometricimg (on go.dev)
Dependency Relation
imports 49 packages, and imported by one package
Involved Source Files
arrow_visibility.go
framing.go
geometry.go
geometry_routes.go
gif.go
gif_loop.go
gradient_paints.go
ground_receivers.go
hierarchy_boards.go
hierarchy_headers.go
hierarchy_support.go
lighting.go
markdown_cards.go
native.go
native_edges.go
native_ink_joins.go
native_page.go
native_shapes.go
native_solids.go
native_structured.go
native_style.go
opacity_groups.go
page.go
projection_clearance.go
raster.go
Package d2isometricimg renders the D2 3D scene to SVG, PNG or GIF in pure Go.
It needs no browser, GPU, external executable, or system fonts.
rich_labels.go
route_bridges.go
route_caption_mask.go
route_caption_style.go
route_labels.go
route_lanes.go
route_style.go
sequence_geometry.go
sequence_routes.go
solid_contacts.go
source_panels.go
surface_document.go
surface_fonts.go
surface_icons.go
svg.go
svg_fragments.go
svg_lighting.go
svg_order.go
svg_seams.go
svg_surface_resources.go
svg_visibility.go
svg_visibility_tree.go
text.go
timeline.go
vector_surface.go
vector_surface_animation.go
vector_surface_color.go
vector_surface_svg.go
vector_surface_text.go
Package-Level Type Names (total 8)
Color color.NRGBA
Emissive color.NRGBA
Metalness float64
Multiply composites this surface into the existing sRGB color while
retaining source-over alpha. Group regions normally also use NoDepthWrite.
Roughness float64
Texture image.Image
Unlit bool
Vector *nativeVectorSurface
Options uses fixed output pixels. Zero dimensions select 1600x1000 for PNG
or 1000x625 for GIF.
Timeout defaults to two minutes and cannot exceed two minutes. An earlier
caller deadline always wins.
Assets explicitly supplies bounded image loading. Rendering does not
otherwise read local files or fetch remote resources.
FitContent treats Width and Height as maximum dimensions and trims unused
canvas to the projected diagram's aspect ratio. Geometry is never resized.
Fonts supplies optional bounded fallback discovery. Configured D2 font
families are retained even when no fallback resolver is provided.
Format Format
Height int
LinkBudget bounds page annotations before they are accumulated. Nil uses
4096 regions and 1 MiB of destination/tooltip text for RenderPage.
Render d2isometric.RenderOpts
Timeout time.Duration
Width int
func CaptureFrames(ctx context.Context, diagram *d2target.Diagram, opts *Options, seconds []float64, traffic bool, emit func(int, []byte) error) error
func Render(ctx context.Context, diagram *d2target.Diagram, opts *Options) ([]byte, error)
func RenderPage(ctx context.Context, diagram *d2target.Diagram, opts *Options) (*Page, error)
func RenderTimeline(ctx context.Context, boards []*d2target.Diagram, opts *Options, interval time.Duration) ([]byte, error)
func github.com/pancsta/d2/d2renderers/d2svg.RenderIsometric(ctx context.Context, diagram *d2target.Diagram, opts *d2svg.RenderOpts, native *Options) ([]byte, error)
Page combines the native PNG with annotations in final image pixels. Writers
can resize the image and annotations together for a PDF page or PPTX slide.
Height int
Links []d2scene.LinkRegion
PNG []byte
Width int
func RenderPage(ctx context.Context, diagram *d2target.Diagram, opts *Options) (*Page, error)
Raster owns the static color/depth buffers and a directional shadow map.
It is immutable after construction. Independent Frame calls may run in
parallel; callers should bound that concurrency to their memory budget.
Frame reuses the static image and shadow map. Small images retain sample
depth; large images replay the same static samples only in affected strips.
Unchanged pixels remain identical across frames. The result is caller-owned.
func NewRaster(ctx context.Context, width, height int, triangles []Triangle, background color.NRGBA) (*Raster, error)
CastShadow bool
DepthBias float64
Material *Material
NoDepthWrite bool
OpacityGroup fades a complete native object after its own opaque
surfaces and printed cells have resolved their mutual occlusion.
PaintOwner keeps a native object's substrate and decals together when
they must be ordered around a separate partial-opacity object.
Filled physical caps use source fill alpha rather than the printed
texture's antialiased outline coverage. Nil preserves texture holes.
ShadowOpacity still controls the strength of this physical shadow.
Hierarchy roots have independent implicit ground receivers. Nil keeps
the legacy scene-wide receiver. The pointed value is immutable.
Nil uses the material opacity; animation may fade its shadow separately
from the visible surface. The pointed value is immutable for a frame.
V [3]Vertex
func NewRaster(ctx context.Context, width, height int, triangles []Triangle, background color.NRGBA) (*Raster, error)
func (*Raster).Frame(ctx context.Context, dynamic []Triangle) (*image.RGBA, error)
type Vec = d2isometric.Vec3 (struct)
Package-Level Functions (total 5)
CaptureFrames delivers lossless frames at exact scene times, serially. It is
useful for deterministic comparison and other bounded image encoders. The
callback owns each PNG and may retain it; no frame cache is kept here.
NewRaster fits the occupied vertices with a fixed orthographic camera.
It uses 2x supersampling at every supported size. Large surfaces render in
bounded strips rather than dropping coverage quality or allocating all samples.
Background is final opaque sRGB, unaffected by material lighting.
Render returns a vector SVG or lossless PNG without traffic particles, or an
infinitely looping GIF with a fixed camera and deterministic traffic. Rendering stays
in memory and does not start external processes. Image I/O, when needed,
is performed only by the explicitly supplied asset resolver.
RenderPage renders one compiled board and returns its image and bounded
annotation regions for D2's native PDF/PPTX writers.
RenderTimeline renders ordered boards into one looping GIF. Each board is
shown for interval, rounded to GIF centiseconds. Authored animated edges move
during their board; static boards need only one held frame. A single palette
covers all boards. Only one board's raster is retained at a time.
Package-Level Constants (total 10)
const CycleSeconds = 8.33333 const FrameCount = 100 const MaxAnimationPixels = 100000000 const MaxDimension = 4096 const MaxOutputBytes = 67108864 const MaxPixels = 12000000 const MaxTimelineBoards = 128
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |