draw

package module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: MIT Imports: 2 Imported by: 1

README

Build Status codecov Maintainability

draw - package for writing software design diagrams

Documentation

Overview

Package draw provides svg writing features.

s := NewSvg()
s.WriteSvg(os.Stdout)

<svg
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  width="100" height="100" font-family="Arial, Helvetica, sans-serif"></svg>

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Svg

type Svg struct {
	Content []SvgWriter
	// contains filtered or unexported fields
}

func NewSvg

func NewSvg() *Svg

NewSvg returns an empty Svg of size 100x100

Example
s := NewSvg()
s.WriteSvg(os.Stdout)
Output:
<svg
  xmlns="http://www.w3.org/2000/svg"
  xmlns:xlink="http://www.w3.org/1999/xlink"
  width="100" height="100" font-family="Arial, Helvetica, sans-serif"></svg>

func (*Svg) Append

func (s *Svg) Append(w ...SvgWriter)

func (*Svg) Height

func (s *Svg) Height() int

func (*Svg) Prepend

func (s *Svg) Prepend(w ...SvgWriter)

func (*Svg) SetHeight

func (s *Svg) SetHeight(h int)

func (*Svg) SetSize

func (s *Svg) SetSize(w, h int)

func (*Svg) SetWidth

func (s *Svg) SetWidth(w int)

func (*Svg) Width

func (s *Svg) Width() int

func (*Svg) WriteSvg

func (s *Svg) WriteSvg(out io.Writer) error

type SvgWriter

type SvgWriter interface {
	WriteSvg(io.Writer) error
}

type TagWriter

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

func NewTagWriter

func NewTagWriter(w io.Writer) (*TagWriter, *error)

NewTagWriter returns a writer nexus. The referenced error is set by all methods if an error occurs.

Example
w, err := NewTagWriter(os.Stdout)
w.Print("hello")
*err = fmt.Errorf("stop subsequent calls")
w.Printf("cruel %s", "world")
Output:
hello

func (*TagWriter) Print

func (t *TagWriter) Print(args ...interface{})

Print prints arguments using the underlying writer. Does nothing if TagWriter has failed.

func (*TagWriter) Printf

func (t *TagWriter) Printf(format string, args ...interface{})

Printf prints a formated string using the underlying writer. Does nothing if TagWriter has failed.

func (*TagWriter) Write

func (t *TagWriter) Write(b []byte) (int, error)

Write writes the bytes using the underlying writer. Does nothing if TagWriter has failed.

Directories

Path Synopsis
internal
app
cmd/dog command
Document generation for example diagrams
Document generation for example diagrams
Package shape provides various SVG shapes
Package shape provides various SVG shapes
design
Package design provides svg diagram creators
Package design provides svg diagram creators
Package xy provides xy Position
Package xy provides xy Position

Jump to

Keyboard shortcuts

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