canvas

package
v0.0.0-...-afa3bba Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: Unlicense Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeColor

func MakeColor(r, g, b uint8) color.Color

Create a new color

Types

type Canvas

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

func CreateNewCanvas

func CreateNewCanvas(w, h int) Canvas

Create a new canvas

func (*Canvas) ArcTo

func (c *Canvas) ArcTo(x, y, radiusX, radiusY, degStart, degEnd float64)

Draw an arc from the current point to (x, y) Can be used to easily draw a circle or an ellipse

func (*Canvas) Circle

func (c *Canvas) Circle(cx, cy, r float64)

Draws an empty circle Fill the given circle with the fill color Stroke() each time to avoid connected circles

func (*Canvas) Clear

func (c *Canvas) Clear()

Fill the whole canvas with the fill color

func (*Canvas) ClearRect

func (c *Canvas) ClearRect(x1, y1, x2, y2 int)

Fill the given rectangle with the fill color

func (*Canvas) Ellipse

func (c *Canvas) Ellipse(cx, cy, rx, ry float64)

Draws an empty ellipse Fill the given ellipse with the fill color Stroke() each time to avoid connected ellipses

func (*Canvas) Fill

func (c *Canvas) Fill()

Fill the area inside the lines you've set up with LineTo, but don't draw the lines

func (*Canvas) FillStroke

func (c *Canvas) FillStroke()

Fill the area inside the lines you've set up with LineTo

func (*Canvas) GetImage

func (c *Canvas) GetImage() image.Image

func (*Canvas) Height

func (c *Canvas) Height() int

Return the height of the canvas

func (*Canvas) LineTo

func (c *Canvas) LineTo(x, y float64)

Draw a line from the current point to (x,y), and set the current point to (x,y)

func (*Canvas) MoveTo

func (c *Canvas) MoveTo(x, y float64)

Move the current point to (x,y)

func (*Canvas) SaveToPNG

func (c *Canvas) SaveToPNG(filename string)

Save the current canvas to a PNG file

func (*Canvas) SaveToPNG2

func (c *Canvas) SaveToPNG2(filename string)

func (*Canvas) SetFillColor

func (c *Canvas) SetFillColor(col color.Color)

Set the fill color

func (*Canvas) SetLineWidth

func (c *Canvas) SetLineWidth(w float64)

Set the line width

func (*Canvas) SetStrokeColor

func (c *Canvas) SetStrokeColor(col color.Color)

Set the line color

func (*Canvas) Stroke

func (c *Canvas) Stroke()

Actually draw the lines you've set up with LineTo

func (*Canvas) Width

func (c *Canvas) Width() int

Return the width of the canvas

Jump to

Keyboard shortcuts

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