raster

package
v0.0.0-...-94baa75 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2014 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Overview

Package raster is experimental vector drawing for the sprite package.

WARNING: likely to change. This is an experiment in APIs. Implemented using freetype/raster for now.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Draw

func Draw(dst *image.RGBA, src image.Image, path Path)

Draw is a portable implementation of vector rasterization.

Types

type Cache

type Cache struct {
	M     *image.RGBA // TODO: *image.Alpha??
	Dirty bool
	// contains filtered or unexported fields
}

func (*Cache) Get

func (c *Cache) Get(id sprite.Curve, p Path, t clock.Time) (image.Rectangle, error)

type Capper

type Capper interface {
	Cap(p *Path, halfWidth geom.Pt, pivot, n1 geom.Point)
}

type Circle

type Circle struct {
	//Center geom.Point
	Radius geom.Pt
}

func (*Circle) Contains

func (c *Circle) Contains(p geom.Point) bool

func (*Circle) Path

func (c *Circle) Path() (p Path)

type Drawable

type Drawable struct {
	Shape Shape
	Color color.Color // TODO mask? so many possibilities
}

type Joiner

type Joiner interface {
	Join(left, right *Path, halfWidth geom.Pt, pivot, n0, n1 geom.Point)
}

type Path

type Path []geom.Pt

A Path is a sequence of curves.

func (*Path) AddCubic

func (p *Path) AddCubic(b, c, d geom.Point)

AddCubic adds a cubic segment to the current curve.

func (*Path) AddLine

func (p *Path) AddLine(b geom.Point)

AddLine adds a linear segment to the current curve.

func (*Path) AddQuadratic

func (p *Path) AddQuadratic(b, c geom.Point)

AddQuadratic adds a quadratic segment to the current curve.

func (*Path) AddStart

func (p *Path) AddStart(a geom.Point)

AddStart starts a new curve at the given point.

func (Path) Bounds

func (p Path) Bounds() geom.Rectangle

func (*Path) Path

func (p *Path) Path() Path

type Rectangle

type Rectangle geom.Rectangle

TODO: rounded corners (i.e. css border-radius)?

func (*Rectangle) Path

func (r *Rectangle) Path() (p Path)

type Shape

type Shape interface {
	Path() Path
}

type Stroke

type Stroke struct {
	Shape Shape
	Width geom.Pt
	Cap   Capper
	Join  Joiner
}

func (*Stroke) Path

func (s *Stroke) Path() Path

Jump to

Keyboard shortcuts

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