shapes

package
v0.0.0-...-4939c6e Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawShapes

func DrawShapes(img draw.Image, x, y int, drawers ...Drawer) error

func FilledImage

func FilledImage(width, height int, fill color.Color) draw.Image

func SaveImage

func SaveImage(img image.Image, filename string) error

Types

type Circle

type Circle struct {
	color.Color
	Radius int
}

func (Circle) Draw

func (circle Circle) Draw(img draw.Image, x, y int) error

func (Circle) String

func (circle Circle) String() string

type Drawer

type Drawer interface {
	Draw(img draw.Image, x, y int) error
}

func New

func New(shape string, option Option) (Drawer, error)

type Option

type Option struct {
	Fill   color.Color
	Radius int
	Rect   image.Rectangle
	Filled bool
}

type Rectangle

type Rectangle struct {
	color.Color
	image.Rectangle
	Filled bool
}

func (Rectangle) Draw

func (rectangle Rectangle) Draw(img draw.Image, x, y int) error

x, y are the top-left (for radius-based shapes they are the middle)

type RegularPolygon

type RegularPolygon struct {
	color.Color
	Radius int
	Sides  int
}

func (RegularPolygon) Draw

func (polygon RegularPolygon) Draw(img draw.Image, x, y int) error

func (RegularPolygon) String

func (polygon RegularPolygon) String() string

Jump to

Keyboard shortcuts

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