Documentation
¶
Overview ¶
Package raster contains some convenience functions for creating "golang.org/x/image/vector" paths and rendering them into images.
Index ¶
- func DrawAt(im draw.Image, r *vector.Rasterizer, x, y float64, col color.Color)
- func LineTo(r Scriber, capped bool, oX, oY, nX, nY, width float64)
- func PointAt(r Scriber, x, y, width float64)
- func SquareAt(r Scriber, x, y, width float64)
- type Entry
- type Operator
- type Rasterizer
- type Scriber
- type Segment
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DrawAt ¶
DrawAt places the r into an image aligning (x,y) of r with the (0,0) coordinate of the image.
func LineTo ¶
LineTo renders a line segment from (oX,oY) to (nX,nY) with the specified perpendicular width. The capped value adds rounded end-caps to the line of radius half of the width (as approximated with Bezier curves).
Types ¶
type Rasterizer ¶ added in v0.6.0
type Rasterizer struct { R *vector.Rasterizer Entries []Entry }
Rasterizer is a wrapper for the golang.org/x/image/vector.Rasterizer type which maps float64 arguments to float32 bit calls.
func NewRasterizer ¶ added in v0.6.0
func NewRasterizer(w, h int) *Rasterizer
NewRasterizer allocates a new rasterizer with a fixed size.
func (*Rasterizer) ClosePath ¶ added in v0.6.0
func (r *Rasterizer) ClosePath()
ClosePath forms a loop back line from the pen to the start of the path.
func (*Rasterizer) CubeTo ¶ added in v0.6.0
func (r *Rasterizer) CubeTo(a, b, c, d, e, f float64)
CubeTo constructs a cubic Bezier curve using the supplied parameters, from the pen location to point (e,f), which becomes the updated pen location.
func (*Rasterizer) LineTo ¶ added in v0.6.0
func (r *Rasterizer) LineTo(x, y float64)
LineTo constructs a straight line from the pen to the target (x,y) coordinate, and updates the pen to this location.
func (*Rasterizer) MoveTo ¶ added in v0.6.0
func (r *Rasterizer) MoveTo(x, y float64)
MoveTo sets the rasterizer pen to the coordinate (x,y).
func (*Rasterizer) Render ¶ added in v0.6.1
Render places the entries of r into the im at (x,y) offset.
func (*Rasterizer) Reset ¶ added in v0.6.0
func (r *Rasterizer) Reset(w, h int)
Reset resets the memory of the rasterizer and sets the size of its clipping rectangle.