package goat
import "github.com/bep/goat"
Index ¶
- func BuildAndWriteSVG(src io.Reader, dst io.Writer)
- type Bridge
- type Canvas
- func NewCanvas(in io.Reader) Canvas
- func (c *Canvas) Bridges() []Drawable
- func (c *Canvas) Circles() []Circle
- func (c *Canvas) HalfSteps() []Line
- func (c *Canvas) Lines() []Line
- func (c *Canvas) RoundedCorners() []RoundedCorner
- func (c *Canvas) String() string
- func (c *Canvas) Text() []Drawable
- func (c *Canvas) Triangles() []Drawable
- func (c *Canvas) WriteSVGBody(dst io.Writer)
- type Circle
- type Drawable
- type Index
- type Line
- type Orientation
- type Pixel
- type RoundedCorner
- type SVG
- type Text
- type Triangle
Functions ¶
func BuildAndWriteSVG ¶
BuildAndWriteSVG reads in a newline-delimited ASCII diagram from src and writes a corresponding SVG diagram to dst.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge correspondes to combinations of "-)-" or "-(-" and is displayed as the vertical line "hopping over" the horizontal.
func (Bridge) Draw ¶
Draw a bridge as an SVG elliptical arc element.
type Canvas ¶
Canvas represents a 2D ASCII rectangle.
func NewCanvas ¶
NewCanvas creates a new canvas with contents read from the given io.Reader. Content should be newline delimited.
func (*Canvas) Bridges ¶
Bridges returns a slice of all bridges, "-)-" or "-(-".
func (*Canvas) Circles ¶
Circles returns a slice of all 'o' and '*' characters not considered text.
func (*Canvas) HalfSteps ¶
func (*Canvas) Lines ¶
Lines returns a slice of all Line drawables that we can detect -- in all possible orientations.
func (*Canvas) RoundedCorners ¶
func (c *Canvas) RoundedCorners() []RoundedCorner
RoundedCorners returns a slice of all curvy corners in the diagram.
func (*Canvas) String ¶
func (*Canvas) Text ¶
Text returns a slice of all text characters not belonging to part of the diagram. How these characters are identified is rather complicated.
func (*Canvas) Triangles ¶
Triangles returns a slice of all detectable Triangles.
func (*Canvas) WriteSVGBody ¶
type Circle ¶
type Circle struct {
// contains filtered or unexported fields
}
Circle corresponds to "o" or "*" runes in the absence of surrounding alphanumerics.
func (*Circle) Draw ¶
Draw a solid circle as an SVG circle element.
type Drawable ¶
Drawable represents anything that can Draw itself.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index represents a position within an ASCII diagram.
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line represents a straight segment between two points.
func (Line) Draw ¶
Draw a straight line as an SVG path.
type Orientation ¶
type Orientation int
Orientation represents the primary direction that a Drawable is facing.
const ( NONE Orientation = iota // No orientation; no structure present. N // North NE // Northeast NW // Northwest S // South SE // Southeast SW // Southwest E // East W // West )
type Pixel ¶
type Pixel Index
Pixel represents the on-screen coordinates for an Index.
type RoundedCorner ¶
type RoundedCorner struct {
// contains filtered or unexported fields
}
RoundedCorner corresponds to combinations of "-." or "-'".
func (*RoundedCorner) Draw ¶
func (c *RoundedCorner) Draw(out io.Writer)
Draw a rounded corner as an SVG elliptical arc element.
type SVG ¶
func BuildSVG ¶
BuildSVG reads in a newline-delimited ASCII diagram from src and returns a SVG.
func (SVG) String ¶
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text corresponds to any runes not reserved for diagrams, or reserved runes surrounded by alphanumerics.
func (Text) Draw ¶
Draw a single text character as an SVG text element.
type Triangle ¶
type Triangle struct {
// contains filtered or unexported fields
}
Triangle corresponds to "^", "v", "<" and ">" runes in the absence of surrounding alphanumerics.
func (Triangle) Draw ¶
Draw a solid triable as an SVG polygon element.
Source Files ¶
canvas.go index.go iter.go svg.go
- Version
- v0.5.0 (latest)
- Published
- Feb 22, 2022
- Platform
- darwin/amd64
- Imports
- 5 packages
- Last checked
- now –
Tools for package owners.