package rough

Import Path
	github.com/d2lang/rough-go (on go.dev)

Dependency Relation
	imports 7 packages, and imported by 2 packages


Package-Level Type Names (total 15)
/* sort by: | */
Config configures a Generator. Options *Options func NewGenerator(config *Config, surface ...*Surface) *Generator
Drawable is the source-shaped output of Generator drawing methods. Options *ResolvedOptions Sets []OpSet Shape string func (*Generator).Arc(x, y, width, height, start, stop float64, closed bool, options *Options) Drawable func (*Generator).Circle(x, y, diameter float64, options *Options) Drawable func (*Generator).Curve(points []Point, options *Options) Drawable func (*Generator).Ellipse(x, y, width, height float64, options *Options) Drawable func (*Generator).Line(x1, y1, x2, y2 float64, options *Options) Drawable func (*Generator).LinearPath(points []Point, options *Options) Drawable func (*Generator).Path(pathData string, options *Options) Drawable func (*Generator).Polygon(points []Point, options *Options) Drawable func (*Generator).Rectangle(x, y, width, height float64, options *Options) Drawable func github.com/pancsta/d2/d2renderers/d2sketch.ArrowheadDrawables(arrowhead d2target.Arrowhead, stroke string, strokeWidth int) ([]Drawable, bool) func github.com/pancsta/d2/d2renderers/d2sketch.ConnectionDrawable(ctx context.Context, path d2scene.Path, limits d2sketch.SceneLimits) (Drawable, error) func (*Generator).ToPaths(d Drawable) []PathInfo func github.com/pancsta/d2/d2renderers/d2sketch.CompileScenePaths(ctx context.Context, drawable Drawable, limits d2sketch.SceneLimits) ([]d2sketch.ScenePath, error)
Generator creates Rough.js-compatible drawing operations. A Generator retains the same mutable default-option random state as Rough.js. Its methods are safe for concurrent use, though callers that need independent deterministic streams should use separate generators. Arc creates a rough elliptical arc. Circle creates a rough circle centered at x,y. Curve creates a rough curve through points. DefaultOptions returns a value copy of the generator's current defaults. Ellipse creates a rough ellipse centered at x,y. Line creates a rough line. LinearPath creates an open rough path through points. OpsToPath serializes operations using Rough.js's SVG punctuation and number formatting. Path creates a rough rendering of SVG path data. Polygon creates a closed rough polygon. Rectangle creates a rough rectangle. ToPaths converts a Drawable into the ordered SVG path descriptions emitted by Rough.js's generator API. func NewGenerator(config *Config, surface ...*Surface) *Generator
Line is a line segment represented by its two endpoints.
Op is one path operation and its ordered numeric arguments. Data []float64 Op OpType
OpSet is one ordered set of path operations. Ops []Op Path string Size *Point Type OpSetType func (*Generator).OpsToPath(drawing OpSet) string
OpSetType identifies the rendering role of an operation set. const OpSetFillPath const OpSetFillSketch const OpSetPath const OpSetPath2DFill const OpSetPath2DPattern
Options contains optional Rough.js drawing options. Pointer fields preserve the distinction between an omitted option and an explicit zero value. Bowing *float64 CurveFitting *float64 CurveStepCount *float64 CurveTightness *float64 DashGap *float64 DashOffset *float64 DisableMultiStroke *bool DisableMultiStrokeFill *bool Fill *string FillLineDash []float64 FillLineDashOffset *float64 FillShapeRoughnessGain *float64 FillStyle *string FillWeight *float64 FixedDecimalPlaceDigits *float64 HachureAngle *float64 HachureGap *float64 MaxRandomnessOffset *float64 PreserveVertices *bool Roughness *float64 Seed *float64 Simplification *float64 Stroke *string StrokeLineDash []float64 StrokeLineDashOffset *float64 StrokeWidth *float64 ZigzagOffset *float64 func (*Generator).Arc(x, y, width, height, start, stop float64, closed bool, options *Options) Drawable func (*Generator).Circle(x, y, diameter float64, options *Options) Drawable func (*Generator).Curve(points []Point, options *Options) Drawable func (*Generator).Ellipse(x, y, width, height float64, options *Options) Drawable func (*Generator).Line(x1, y1, x2, y2 float64, options *Options) Drawable func (*Generator).LinearPath(points []Point, options *Options) Drawable func (*Generator).Path(pathData string, options *Options) Drawable func (*Generator).Polygon(points []Point, options *Options) Drawable func (*Generator).Rectangle(x, y, width, height float64, options *Options) Drawable
OpType identifies a primitive path operation. const OpBCurveTo const OpLineTo const OpMove const OpQCurveTo
PathInfo is the SVG-oriented representation of an operation set. D string Fill string Pattern *PatternInfo Stroke string StrokeWidth float64 func (*Generator).ToPaths(d Drawable) []PathInfo
PatternInfo describes the pattern used by a patterned SVG path fill. Height float64 Path PathInfo PatternUnits string ViewBox string Width float64 X float64 Y float64
Point is a two-dimensional coordinate. func (*Generator).Curve(points []Point, options *Options) Drawable func (*Generator).LinearPath(points []Point, options *Options) Drawable func (*Generator).Polygon(points []Point, options *Options) Drawable
Rectangle is an axis-aligned rectangle. Height float64 Width float64 X float64 Y float64
Surface supplies the fallback dimensions used for patterned SVG path fills. Height float64 Width float64 func NewGenerator(config *Config, surface ...*Surface) *Generator
Package-Level Functions (total 6)
Bool returns a pointer suitable for a boolean Options field.
Float64 returns a pointer suitable for a numeric Options field.
NewGenerator creates a generator. A nil config uses Rough.js 4.6.6's defaults. The optional surface supplies patterned-path fallback dimensions.
NewSeed returns a nondeterministic seed in Rough.js's supported range.
NumberString formats v the way JavaScript coerces a Number to a string. It is useful when surrounding SVG serialization must remain byte-compatible with Rough.js output.
String returns a pointer suitable for a string Options field.
Package-Level Constants (total 9)
const OpBCurveTo OpType = "bcurveTo"
const OpLineTo OpType = "lineTo"
const OpMove OpType = "move"
const OpQCurveTo OpType = "qcurveTo"
const OpSetFillPath OpSetType = "fillPath"
const OpSetFillSketch OpSetType = "fillSketch"
const OpSetPath OpSetType = "path"
const OpSetPath2DFill OpSetType = "path2Dfill"
const OpSetPath2DPattern OpSetType = "path2Dpattern"