...

Package recorder

import "gonum.org/v1/plot/vg/recorder"
Overview
Index

Overview ▾

Package recorder provides support for vector graphics serialization.

Index ▾

type Action
type Canvas
    func (c *Canvas) Comment(text string)
    func (c *Canvas) DrawImage(rect vg.Rectangle, img image.Image)
    func (c *Canvas) Fill(path vg.Path)
    func (c *Canvas) FillString(font font.Face, pt vg.Point, str string)
    func (c *Canvas) Pop()
    func (c *Canvas) Push()
    func (c *Canvas) ReplayOn(dst vg.Canvas) error
    func (c *Canvas) Reset()
    func (c *Canvas) Rotate(a float64)
    func (c *Canvas) Scale(x, y float64)
    func (c *Canvas) SetColor(col color.Color)
    func (c *Canvas) SetLineDash(dashes []vg.Length, offs vg.Length)
    func (c *Canvas) SetLineWidth(w vg.Length)
    func (c *Canvas) Stroke(path vg.Path)
    func (c *Canvas) Translate(pt vg.Point)
type Comment
    func (a *Comment) ApplyTo(c vg.Canvas)
    func (a *Comment) Call() string
type Commenter
type DrawImage
    func (a *DrawImage) ApplyTo(c vg.Canvas)
    func (a *DrawImage) Call() string
type Fill
    func (a *Fill) ApplyTo(c vg.Canvas)
    func (a *Fill) Call() string
type FillString
    func (a *FillString) ApplyTo(c vg.Canvas)
    func (a *FillString) Call() string
type Pop
    func (a *Pop) ApplyTo(c vg.Canvas)
    func (a *Pop) Call() string
type Push
    func (a *Push) ApplyTo(c vg.Canvas)
    func (a *Push) Call() string
type Rotate
    func (a *Rotate) ApplyTo(c vg.Canvas)
    func (a *Rotate) Call() string
type Scale
    func (a *Scale) ApplyTo(c vg.Canvas)
    func (a *Scale) Call() string
type SetColor
    func (a *SetColor) ApplyTo(c vg.Canvas)
    func (a *SetColor) Call() string
type SetLineDash
    func (a *SetLineDash) ApplyTo(c vg.Canvas)
    func (a *SetLineDash) Call() string
type SetLineWidth
    func (a *SetLineWidth) ApplyTo(c vg.Canvas)
    func (a *SetLineWidth) Call() string
type Stroke
    func (a *Stroke) ApplyTo(c vg.Canvas)
    func (a *Stroke) Call() string
type Translate
    func (a *Translate) ApplyTo(c vg.Canvas)
    func (a *Translate) Call() string

Package files

recorder.go

type Action

Action is a vector graphics action as defined by the vg.Canvas interface. Each method of Canvas has a corresponding Action type.

type Action interface {
    Call() string
    ApplyTo(vg.Canvas)
    // contains filtered or unexported methods
}

type Canvas

Canvas implements vg.Canvas operation serialization.

type Canvas struct {
    // Actions holds a log of all methods called on
    // the canvas.
    Actions []Action

    // KeepCaller indicates whether the Canvas will
    // retain runtime caller location for the actions.
    // This includes source filename and line number.
    KeepCaller bool
    // contains filtered or unexported fields
}

func (*Canvas) Comment

func (c *Canvas) Comment(text string)

Comment adds a comment to a list of Actions..

func (*Canvas) DrawImage

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

DrawImage implements the DrawImage method of the vg.Canvas interface.

func (*Canvas) Fill

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

Fill implements the Fill method of the vg.Canvas interface.

func (*Canvas) FillString

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

FillString implements the FillString method of the vg.Canvas interface.

func (*Canvas) Pop

func (c *Canvas) Pop()

Pop implements the Pop method of the vg.Canvas interface.

func (*Canvas) Push

func (c *Canvas) Push()

Push implements the Push method of the vg.Canvas interface.

func (*Canvas) ReplayOn

func (c *Canvas) ReplayOn(dst vg.Canvas) error

ReplayOn applies the set of Actions recorded by the Recorder onto the destination Canvas.

func (*Canvas) Reset

func (c *Canvas) Reset()

Reset resets the Canvas to the base state.

func (*Canvas) Rotate

func (c *Canvas) Rotate(a float64)

Rotate implements the Rotate method of the vg.Canvas interface.

func (*Canvas) Scale

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

Scale implements the Scale method of the vg.Canvas interface.

func (*Canvas) SetColor

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

SetColor implements the SetColor method of the vg.Canvas interface.

func (*Canvas) SetLineDash

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

SetLineDash implements the SetLineDash method of the vg.Canvas interface.

func (*Canvas) SetLineWidth

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

SetLineWidth implements the SetLineWidth method of the vg.Canvas interface.

func (*Canvas) Stroke

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

Stroke implements the Stroke method of the vg.Canvas interface.

func (*Canvas) Translate

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

Translate implements the Translate method of the vg.Canvas interface.

type Comment

Comment implements a Recorder comment mechanism.

type Comment struct {
    Text string
    // contains filtered or unexported fields
}

func (*Comment) ApplyTo

func (a *Comment) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*Comment) Call

func (a *Comment) Call() string

Call returns the method call that generated the action.

type Commenter

Commenter defines types that can record comments.

type Commenter interface {
    Comment(string)
}

type DrawImage

DrawImage corresponds to the vg.Canvas.DrawImage method

type DrawImage struct {
    Rectangle vg.Rectangle
    Image     image.Image
    // contains filtered or unexported fields
}

func (*DrawImage) ApplyTo

func (a *DrawImage) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*DrawImage) Call

func (a *DrawImage) Call() string

Call returns the pseudo method call that generated the action.

type Fill

Fill corresponds to the vg.Canvas.Fill method.

type Fill struct {
    Path vg.Path
    // contains filtered or unexported fields
}

func (*Fill) ApplyTo

func (a *Fill) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*Fill) Call

func (a *Fill) Call() string

Call returns the method call that generated the action.

type FillString

FillString corresponds to the vg.Canvas.FillString method.

type FillString struct {
    Font   font.Font
    Size   vg.Length
    Point  vg.Point
    String string
    // contains filtered or unexported fields
}

func (*FillString) ApplyTo

func (a *FillString) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*FillString) Call

func (a *FillString) Call() string

Call returns the pseudo method call that generated the action.

type Pop

Pop corresponds to the vg.Canvas.Pop method.

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

func (*Pop) ApplyTo

func (a *Pop) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*Pop) Call

func (a *Pop) Call() string

Call returns the method call that generated the action.

type Push

Push corresponds to the vg.Canvas.Push method.

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

func (*Push) ApplyTo

func (a *Push) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*Push) Call

func (a *Push) Call() string

Call returns the method call that generated the action.

type Rotate

Rotate corresponds to the vg.Canvas.Rotate method.

type Rotate struct {
    Angle float64
    // contains filtered or unexported fields
}

func (*Rotate) ApplyTo

func (a *Rotate) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*Rotate) Call

func (a *Rotate) Call() string

Call returns the method call that generated the action.

type Scale

Scale corresponds to the vg.Canvas.Scale method.

type Scale struct {
    X, Y float64
    // contains filtered or unexported fields
}

func (*Scale) ApplyTo

func (a *Scale) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*Scale) Call

func (a *Scale) Call() string

Call returns the method call that generated the action.

type SetColor

SetColor corresponds to the vg.Canvas.SetColor method.

type SetColor struct {
    Color color.Color
    // contains filtered or unexported fields
}

func (*SetColor) ApplyTo

func (a *SetColor) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*SetColor) Call

func (a *SetColor) Call() string

Call returns the method call that generated the action.

type SetLineDash

SetLineDash corresponds to the vg.Canvas.SetLineDash method.

type SetLineDash struct {
    Dashes  []vg.Length
    Offsets vg.Length
    // contains filtered or unexported fields
}

func (*SetLineDash) ApplyTo

func (a *SetLineDash) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*SetLineDash) Call

func (a *SetLineDash) Call() string

Call returns the method call that generated the action.

type SetLineWidth

SetLineWidth corresponds to the vg.Canvas.SetWidth method.

type SetLineWidth struct {
    Width vg.Length
    // contains filtered or unexported fields
}

func (*SetLineWidth) ApplyTo

func (a *SetLineWidth) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*SetLineWidth) Call

func (a *SetLineWidth) Call() string

Call returns the method call that generated the action.

type Stroke

Stroke corresponds to the vg.Canvas.Stroke method.

type Stroke struct {
    Path vg.Path
    // contains filtered or unexported fields
}

func (*Stroke) ApplyTo

func (a *Stroke) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*Stroke) Call

func (a *Stroke) Call() string

Call returns the method call that generated the action.

type Translate

Translate corresponds to the vg.Canvas.Translate method.

type Translate struct {
    Point vg.Point
    // contains filtered or unexported fields
}

func (*Translate) ApplyTo

func (a *Translate) ApplyTo(c vg.Canvas)

ApplyTo applies the action to the given vg.Canvas.

func (*Translate) Call

func (a *Translate) Call() string

Call returns the method call that generated the action.