package d2sketch
Import Path
github.com/pancsta/d2/d2renderers/d2sketch (on go.dev)
Dependency Relation
imports 16 packages, and imported by 2 packages
Package-Level Type Names (total 2)
SceneLimits bounds conversion work after rough-go has generated a drawable.
D2 callers must additionally charge the generated commands against their
document-wide scene/path budget.
MaxOps int
MaxSets int
func CompileScenePaths(ctx context.Context, drawable rough.Drawable, limits SceneLimits) ([]ScenePath, error)
func ConnectionDrawable(ctx context.Context, path d2scene.Path, limits SceneLimits) (rough.Drawable, error)
ScenePath is the renderer-neutral form of one ordered rough-go operation
set. Paint remains a string so callers can resolve D2 theme colors before
constructing scene paint.
Dash []float64
DashOffset float64
Fill string
Path d2scene.Path
Stroke string
StrokeWidth float64
func CompileScenePaths(ctx context.Context, drawable rough.Drawable, limits SceneLimits) ([]ScenePath, error)
Package-Level Functions (total 14)
ArrowheadDrawables returns the bounded, structured rough-go geometry for one
D2 arrowhead. Every generator input has a fixed number of points, and each
endpoint gets a fresh seeded generator so output is independent of object or
frame traversal order.
func Arrowheads(connection d2target.Connection, srcAdj, dstAdj *geo.Point) (string, error)
CompileScenePaths translates the rough-go operation types emitted by D2 into
typed scene paths. It rejects path2D operation sets.
Connection is retained for source compatibility. Its legacy textual
attribute list is parsed and re-serialized before use.
Deprecated: use ConnectionWithAttributes.
ConnectionDrawable converts a typed connection path into deterministic
rough-go operations without serializing or parsing SVG path data. Cubics are
flattened at a fixed resolution before roughening; this keeps generation
work predictable while retaining the route's rounded/curved silhouette.
limits bound the rough intermediate before any expanded point slice is
allocated. Long routes are generated in fixed-size sets so cancellation is
observed between bounded rough-go calls.
func ConnectionWithAttributes(connection d2target.Connection, path string, attributes []svg.Attribute) (string, error)
DefineFillPatterns adds reusable patterns that are overlayed on shapes with
fill. This gives it a subtle streaky effect that subtly looks hand-drawn but
not distractingly so.
TODO need to personalize this per shape like we do in Terrastruct app
TODO cleanup
![]() |
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. |