Documentation
¶
Index ¶
- Constants
- func ArrowheadDrawables(arrowhead d2target.Arrowhead, stroke string, strokeWidth int) ([]rough.Drawable, bool)
- func Arrowheads(connection d2target.Connection, srcAdj, dstAdj *geo.Point) (string, error)
- func Class(shape d2target.Shape) (string, error)
- func Connection(connection d2target.Connection, path, attrs string) (string, error)
- func ConnectionDrawable(ctx context.Context, path d2scene.Path, limits SceneLimits) (rough.Drawable, error)
- func DefineFillPatterns(buf *bytes.Buffer, diagramHash string)
- func DoubleOval(shape d2target.Shape, diagramHash string) (string, error)
- func DoubleRect(shape d2target.Shape, diagramHash string) (string, error)
- func Oval(shape d2target.Shape, diagramHash string) (string, error)
- func Paths(shape d2target.Shape, diagramHash string, paths []string) (string, error)
- func Rect(shape d2target.Shape, diagramHash string) (string, error)
- func Table(shape d2target.Shape) (string, error)
- type SceneLimits
- type ScenePath
Constants ¶
const ( BG_COLOR = color.N7 FG_COLOR = color.N1 )
Variables ¶
This section is empty.
Functions ¶
func ArrowheadDrawables ¶ added in v0.9.0
func ArrowheadDrawables(arrowhead d2target.Arrowhead, stroke string, strokeWidth int) ([]rough.Drawable, bool)
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 ¶
func Connection ¶
func Connection(connection d2target.Connection, path, attrs string) (string, error)
func ConnectionDrawable ¶ added in v0.9.0
func ConnectionDrawable(ctx context.Context, path d2scene.Path, limits SceneLimits) (rough.Drawable, error)
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 DefineFillPatterns ¶
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.
Types ¶
type SceneLimits ¶ added in v0.9.0
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.
type ScenePath ¶ added in v0.9.0
type ScenePath struct {
Path d2scene.Path
Fill string
Stroke string
StrokeWidth float64
Dash []float64
DashOffset float64
}
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.
func CompileScenePaths ¶ added in v0.9.0
func CompileScenePaths(ctx context.Context, drawable rough.Drawable, limits SceneLimits) ([]ScenePath, error)
CompileScenePaths translates the rough-go operation types emitted by D2 into typed scene paths. It rejects path2D operation sets.