canvas

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RoundedRect added in v0.4.1

func RoundedRect(dc *gg.Context, x, y, w, h, tl, tr, br, bl float64)

Types

type Canvas

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

Canvas defines a drawing context.

func NewCanvas

func NewCanvas(width, height int) *Canvas

NewCanvas creates a drawing context.

func (*Canvas) FontSize

func (scr *Canvas) FontSize() float64

FontSize returns font's size.

func (*Canvas) Graphics

func (scr *Canvas) Graphics() *gg.Context

Graphics returns the canvas graphic context.

func (*Canvas) LineWidth added in v0.4.1

func (scr *Canvas) LineWidth() float64

LineWidth returns the current line width

func (*Canvas) Reset

func (scr *Canvas) Reset(width, height int)

Reset resets screen using the specified options.

func (*Canvas) SavePNG

func (scr *Canvas) SavePNG(path string) error

SavePNG saves the picture as PNG to the specified filename.

func (*Canvas) SetFontSize

func (scr *Canvas) SetFontSize(size float64)

SetFontSize sets the font's size.

func (*Canvas) SetLineWidth added in v0.4.1

func (scr *Canvas) SetLineWidth(size float64)

SetLineWidth sets the lineWidth.

func (*Canvas) SetWorldCoordinates

func (scr *Canvas) SetWorldCoordinates(xMin, xMax float64, yMin, yMax float64) error

SetWorldCoordinates sets up user-defined coordinate system.

xMin: x-coordinate of lower left corner of canvas. xMax: x-coordinate of upper right corner of canvas. yMin: y-coordinate of lower left corner of canvas. yMax: y-coordinate of upper right corner of canvas.

func (*Canvas) Size

func (scr *Canvas) Size() (int, int)

Size returns the canvas size.

Jump to

Keyboard shortcuts

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