rendering

package
v0.0.0-...-8df2434 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const BankPrinterFontName = "F25_Bank_Printer.ttf"

Variables

View Source
var (
	ErrorFont font.Face
)

Functions

func ImageFromURL

func ImageFromURL(url string) (image.Image, error)

ImageFromURL will create an image.Image from a URL

func LoadFont

func LoadFont(points float64) (font.Face, error)

func LoadFonts

func LoadFonts(fonts fs.FS) error

func RenderText

func RenderText(text string) image.Image

RenderText will render the given string to a 64x64 image.Image

Types

type Agent

type Agent interface {
	// GetName will return the ID for the
	GetName() ID
	// GetConfig will return the current configuration of the Agent
	GetConfig() Config
	// SetConfig will set the configuration of the agent
	SetConfig(Config) error
	// GetAdditionalConfig will return a list of additional ConfigAttributes to display on the
	// config page
	GetAdditionalConfig() []ConfigAttribute
	// NextFrame will return the next image.Image to render to the display
	NextFrame() image.Image
	// GetTick will return the duration to sleep for between drawings
	GetTick() time.Duration
	// RegisterEndpoints will register agent specific endpoints to the HTTP Server
	RegisterEndpoints(r *gin.Engine)
}

Agent represents a service that will draw to the matrix

func NewSpotifyAgent

func NewSpotifyAgent(clientID, clientSecret, serverURL string) Agent

func NewTickerAgent

func NewTickerAgent() Agent

type Config

type Config map[string]string

Config is a configuration for an Agent, which is a mapping of config keys to values

type ConfigAttribute

type ConfigAttribute interface {
	// GetHTML will return the html to be displayed
	GetHTML() string
}

ConfigAttribute is an additional HTML attribute to display on the config page

type ID

type ID = string

ID is an identifier used for labeling agents

const TickerAgentID ID = "StockTicker"
type Link struct {
	// Name is the text to display as the link
	Name string
	// Href is the location of the link
	Href string
}

Link is an HTML Link

func (Link) GetHTML

func (b Link) GetHTML() string

type MTATimes

type MTATimes struct {
}

type Spotify

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

func (*Spotify) GetAdditionalConfig

func (s *Spotify) GetAdditionalConfig() []ConfigAttribute

func (*Spotify) GetConfig

func (s *Spotify) GetConfig() Config

func (*Spotify) GetName

func (s *Spotify) GetName() ID

func (*Spotify) GetTick

func (s *Spotify) GetTick() time.Duration

func (*Spotify) NextFrame

func (s *Spotify) NextFrame() (img image.Image)

func (*Spotify) RegisterEndpoints

func (s *Spotify) RegisterEndpoints(r *gin.Engine)

func (*Spotify) SetConfig

func (s *Spotify) SetConfig(config Config) error

type Text

type Text struct {
	// Content is the content of the text blob
	Content string
}

Text represents plain text to be displayed

func (Text) GetHTML

func (t Text) GetHTML() string

type Ticker

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

func (*Ticker) GetAdditionalConfig

func (t *Ticker) GetAdditionalConfig() (attrs []ConfigAttribute)

func (*Ticker) GetConfig

func (t *Ticker) GetConfig() Config

func (*Ticker) GetName

func (t *Ticker) GetName() ID

func (*Ticker) GetTick

func (t *Ticker) GetTick() time.Duration

func (*Ticker) NextFrame

func (t *Ticker) NextFrame() image.Image

func (*Ticker) RegisterEndpoints

func (t *Ticker) RegisterEndpoints(_ *gin.Engine)

func (*Ticker) SetConfig

func (t *Ticker) SetConfig(config Config) error

Jump to

Keyboard shortcuts

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