shape

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 7 Imported by: 2

README

draw/shape - package provides SVG shape writers

Documentation

Overview

Package shape provides various SVG shapes

Index

Constants

View Source
const (
	DirectionRight Direction = (1 << iota)
	DirectionLeft
	DirectionUp
	DirectionDown

	DirectionDownRight = DirectionDown | DirectionRight
	DirectionDownLeft  = DirectionDown | DirectionLeft
	DirectionUpLeft    = DirectionUp | DirectionLeft
	DirectionUpRight   = DirectionUp | DirectionRight
)

Variables

This section is empty.

Functions

func Move added in v0.8.0

func Move(m Movable, xd, yd int)

func SetClass added in v0.10.0

func SetClass(class string, shapes ...Shape)

Types

type Actor added in v0.8.0

type Actor struct {
	xy.Point
	// contains filtered or unexported fields
}

func NewActor added in v0.8.0

func NewActor() *Actor

NewActor returns a new actor with a default height.

func (*Actor) Direction added in v0.8.0

func (a *Actor) Direction() Direction

func (*Actor) Edge added in v0.8.0

func (a *Actor) Edge(start xy.Point) xy.Point

func (*Actor) Height added in v0.8.0

func (a *Actor) Height() int

func (*Actor) SetClass added in v0.8.0

func (a *Actor) SetClass(class string)

func (*Actor) SetHeight added in v0.8.0

func (a *Actor) SetHeight(h int)

func (*Actor) Width added in v0.8.0

func (a *Actor) Width() int

func (*Actor) WriteSVG added in v0.12.0

func (a *Actor) WriteSVG(out io.Writer) error

type Adjuster

type Adjuster struct {
	Spacing int
	// contains filtered or unexported fields
}

Adjuster is used to position a shape relative to other shapes or at a specific xy position.

func NewAdjuster

func NewAdjuster(s ...Shape) *Adjuster

NewAdjuster returns an adjuster using DefaultSpacing.

func (*Adjuster) Above

func (a *Adjuster) Above(o Shape, space ...int) *Adjuster

Above places the wrapped shape above o. Optional space to override default.

func (*Adjuster) At

func (a *Adjuster) At(x, y int) *Adjuster

At sets the x, y coordinates of the wrapped shape

func (*Adjuster) Below

func (a *Adjuster) Below(o Shape, space ...int) *Adjuster

Below places the wrapped shape below o. Optional space to override default.

func (*Adjuster) LeftOf

func (a *Adjuster) LeftOf(o Shape, space ...int) *Adjuster

LeftOf places the wrapped shape to the left of o. Optional space to override default.

func (*Adjuster) Move added in v0.24.0

func (a *Adjuster) Move(dx, dy int) *Adjuster

Move adjusts shapes by moving them +/- in x and or y direction

func (*Adjuster) RightOf

func (a *Adjuster) RightOf(o Shape, space ...int) *Adjuster

RightOf places the wrapped shape to the right of o. Optional space to override default.

type Aligner

type Aligner struct{}

Aligner type aligns multiple shapes

func (Aligner) HAlignBottom

func (Aligner) HAlignBottom(shapes ...Shape)

HAlignBottom aligns shape[1:] to shape[0] bottom coordinates horizontally

func (Aligner) HAlignCenter

func (Aligner) HAlignCenter(shapes ...Shape)

HAlignCenter aligns shape[1:] to shape[0] center coordinates horizontally

func (Aligner) HAlignTop

func (Aligner) HAlignTop(shapes ...Shape)

HAlignTop aligns shape[1:] to shape[0] top coordinates horizontally

func (Aligner) VAlignCenter

func (Aligner) VAlignCenter(shapes ...Shape)

VAlignCenter aligns shape[1:] to shape[0] center coordinates vertically

func (Aligner) VAlignLeft

func (Aligner) VAlignLeft(shapes ...Shape)

VAlignLeft aligns shape[1:] to shape[0] left coordinates vertically

func (Aligner) VAlignRight

func (Aligner) VAlignRight(shapes ...Shape)

VAlignRight aligns shape[1:] to shape[0] right coordinates vertically

type Alignment

type Alignment int
const (
	Top Alignment = iota
	Left
	Right
	Bottom
	Center
)

type Anchor added in v0.29.0

type Anchor struct {
	Href string
	Shape
}

func NewAnchor added in v0.29.0

func NewAnchor(href string, v Shape) *Anchor

NewAnchor returns a HTML link entity that wraps any shape.

func (*Anchor) WriteSVG added in v0.29.0

func (a *Anchor) WriteSVG(out io.Writer) error

type Box

type Box interface {
	// Position returns the xy position of the top left corner.
	Position() (x int, y int)
	Width() int
	Height() int
}

type Card added in v0.26.0

type Card struct {
	// contains filtered or unexported fields
}

func NewCard added in v0.26.0

func NewCard(title string, args ...string) *Card

NewCard returns a card with title optional note and text. Default width is set to 310px. You can use multiple lines for text which will be joined with newlines.

func (*Card) Direction added in v0.26.0

func (c *Card) Direction() Direction

func (*Card) Edge added in v0.26.0

func (c *Card) Edge(start xy.Point) xy.Point

func (*Card) Height added in v0.26.0

func (c *Card) Height() int

func (*Card) Position added in v0.26.0

func (c *Card) Position() (x, y int)

func (*Card) SetClass added in v0.26.0

func (c *Card) SetClass(v string)

func (*Card) SetHeight added in v0.26.0

func (c *Card) SetHeight(v int)

func (*Card) SetIcon added in v0.26.0

func (c *Card) SetIcon(v Shape)

func (*Card) SetNote added in v0.26.0

func (c *Card) SetNote(v string)

func (*Card) SetText added in v0.26.0

func (c *Card) SetText(v string)

func (*Card) SetTitle added in v0.26.0

func (c *Card) SetTitle(v string)

func (*Card) SetWidth added in v0.26.0

func (c *Card) SetWidth(v int)

func (*Card) SetX added in v0.26.0

func (c *Card) SetX(v int)

func (*Card) SetY added in v0.26.0

func (c *Card) SetY(v int)

func (*Card) Width added in v0.26.0

func (c *Card) Width() int

func (*Card) WriteSVG added in v0.26.0

func (c *Card) WriteSVG(out io.Writer) error

type Circle

type Circle struct {
	xy.Point
	Radius int
	// contains filtered or unexported fields
}

func NewCircle

func NewCircle(radius int) *Circle

func (*Circle) Direction

func (c *Circle) Direction() Direction

func (*Circle) Edge

func (c *Circle) Edge(start xy.Point) xy.Point

func (*Circle) Height

func (c *Circle) Height() int

func (*Circle) SetClass

func (c *Circle) SetClass(class string)

func (*Circle) Width

func (c *Circle) Width() int

func (*Circle) WriteSVG added in v0.12.0

func (c *Circle) WriteSVG(out io.Writer) error

type Component

type Component struct {
	Title string

	Font draw.Font
	Pad  draw.Padding
	// contains filtered or unexported fields
}

func NewComponent

func NewComponent(title string) *Component

func (*Component) Direction

func (c *Component) Direction() Direction

func (*Component) Edge

func (c *Component) Edge(start xy.Point) xy.Point

Edge returns intersecting position of a line starting at start and pointing to the components center.

func (*Component) Height

func (c *Component) Height() int

func (*Component) Position

func (c *Component) Position() (x int, y int)

func (*Component) SetClass

func (c *Component) SetClass(v string)

func (*Component) SetFont

func (c *Component) SetFont(f draw.Font)

func (*Component) SetHref added in v0.20.0

func (c *Component) SetHref(v string)

SetHref links the title of the component. As of v0.29.0 you can use Anchor to link the entire shape.

func (*Component) SetTextPad

func (c *Component) SetTextPad(pad draw.Padding)

func (*Component) SetX

func (c *Component) SetX(x int)

func (*Component) SetY

func (c *Component) SetY(y int)

func (*Component) Width

func (c *Component) Width() int

func (*Component) WriteSVG added in v0.12.0

func (c *Component) WriteSVG(out io.Writer) error

type Container added in v0.28.0

type Container struct {
	*Group
	// contains filtered or unexported fields
}

func NewContainer added in v0.28.0

func NewContainer(label Shape, shapes ...Shape) *Container

NewContainer returns a dashed box surrounding the given shapes, placing the label shape in the bottom left corner.

func (*Container) Height added in v0.28.0

func (c *Container) Height() int

func (*Container) Width added in v0.28.0

func (c *Container) Width() int

func (*Container) WriteSVG added in v0.28.0

func (c *Container) WriteSVG(out io.Writer) error

type Cylinder added in v0.10.0

type Cylinder struct {
	Radius int

	Font draw.Font
	Pad  draw.Padding
	// contains filtered or unexported fields
}

func NewCylinder added in v0.10.0

func NewCylinder(radius, height int) *Cylinder

func (*Cylinder) Direction added in v0.10.0

func (c *Cylinder) Direction() Direction

func (*Cylinder) Edge added in v0.10.0

func (c *Cylinder) Edge(start xy.Point) xy.Point

func (*Cylinder) Height added in v0.10.0

func (c *Cylinder) Height() int

func (*Cylinder) Position added in v0.10.0

func (c *Cylinder) Position() (x int, y int)

func (*Cylinder) SetClass added in v0.10.0

func (c *Cylinder) SetClass(class string)

func (*Cylinder) SetX added in v0.10.0

func (c *Cylinder) SetX(x int)

func (*Cylinder) SetY added in v0.10.0

func (c *Cylinder) SetY(y int)

func (*Cylinder) Width added in v0.10.0

func (c *Cylinder) Width() int

func (*Cylinder) WriteSVG added in v0.12.0

func (c *Cylinder) WriteSVG(out io.Writer) error

type Database added in v0.10.0

type Database struct {
	*Cylinder
	Title string
}

func NewDatabase added in v0.10.0

func NewDatabase(title string) *Database

func (*Database) WriteSVG added in v0.12.0

func (d *Database) WriteSVG(out io.Writer) error

type Diamond

type Diamond struct {
	// contains filtered or unexported fields
}

func NewDecision

func NewDecision() *Diamond

func NewDiamond

func NewDiamond() *Diamond

func (*Diamond) Direction

func (d *Diamond) Direction() Direction

func (*Diamond) Edge

func (d *Diamond) Edge(start xy.Point) xy.Point

func (*Diamond) Height

func (d *Diamond) Height() int

func (*Diamond) Position

func (d *Diamond) Position() (x int, y int)

fixme should point to top left corner

func (*Diamond) SetClass

func (d *Diamond) SetClass(c string)

func (*Diamond) SetX

func (d *Diamond) SetX(x int)

func (*Diamond) SetY

func (d *Diamond) SetY(y int)

func (*Diamond) Width

func (d *Diamond) Width() int

func (*Diamond) WriteSVG added in v0.12.0

func (d *Diamond) WriteSVG(out io.Writer) error

type Direction

type Direction uint

func NewDirection added in v0.18.0

func NewDirection(from, to xy.Point) Direction

func (Direction) Is added in v0.18.0

func (d Direction) Is(dir Direction) bool

Method

type Dot

type Dot struct {
	Radius int
	// contains filtered or unexported fields
}

func NewDot

func NewDot() *Dot

func (*Dot) Direction

func (d *Dot) Direction() Direction

func (*Dot) Edge

func (d *Dot) Edge(start xy.Point) xy.Point

func (*Dot) Height

func (d *Dot) Height() int

func (*Dot) Position

func (d *Dot) Position() (x int, y int)

func (*Dot) SetClass

func (d *Dot) SetClass(class string)

func (*Dot) SetX

func (d *Dot) SetX(x int)

func (*Dot) SetY

func (d *Dot) SetY(y int)

func (*Dot) Width

func (d *Dot) Width() int

func (*Dot) WriteSVG added in v0.12.0

func (d *Dot) WriteSVG(out io.Writer) error

type Edge

type Edge interface {
	// Edge returns the intersecting position to a shape from start
	// position.
	Edge(start xy.Point) xy.Point
}

type ExitDot

type ExitDot struct {
	Radius int
	// contains filtered or unexported fields
}

func NewExitDot

func NewExitDot() *ExitDot

func (*ExitDot) Direction

func (e *ExitDot) Direction() Direction

func (*ExitDot) Edge

func (e *ExitDot) Edge(start xy.Point) xy.Point

func (*ExitDot) Height

func (e *ExitDot) Height() int

func (*ExitDot) Position

func (e *ExitDot) Position() (x int, y int)

func (*ExitDot) SetClass

func (e *ExitDot) SetClass(class string)

func (*ExitDot) SetX

func (e *ExitDot) SetX(x int)

func (*ExitDot) SetY

func (e *ExitDot) SetY(y int)

func (*ExitDot) Width

func (e *ExitDot) Width() int

func (*ExitDot) WriteSVG added in v0.12.0

func (e *ExitDot) WriteSVG(out io.Writer) error

type Group added in v0.28.0

type Group struct {
	Shapes []Shape
	Pad    draw.Padding
}

func NewGroup added in v0.28.0

func NewGroup(shapes ...Shape) *Group

NewGroup returns a virtual group of shapes which can be moved together.

func (*Group) BottomRightPos added in v0.28.0

func (g *Group) BottomRightPos() (x, y int)

func (*Group) Direction added in v0.28.0

func (g *Group) Direction() Direction

func (*Group) Edge added in v0.28.0

func (g *Group) Edge(start xy.Point) xy.Point

Edge returns intersecting position of a line starting at start and pointing to the rect center.

func (*Group) Height added in v0.28.0

func (g *Group) Height() int

func (*Group) Position added in v0.28.0

func (g *Group) Position() (x, y int)

func (*Group) SetClass added in v0.28.0

func (g *Group) SetClass(c string)

SetClass is a noop

func (*Group) SetPad added in v0.28.0

func (g *Group) SetPad(pad draw.Padding)

func (*Group) SetX added in v0.28.0

func (g *Group) SetX(x int)

SetX moves all shapes withing a group.

func (*Group) SetY added in v0.28.0

func (g *Group) SetY(y int)

SetY moves all shapes withing a group.

func (*Group) TopLeftPos added in v0.28.0

func (g *Group) TopLeftPos() (x, y int)

func (*Group) Width added in v0.28.0

func (g *Group) Width() int

func (*Group) WriteSVG added in v0.28.0

func (g *Group) WriteSVG(out io.Writer) error

type HasFont

type HasFont interface {
	SetFont(draw.Font)
}

type HasTextPad

type HasTextPad interface {
	SetTextPad(draw.Padding)
}

type Hexagon added in v0.19.0

type Hexagon struct {
	Title string

	Font draw.Font
	Pad  draw.Padding
	// contains filtered or unexported fields
}

func NewHexagon added in v0.19.0

func NewHexagon(title string, width, height, radius int) *Hexagon

NewHexagon with a title. Radius must be > 0 and is the distance from left/right corners to imaginary vertical line.

func (*Hexagon) Direction added in v0.19.0

func (r *Hexagon) Direction() Direction

func (*Hexagon) Edge added in v0.19.0

func (r *Hexagon) Edge(start xy.Point) xy.Point

Edge returns intersecting position of a line starting at start and pointing to the rect center.

func (*Hexagon) Height added in v0.19.0

func (r *Hexagon) Height() int

func (*Hexagon) Position added in v0.19.0

func (r *Hexagon) Position() (x int, y int)

func (*Hexagon) SetClass added in v0.19.0

func (r *Hexagon) SetClass(c string)

func (*Hexagon) SetFont added in v0.19.0

func (r *Hexagon) SetFont(f draw.Font)

func (*Hexagon) SetHeight added in v0.19.0

func (r *Hexagon) SetHeight(h int)

func (*Hexagon) SetTextPad added in v0.19.0

func (r *Hexagon) SetTextPad(pad draw.Padding)

func (*Hexagon) SetWidth added in v0.19.0

func (r *Hexagon) SetWidth(w int)

func (*Hexagon) SetX added in v0.19.0

func (r *Hexagon) SetX(x int)

func (*Hexagon) SetY added in v0.19.0

func (r *Hexagon) SetY(y int)

func (*Hexagon) Width added in v0.19.0

func (r *Hexagon) Width() int

func (*Hexagon) WriteSVG added in v0.19.0

func (r *Hexagon) WriteSVG(out io.Writer) error

type Hidden added in v0.29.0

type Hidden struct {
	Shape
}

func NewHidden added in v0.29.0

func NewHidden(v Shape) *Hidden

NewHidden returns a shap wrapper that is hidden, ie. not rendered.

func (*Hidden) WriteSVG added in v0.29.0

func (a *Hidden) WriteSVG(out io.Writer) error

type Internet added in v0.13.0

type Internet struct {
	Circle
	Title string

	Font draw.Font
	Pad  draw.Padding
	// contains filtered or unexported fields
}

func NewInternet added in v0.13.0

func NewInternet() *Internet

func (*Internet) SetFont added in v0.13.0

func (r *Internet) SetFont(f draw.Font)

func (*Internet) SetTextPad added in v0.13.0

func (r *Internet) SetTextPad(pad draw.Padding)

func (*Internet) WriteSVG added in v0.13.0

func (r *Internet) WriteSVG(out io.Writer) error

type Label

type Label struct {
	Font draw.Font
	Pad  draw.Padding
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel(text string) *Label

func (*Label) Direction

func (l *Label) Direction() Direction

func (*Label) Edge

func (l *Label) Edge(start xy.Point) xy.Point

func (*Label) Height

func (l *Label) Height() int

func (*Label) Position

func (l *Label) Position() (x int, y int)

func (*Label) SetClass

func (l *Label) SetClass(c string)

func (*Label) SetHref added in v0.20.0

func (l *Label) SetHref(v string)

func (*Label) SetText added in v0.31.0

func (l *Label) SetText(v string)

func (*Label) SetX

func (l *Label) SetX(x int)

func (*Label) SetY

func (l *Label) SetY(y int)

func (*Label) Text

func (l *Label) Text() string

func (*Label) Width

func (l *Label) Width() int

func (*Label) WriteSVG added in v0.12.0

func (l *Label) WriteSVG(out io.Writer) error

type Labeled added in v0.30.0

type Labeled struct {
	*Group
}

func NewLabeled added in v0.30.0

func NewLabeled(text string, s Shape) *Labeled

NewLabeled returns a shape with the text as a label below it.

type Line

type Line struct {
	Start xy.Point
	End   xy.Point
	Tail  Shape
	Head  Shape
	// contains filtered or unexported fields
}

func NewArrow

func NewArrow(x1, y1, x2, y2 int) *Line

func NewArrowBetween

func NewArrowBetween(a, b Shape) *Line

func NewLine

func NewLine(x1, y1 int, x2, y2 int) *Line

func (*Line) AbsAngle added in v0.22.0

func (a *Line) AbsAngle() int

AbsAngle

func (*Line) Angle added in v0.22.0

func (a *Line) Angle() int

Angle returns value in degrees. Right = 0, down = 90, left: 180, up = -90

func (*Line) CenterPosition added in v0.22.0

func (a *Line) CenterPosition() (x int, y int)

CenterPosition returns the center x, y values

func (*Line) DirQ1 added in v0.22.0

func (a *Line) DirQ1() bool

DirQ1 returns true if the arrow points to the bottom-right quadrant.

func (*Line) DirQ2 added in v0.22.0

func (a *Line) DirQ2() bool

DirQ2 returns true if the arrow points to the bottom-left quadrant.

func (*Line) DirQ3 added in v0.22.0

func (a *Line) DirQ3() bool

DirQ3 returns true if the arrow points to the top-left quadrant.

func (*Line) DirQ4 added in v0.22.0

func (a *Line) DirQ4() bool

DirQ4 returns true if the arrow points to the top-right quadrant.

func (*Line) Direction

func (a *Line) Direction() Direction

Direction returns vertical or horizontal direction, Other if at an angle. If Other, use arrow.DirQn() methods to check to which quadrant.

func (*Line) Height

func (a *Line) Height() int

func (*Line) Position

func (a *Line) Position() (x int, y int)

func (*Line) SetClass

func (a *Line) SetClass(c string)

func (*Line) SetX

func (a *Line) SetX(x int)

func (*Line) SetY

func (a *Line) SetY(y int)

func (*Line) Width

func (a *Line) Width() int

func (*Line) WriteSVG added in v0.12.0

func (a *Line) WriteSVG(out io.Writer) error

type Movable added in v0.8.0

type Movable interface {
	Position() (x int, y int)
	SetX(int)
	SetY(int)
}

type Note

type Note struct {
	Font draw.Font
	Pad  draw.Padding
	// contains filtered or unexported fields
}

func NewNote

func NewNote(text string) *Note

func (*Note) Direction

func (n *Note) Direction() Direction

func (*Note) Edge added in v0.8.0

func (n *Note) Edge(start xy.Point) xy.Point

func (*Note) Height

func (n *Note) Height() int

func (*Note) Position

func (n *Note) Position() (x int, y int)

func (*Note) SetClass

func (n *Note) SetClass(c string)

func (*Note) SetText added in v0.32.0

func (n *Note) SetText(v string)

func (*Note) SetX

func (n *Note) SetX(x int)

func (*Note) SetY

func (n *Note) SetY(y int)

func (*Note) Text

func (n *Note) Text() string

func (*Note) Width

func (n *Note) Width() int

func (*Note) WriteSVG added in v0.12.0

func (n *Note) WriteSVG(out io.Writer) error

type Process added in v0.24.0

type Process struct {
	Circle
	// contains filtered or unexported fields
}

func NewProcess added in v0.24.0

func NewProcess(text string) *Process

func (*Process) WriteSVG added in v0.24.0

func (r *Process) WriteSVG(out io.Writer) error

type Record

type Record struct {
	Title   string
	Fields  []string
	Methods []string

	Font draw.Font
	Pad  draw.Padding
	// contains filtered or unexported fields
}

func NewRecord

func NewRecord(title string) *Record

func (*Record) Direction

func (r *Record) Direction() Direction

func (*Record) Edge

func (r *Record) Edge(start xy.Point) xy.Point

Edge returns intersecting position of a line starting at start and pointing to the records center.

func (*Record) Height

func (r *Record) Height() int

func (*Record) HideFields

func (r *Record) HideFields()

func (*Record) HideMethod

func (r *Record) HideMethod(m string) (found bool)

func (*Record) HideMethods

func (r *Record) HideMethods()

func (*Record) Position

func (r *Record) Position() (x int, y int)

func (*Record) SetClass

func (r *Record) SetClass(c string)

func (*Record) SetFont

func (r *Record) SetFont(f draw.Font)

func (*Record) SetTextPad

func (r *Record) SetTextPad(pad draw.Padding)

func (*Record) SetX

func (r *Record) SetX(x int)

func (*Record) SetY

func (r *Record) SetY(y int)

func (*Record) Width

func (r *Record) Width() int

func (*Record) WriteSVG added in v0.12.0

func (r *Record) WriteSVG(out io.Writer) error

type Rect

type Rect struct {
	Title string

	Font draw.Font
	Pad  draw.Padding
	// contains filtered or unexported fields
}

func NewRect

func NewRect(title string) *Rect

func (*Rect) Direction

func (r *Rect) Direction() Direction

func (*Rect) Edge

func (r *Rect) Edge(start xy.Point) xy.Point

Edge returns intersecting position of a line starting at start and pointing to the rect center.

func (*Rect) Height

func (r *Rect) Height() int

func (*Rect) Position

func (r *Rect) Position() (x int, y int)

func (*Rect) SetClass

func (r *Rect) SetClass(c string)

func (*Rect) SetFont

func (r *Rect) SetFont(f draw.Font)

func (*Rect) SetHeight added in v0.8.0

func (r *Rect) SetHeight(h int)

func (*Rect) SetTextPad

func (r *Rect) SetTextPad(pad draw.Padding)

func (*Rect) SetWidth added in v0.8.0

func (r *Rect) SetWidth(w int)

func (*Rect) SetX

func (r *Rect) SetX(x int)

func (*Rect) SetY

func (r *Rect) SetY(y int)

func (*Rect) Width

func (r *Rect) Width() int

func (*Rect) WriteSVG added in v0.12.0

func (r *Rect) WriteSVG(out io.Writer) error

type Shape

type Shape interface {
	Box
	SetX(int)
	SetY(int)

	// Direction returns in which direction the shape is drawn.
	// The direction and position is needed when aligning shapes.
	Direction() Direction
	SetClass(string)
	WriteSVG(io.Writer) error
}

type State

type State struct {
	Title string

	Font draw.Font
	Pad  draw.Padding
	// contains filtered or unexported fields
}

func NewState

func NewState(title string) *State

func (*State) Direction

func (r *State) Direction() Direction

func (*State) Edge

func (r *State) Edge(start xy.Point) xy.Point

Edge returns intersecting position of a line starting at start and pointing to the rect center.

func (*State) Height

func (r *State) Height() int

func (*State) Position

func (r *State) Position() (x int, y int)

func (*State) SetClass

func (r *State) SetClass(c string)

func (*State) SetFont

func (r *State) SetFont(f draw.Font)

func (*State) SetTextPad

func (r *State) SetTextPad(pad draw.Padding)

func (*State) SetX

func (r *State) SetX(x int)

func (*State) SetY

func (r *State) SetY(y int)

func (*State) Width

func (r *State) Width() int

func (*State) WriteSVG added in v0.12.0

func (r *State) WriteSVG(out io.Writer) error

type Store added in v0.24.0

type Store struct {
	Title string

	Font draw.Font
	Pad  draw.Padding
	// contains filtered or unexported fields
}

func NewStore added in v0.24.0

func NewStore(title string) *Store

func (*Store) Direction added in v0.24.0

func (r *Store) Direction() Direction

func (*Store) Edge added in v0.24.0

func (r *Store) Edge(start xy.Point) xy.Point

func (*Store) Height added in v0.24.0

func (r *Store) Height() int

func (*Store) Position added in v0.24.0

func (r *Store) Position() (x int, y int)

func (*Store) SetClass added in v0.24.0

func (r *Store) SetClass(c string)

func (*Store) SetFont added in v0.24.0

func (r *Store) SetFont(f draw.Font)

func (*Store) SetHeight added in v0.24.0

func (r *Store) SetHeight(h int)

func (*Store) SetTextPad added in v0.24.0

func (r *Store) SetTextPad(pad draw.Padding)

func (*Store) SetWidth added in v0.24.0

func (r *Store) SetWidth(w int)

func (*Store) SetX added in v0.24.0

func (r *Store) SetX(x int)

func (*Store) SetY added in v0.24.0

func (r *Store) SetY(y int)

func (*Store) Width added in v0.24.0

func (r *Store) Width() int

func (*Store) WriteSVG added in v0.24.0

func (r *Store) WriteSVG(out io.Writer) error

type Triangle

type Triangle struct {
	// contains filtered or unexported fields
}

func NewTriangle

func NewTriangle() *Triangle

func (*Triangle) Direction

func (t *Triangle) Direction() Direction

func (*Triangle) Height

func (t *Triangle) Height() int

func (*Triangle) Position

func (t *Triangle) Position() (x int, y int)

func (*Triangle) SetClass

func (t *Triangle) SetClass(c string)

func (*Triangle) SetX

func (t *Triangle) SetX(x int)

func (*Triangle) SetY

func (t *Triangle) SetY(y int)

func (*Triangle) Width

func (t *Triangle) Width() int

func (*Triangle) WriteSVG added in v0.12.0

func (t *Triangle) WriteSVG(out io.Writer) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL