board

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlankCanvas

type BlankCanvas struct {
	sync.Mutex
	// contains filtered or unexported fields
}

BlankCanvas is a board.Canvas type that does not render

func NewBlankCanvas

func NewBlankCanvas(width int, height int, logger *zap.Logger) *BlankCanvas

NewBlankCanvas ...

func (*BlankCanvas) AlwaysRender

func (i *BlankCanvas) AlwaysRender() bool

AlwaysRender ...

func (*BlankCanvas) At

func (i *BlankCanvas) At(x, y int) color.Color

At returns the color of the pixel at (x, y)

func (*BlankCanvas) Bounds

func (i *BlankCanvas) Bounds() image.Rectangle

Bounds return the topology of the Canvas

func (*BlankCanvas) Clear

func (i *BlankCanvas) Clear() error

Clear sets the canvas to all black

func (*BlankCanvas) Close

func (i *BlankCanvas) Close() error

Close ...

func (*BlankCanvas) ColorModel

func (i *BlankCanvas) ColorModel() color.Model

ColorModel returns the canvas' color model, always color.RGBAModel

func (*BlankCanvas) Disable

func (i *BlankCanvas) Disable() bool

Disable ...

func (*BlankCanvas) Enable

func (i *BlankCanvas) Enable() bool

Enable ...

func (*BlankCanvas) Enabled

func (i *BlankCanvas) Enabled() bool

Enabled ...

func (*BlankCanvas) GetHTTPHandlers

func (i *BlankCanvas) GetHTTPHandlers() ([]*HTTPHandler, error)

GetHTTPHandlers ...

func (*BlankCanvas) GetWidth

func (i *BlankCanvas) GetWidth() int

GetWidth ...

func (*BlankCanvas) Name

func (i *BlankCanvas) Name() string

Name ...

func (*BlankCanvas) Render

func (i *BlankCanvas) Render(ctx context.Context) error

Render stores the state of the image as a PNG

func (*BlankCanvas) Scrollable

func (i *BlankCanvas) Scrollable() bool

Scrollable ...

func (*BlankCanvas) Set

func (i *BlankCanvas) Set(x, y int, clr color.Color)

Set set LED at position x,y to the provided 24-bit color value

func (*BlankCanvas) SetStateChangeCallback

func (i *BlankCanvas) SetStateChangeCallback(s func())

func (*BlankCanvas) SetWidth

func (i *BlankCanvas) SetWidth(x int)

SetWidth ...

func (*BlankCanvas) Store

func (i *BlankCanvas) Store(s bool) bool

type Board

type Board interface {
	Name() string
	Render(ctx context.Context, canvases Canvas) error
	GetHTTPHandlers() ([]*HTTPHandler, error)
	GetRPCHandler() (string, http.Handler)
	InBetween() bool
	Enabler() Enabler
}

Board is the interface to implement for displaying on the matrix

type Canvas

type Canvas interface {
	image.Image
	draw.Image
	Enabler
	Name() string
	Clear() error
	Render(ctx context.Context) error
	GetHTTPHandlers() ([]*HTTPHandler, error)
	Close() error
	Scrollable() bool
	AlwaysRender() bool
	SetWidth(int)
	GetWidth() int
}

Canvas ...

type Enabler

type Enabler interface {
	Enabled() bool
	Enable() bool
	Disable() bool
	Store(bool) bool
	SetStateChangeCallback(func())
}

Enabler is an interface for basic Enable/Disable functions

type HTTPHandler

type HTTPHandler struct {
	Handler func(http.ResponseWriter, *http.Request)
	Path    string
}

HTTPHandler is the type returned to the sportsmatrix for HTTP endpoints

type StateChangeNotifier

type StateChangeNotifier func()

StateChangeNotifier is a func that an Enabler uses to notify when its enabled/disabled state changes

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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