canvas

package
v0.0.0-...-42ea651 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PointOutOfBound = Error("point out of bound")
	ObjectTooLarge  = Error("object too large")
	BadPattern      = Error("the drawing pattern is invalid")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Canvas

type Canvas struct {
	Name   string `json:"name,omitempty"`
	Width  uint   `json:"width"`
	Height uint   `json:"height"`
	Data   []byte `json:"data,omitempty"`
}

func (*Canvas) DrawRect

func (c *Canvas) DrawRect(rect *Rectangle, fill string, outline string) error

func (*Canvas) FloodFill

func (c *Canvas) FloodFill(origin *Point, fill string) error

func (*Canvas) MarshalBinary

func (c *Canvas) MarshalBinary() (data []byte, err error)

func (*Canvas) Split

func (c *Canvas) Split() []string

Split returns the content of the canvas split into lines.

type Error

type Error string

func (Error) Error

func (s Error) Error() string

type Point

type Point struct {
	X uint `json:"x"`
	Y uint `json:"y"`
}

func (*Point) MarshalBinary

func (c *Point) MarshalBinary() (data []byte, err error)

type Rectangle

type Rectangle struct {
	Origin Point `json:"origin"`
	Width  uint  `json:"width"`
	Height uint  `json:"height"`
}

func (*Rectangle) MarshalBinary

func (c *Rectangle) MarshalBinary() (data []byte, err error)

Jump to

Keyboard shortcuts

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