drawing

package
v0.0.0-...-5a4f024 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2015 License: MIT Imports: 3 Imported by: 4

Documentation

Overview

Package drawing abstracts away some of the draw2d complexities by being opinionated on how to do some tasks (like saving only png)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawLine

func DrawLine(xo, yo, xe, ye float32, path *CanvasContext)

DrawLine from (xo, yo) to (xe, ye)

func DrawPoint

func DrawPoint(x, y float32, path *CanvasContext)

Drawpoint will draw a point into the canvas

func DrawSquare

func DrawSquare(xo, yo, xe, ye float32, path *CanvasContext)

DrawSquare will get a canvascontext and draw an empty square

Types

type Canvas

type Canvas struct {
	image.RGBA
	// contains filtered or unexported fields
}

func NewCanvas

func NewCanvas(size int, fileName string) *Canvas

NewCanvas initialize the canvas

func (*Canvas) GetContext

func (c *Canvas) GetContext() *CanvasContext

Get a new Graphic Context where to draw

func (*Canvas) Save

func (c *Canvas) Save()

Save the contexts into a final image

type CanvasContext

type CanvasContext struct {
	draw2dimg.GraphicContext
	// contains filtered or unexported fields
}

func (CanvasContext) ToScale

func (cnv CanvasContext) ToScale(x float32) float64

ToScale transforms the [0.0, 1.0) space into [0, canvas.size)

type Drawable

type Drawable interface {
	Draw(canvas *Canvas)
}

Jump to

Keyboard shortcuts

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