pixeldisplay

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewText2Pixeldisplay

func NewText2Pixeldisplay(display Pixeldisplay) *text2pixeldisplay

Types

type BrightnessArgs

type BrightnessArgs struct {
	Brightness int
}

type ColorArgs

type ColorArgs struct {
	Color string
}

type EffectArgs

type EffectArgs struct {
	Fx int
}

EffectArgs is a struct to hold the effect to set

type ImageArgs

type ImageArgs struct {
	Icon *string
}

type OpConfig

type OpConfig struct {
	Enabled           bool                    `json:"enabled"`
	WLEDMatrixDisplay WLEDMatrixDisplayConfig `json:"wledMatrixDisplay"`
}

OpConfig contains all parameters to initialize the available displays

type OpPixelDisplay

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

OpPixelDisplay implements base.FreepsOperatorWithShutdown, wraps all functions of the Pixeldisplay interface and calls them on the default display

func (*OpPixelDisplay) DrawImage

func (op *OpPixelDisplay) DrawImage(ctx *base.Context, input *base.OperatorIO, args ImageArgs) *base.OperatorIO

func (*OpPixelDisplay) DrawText

func (op *OpPixelDisplay) DrawText(ctx *base.Context, input *base.OperatorIO, args TextArgs) *base.OperatorIO

func (*OpPixelDisplay) GetBackgroundColor

func (op *OpPixelDisplay) GetBackgroundColor(ctx *base.Context, input *base.OperatorIO) *base.OperatorIO

func (*OpPixelDisplay) GetBrightness

func (op *OpPixelDisplay) GetBrightness(ctx *base.Context, input *base.OperatorIO) *base.OperatorIO

func (*OpPixelDisplay) GetColor

func (op *OpPixelDisplay) GetColor(ctx *base.Context, input *base.OperatorIO) *base.OperatorIO

func (*OpPixelDisplay) GetDefaultConfig

func (op *OpPixelDisplay) GetDefaultConfig() interface{}

func (*OpPixelDisplay) GetDimensions

func (op *OpPixelDisplay) GetDimensions(ctx *base.Context, input *base.OperatorIO) *base.OperatorIO

func (*OpPixelDisplay) GetMaxPictureSize

func (op *OpPixelDisplay) GetMaxPictureSize(ctx *base.Context, input *base.OperatorIO) *base.OperatorIO

func (*OpPixelDisplay) InitCopyOfOperator

func (op *OpPixelDisplay) InitCopyOfOperator(ctx *base.Context, config interface{}, name string) (base.FreepsOperatorWithConfig, error)

func (*OpPixelDisplay) IsOn

func (op *OpPixelDisplay) IsOn(ctx *base.Context, input *base.OperatorIO) *base.OperatorIO

func (*OpPixelDisplay) SetBackgroundColor

func (op *OpPixelDisplay) SetBackgroundColor(ctx *base.Context, input *base.OperatorIO, args ColorArgs) *base.OperatorIO

func (*OpPixelDisplay) SetBrightness

func (op *OpPixelDisplay) SetBrightness(ctx *base.Context, input *base.OperatorIO, args BrightnessArgs) *base.OperatorIO

func (*OpPixelDisplay) SetColor

func (op *OpPixelDisplay) SetColor(ctx *base.Context, input *base.OperatorIO, args ColorArgs) *base.OperatorIO

func (*OpPixelDisplay) SetEffect

func (op *OpPixelDisplay) SetEffect(ctx *base.Context, input *base.OperatorIO, args EffectArgs) *base.OperatorIO

SetEffect sets the effect

func (*OpPixelDisplay) Shutdown

func (op *OpPixelDisplay) Shutdown(ctx *base.Context)

Shutdown shuts down the display

func (*OpPixelDisplay) StartListening

func (op *OpPixelDisplay) StartListening(ctx *base.Context)

StartListening is a noop

func (*OpPixelDisplay) TurnOff

func (op *OpPixelDisplay) TurnOff(ctx *base.Context, input *base.OperatorIO) *base.OperatorIO

func (*OpPixelDisplay) TurnOn

func (op *OpPixelDisplay) TurnOn(ctx *base.Context, input *base.OperatorIO) *base.OperatorIO

type Pixeldisplay

type Pixeldisplay interface {
	// TurnOn turns the display on
	TurnOn() *base.OperatorIO
	// TurnOff turns the display off
	TurnOff() *base.OperatorIO

	// SetColor sets the color of active pixels on the display
	SetColor(color color.Color) *base.OperatorIO
	// SetBackground sets the color of inactive pixels on the display
	SetBackgroundColor(color color.Color) *base.OperatorIO
	// SetBrightness sets the brightness of the display
	SetBrightness(brightness int) *base.OperatorIO
	// SetEffect sets a pre-defined effect on the display
	SetEffect(fx int) *base.OperatorIO

	// SetPicture sets the picture of the display
	DrawImage(image image.Image, returnPNG bool) *base.OperatorIO
	// DrawPixel sets a pixel of the display
	DrawPixel(x, y int, color color.Color) *base.OperatorIO

	// GetMaxPictureSize returns the maximum size of a picture that can be displayed
	GetMaxPictureSize() image.Point
	// GetDimensions returns the dimensions of the display
	GetDimensions() image.Point
	// GetColor returns the color set for active pixels on the display
	GetColor() color.Color
	// GetBackground returns the color set for inactive pixels on the display
	GetBackgroundColor() color.Color
	// GetBrightness returns the brightness of the display
	GetBrightness() int

	// GetImage returns the current image of the display
	GetImage() *image.RGBA
	// IsOn returns true if the display is on
	IsOn() bool

	Shutdown()
}

Pixeldisplay is the interface for the pixel display, it provides functions to turn the display on and off, and to set the color, set a string of text, and set a RGB image.

type TextArgs

type TextArgs struct {
	Text *string
}

type WLEDMatrixDisplay

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

func NewWLEDMatrixDisplay

func NewWLEDMatrixDisplay(cfg WLEDMatrixDisplayConfig) (*WLEDMatrixDisplay, error)

NewWLEDMatrixDisplay creates a connection to a WLED instance with multiple segments

func (*WLEDMatrixDisplay) DrawImage

func (d *WLEDMatrixDisplay) DrawImage(img image.Image, returnPNG bool) *base.OperatorIO

func (*WLEDMatrixDisplay) DrawPixel

func (d *WLEDMatrixDisplay) DrawPixel(x, y int, color color.Color) *base.OperatorIO

func (*WLEDMatrixDisplay) GetBackgroundColor

func (d *WLEDMatrixDisplay) GetBackgroundColor() color.Color

func (*WLEDMatrixDisplay) GetBrightness

func (d *WLEDMatrixDisplay) GetBrightness() int

func (*WLEDMatrixDisplay) GetColor

func (d *WLEDMatrixDisplay) GetColor() color.Color

func (*WLEDMatrixDisplay) GetDimensions

func (d *WLEDMatrixDisplay) GetDimensions() image.Point

func (*WLEDMatrixDisplay) GetImage

func (d *WLEDMatrixDisplay) GetImage() *image.RGBA

func (*WLEDMatrixDisplay) GetMaxPictureSize

func (d *WLEDMatrixDisplay) GetMaxPictureSize() image.Point

func (*WLEDMatrixDisplay) IsOn

func (d *WLEDMatrixDisplay) IsOn() bool

func (*WLEDMatrixDisplay) SetBackgroundColor

func (d *WLEDMatrixDisplay) SetBackgroundColor(color color.Color) *base.OperatorIO

func (*WLEDMatrixDisplay) SetBrightness

func (d *WLEDMatrixDisplay) SetBrightness(brightness int) *base.OperatorIO

func (*WLEDMatrixDisplay) SetColor

func (d *WLEDMatrixDisplay) SetColor(color color.Color) *base.OperatorIO

func (*WLEDMatrixDisplay) SetEffect

func (d *WLEDMatrixDisplay) SetEffect(fx int) *base.OperatorIO

func (*WLEDMatrixDisplay) Shutdown

func (d *WLEDMatrixDisplay) Shutdown()

func (*WLEDMatrixDisplay) TurnOff

func (d *WLEDMatrixDisplay) TurnOff() *base.OperatorIO

func (*WLEDMatrixDisplay) TurnOn

func (d *WLEDMatrixDisplay) TurnOn() *base.OperatorIO

type WLEDMatrixDisplayConfig

type WLEDMatrixDisplayConfig struct {
	Segments              []WLEDSegmentConfig
	Address               string
	MinDisplayDuration    time.Duration
	MaxPictureWidthFactor int
}

type WLEDRequest

type WLEDRequest struct {
	Seg WLEDSegmentReqeust `json:"seg,omitempty"`
}

type WLEDResponse

type WLEDResponse struct {
	Seg        []WLEDSegmentResponse `json:"seg,omitempty"`
	On         bool                  `json:"on"`
	Brightness int                   `json:"bri"`
}

type WLEDSegmentConfig

type WLEDSegmentConfig struct {
	Width   int
	Height  int
	SegID   int
	OffsetX int
	OffsetY int
}

type WLEDSegmentHolder

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

func (*WLEDSegmentHolder) SendToWLEDSegment

func (h *WLEDSegmentHolder) SendToWLEDSegment(address string, dst image.RGBA) *base.OperatorIO

func (*WLEDSegmentHolder) SetImage

func (h *WLEDSegmentHolder) SetImage(dst image.RGBA) ([]byte, error)

type WLEDSegmentReqeust

type WLEDSegmentReqeust struct {
	ID int         `json:"id"`
	I  [][3]uint32 `json:"i,omitempty"`
}

type WLEDSegmentResponse

type WLEDSegmentResponse struct {
	ID    int `json:"id"`
	Start int `json:"start,omitempty"`
	Stop  int `json:"stop,omitempty"`
	Len   int `json:"len,omitempty"`
}

Jump to

Keyboard shortcuts

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