Documentation

Overview

    Package vgsvg uses svgo (github.com/ajstarks/svgo) as a backend for vg.

    Example
    Output:
    
    

    Index

    Examples

    Constants

    View Source
    const (
    	// DefaultWidth and DefaultHeight are the default canvas
    	// dimensions.
    	DefaultWidth  = 4 * vg.Inch
    	DefaultHeight = 4 * vg.Inch
    )

    Variables

    This section is empty.

    Functions

    func UseWH

    func UseWH(w, h vg.Length) option

      UseWH specifies the width and height of the canvas.

      Types

      type Canvas

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

      func New

      func New(w, h vg.Length) *Canvas

        New returns a new image canvas.

        func NewWith

        func NewWith(opts ...option) *Canvas

          NewWith returns a new image canvas created according to the specified options. The currently accepted options is UseWH. If size is not specified, the default is used.

          func (*Canvas) DrawImage

          func (c *Canvas) DrawImage(rect vg.Rectangle, img image.Image)

            DrawImage implements the vg.Canvas.DrawImage method.

            func (*Canvas) Fill

            func (c *Canvas) Fill(path vg.Path)

            func (*Canvas) FillString

            func (c *Canvas) FillString(font vg.Font, pt vg.Point, str string)

              FillString draws str at position pt using the specified font. Text passed to FillString is escaped with html.EscapeString.

              func (*Canvas) Pop

              func (c *Canvas) Pop()

              func (*Canvas) Push

              func (c *Canvas) Push()

              func (*Canvas) Rotate

              func (c *Canvas) Rotate(rot float64)

              func (*Canvas) Scale

              func (c *Canvas) Scale(x, y float64)

              func (*Canvas) SetColor

              func (c *Canvas) SetColor(clr color.Color)

              func (*Canvas) SetLineDash

              func (c *Canvas) SetLineDash(dashes []vg.Length, offs vg.Length)

              func (*Canvas) SetLineWidth

              func (c *Canvas) SetLineWidth(w vg.Length)

              func (*Canvas) Size

              func (c *Canvas) Size() (w, h vg.Length)

              func (*Canvas) Stroke

              func (c *Canvas) Stroke(path vg.Path)

              func (*Canvas) Translate

              func (c *Canvas) Translate(pt vg.Point)

              func (*Canvas) WriteTo

              func (c *Canvas) WriteTo(w io.Writer) (int64, error)

                WriteTo writes the canvas to an io.Writer.

                Source Files