vgop

package
v0.34.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package vgop provides tools to record a set of vector graphics operations.

Index

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

This section is empty.

Types

type Canvas

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

Canvas implements vg.Canvas for serialization.

func New

func New(opts ...Option) *Canvas

New returns a new canvas.

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 replays the set of vector graphics operations 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) Size

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

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 JSON

type JSON struct {
	*Canvas
}

JSON implements JSON serialization for vg.Canvas.

func NewJSON

func NewJSON(opts ...Option) *JSON

NewJSON creates a new vg.Canvas for JSON serialization.

func (*JSON) MarshalJSON

func (c *JSON) MarshalJSON() ([]byte, error)

func (*JSON) UnmarshalJSON

func (c *JSON) UnmarshalJSON(p []byte) error

func (*JSON) WriteTo

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

type Option

type Option func(c *Canvas)

func WithSize

func WithSize(w, h vg.Length) Option

Jump to

Keyboard shortcuts

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