image: golang.org/x/image/vector Index | Files

package vector

import "golang.org/x/image/vector"

Package vector provides a rasterizer for 2-D vector graphics.

Index

Package Files

acc_amd64.go raster_fixed.go raster_floating.go vector.go

type Rasterizer Uses

type Rasterizer struct {

    // DrawOp is the operator used for the Draw method.
    //
    // The zero value is draw.Over.
    DrawOp draw.Op
    // contains filtered or unexported fields
}

Raster is a 2-D vector graphics rasterizer.

The zero value is usable, in that it is a Rasterizer whose rendered mask image has zero width and zero height. Call Reset to change its bounds.

func NewRasterizer Uses

func NewRasterizer(w, h int) *Rasterizer

NewRasterizer returns a new Rasterizer whose rendered mask image is bounded by the given width and height.

func (*Rasterizer) Bounds Uses

func (z *Rasterizer) Bounds() image.Rectangle

Bounds returns the rectangle from (0, 0) to the width and height passed to NewRasterizer or Reset.

func (*Rasterizer) ClosePath Uses

func (z *Rasterizer) ClosePath()

ClosePath closes the current path.

func (*Rasterizer) CubeTo Uses

func (z *Rasterizer) CubeTo(bx, by, cx, cy, dx, dy float32)

CubeTo adds a cubic Bézier segment, from the pen via (bx, by) and (cx, cy) to (dx, dy), and moves the pen to (dx, dy).

The coordinates are allowed to be out of the Rasterizer's bounds.

func (*Rasterizer) Draw Uses

func (z *Rasterizer) Draw(dst draw.Image, r image.Rectangle, src image.Image, sp image.Point)

Draw implements the Drawer interface from the standard library's image/draw package.

The vector paths previously added via the XxxTo calls become the mask for drawing src onto dst.

func (*Rasterizer) LineTo Uses

func (z *Rasterizer) LineTo(bx, by float32)

LineTo adds a line segment, from the pen to (bx, by), and moves the pen to (bx, by).

The coordinates are allowed to be out of the Rasterizer's bounds.

func (*Rasterizer) MoveTo Uses

func (z *Rasterizer) MoveTo(ax, ay float32)

MoveTo starts a new path and moves the pen to (ax, ay).

The coordinates are allowed to be out of the Rasterizer's bounds.

func (*Rasterizer) Pen Uses

func (z *Rasterizer) Pen() (x, y float32)

Pen returns the location of the path-drawing pen: the last argument to the most recent XxxTo call.

func (*Rasterizer) QuadTo Uses

func (z *Rasterizer) QuadTo(bx, by, cx, cy float32)

QuadTo adds a quadratic Bézier segment, from the pen via (bx, by) to (cx, cy), and moves the pen to (cx, cy).

The coordinates are allowed to be out of the Rasterizer's bounds.

func (*Rasterizer) Reset Uses

func (z *Rasterizer) Reset(w, h int)

Reset resets a Rasterizer as if it was just returned by NewRasterizer.

This includes setting z.DrawOp to draw.Over.

func (*Rasterizer) Size Uses

func (z *Rasterizer) Size() image.Point

Size returns the width and height passed to NewRasterizer or Reset.

Package vector imports 4 packages (graph) and is imported by 3 packages. Updated 2017-10-13. Refresh now. Tools for package owners.