pixeldisplay

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Left   TextAlignment = "left"
	Center               = "center"
	Right                = "right"
)

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 DrawPixelArg added in v1.4.0

type DrawPixelArg struct {
	X         int
	Y         int
	ImageName string
	Color     *string
}

type EffectArgs

type EffectArgs struct {
	Fx int
}

EffectArgs is a struct to hold the effect to set

type ImageNameArgs added in v1.4.0

type ImageNameArgs struct {
	ImageName *string
}

type ImagesWithMetadata added in v1.4.0

type ImagesWithMetadata struct {
	Animation []image.RGBA
	Created   time.Time
	Ctx       *base.Context
}

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 ImageNameArgs) *base.OperatorIO

func (*OpPixelDisplay) DrawPixel added in v1.4.0

func (op *OpPixelDisplay) DrawPixel(ctx *base.Context, input *base.OperatorIO, args DrawPixelArg) *base.OperatorIO

DrawPixel puts a pixel on the image stored under ImageName and displays the Image

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) GetBackgroundLayerNames added in v1.4.0

func (op *OpPixelDisplay) GetBackgroundLayerNames(ctx *base.Context) *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) GetPixelMatrix added in v1.4.0

func (op *OpPixelDisplay) GetPixelMatrix(ctx *base.Context, input *base.OperatorIO, args ImageNameArgs) *base.OperatorIO

GetPixelMatrix returns the string representation of an image (used in the UI)

func (*OpPixelDisplay) HasBackgroundLayer added in v1.4.0

func (op *OpPixelDisplay) HasBackgroundLayer(ctx *base.Context) *base.OperatorIO

func (*OpPixelDisplay) ImageNameSuggestions added in v1.4.0

func (op *OpPixelDisplay) ImageNameSuggestions() []string

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) LayerNameSuggestions added in v1.4.0

func (op *OpPixelDisplay) LayerNameSuggestions() []string

func (*OpPixelDisplay) ResetBackground added in v1.4.0

func (op *OpPixelDisplay) ResetBackground(ctx *base.Context) *base.OperatorIO

func (*OpPixelDisplay) ResetBackgroundLayer added in v1.4.0

func (op *OpPixelDisplay) ResetBackgroundLayer(ctx *base.Context, input *base.OperatorIO, args ResetBackgroundLayerArgs) *base.OperatorIO

func (*OpPixelDisplay) SetBackgroundColor

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

func (*OpPixelDisplay) SetBackgroundLayer added in v1.4.0

func (op *OpPixelDisplay) SetBackgroundLayer(ctx *base.Context, input *base.OperatorIO, args SetBackgroundLayerArgs) *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
	// 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(ctx *base.Context, image image.Image, returnPNG bool) *base.OperatorIO

	// SetBackgroundLayer sets a picture as background on the Display, if image is nil, the layer is deleted
	SetBackgroundLayer(ctx *base.Context, image image.Image, layerName string)
	// ResetBackground deletes all background layers
	ResetBackground(ctx *base.Context)
	// GetBackgroundLayerNames returns the names of active backgrounds
	GetBackgroundLayerNames() []string

	// SetColor sets the color of active pixels on the display
	SetColor(color color.Color)
	// SetBackground sets the color of inactive pixels on the display
	SetBackgroundColor(color color.Color)

	// 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

	// IsOn returns true if the display is on
	IsOn() bool

	Shutdown(ctx *base.Context)
}

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 ResetBackgroundLayerArgs added in v1.4.0

type ResetBackgroundLayerArgs struct {
	LayerName string
}

type SetBackgroundLayerArgs added in v1.4.0

type SetBackgroundLayerArgs struct {
	LayerName *string
	ImageName *string
}

type TextAlignment added in v1.4.0

type TextAlignment string

type TextArgs

type TextArgs struct {
	Text  *string
	Align *TextAlignment
}

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(ctx *base.Context, srcImg image.Image, returnPNG bool) *base.OperatorIO

func (*WLEDMatrixDisplay) GetBackgroundColor

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

func (*WLEDMatrixDisplay) GetBackgroundLayerNames added in v1.4.0

func (d *WLEDMatrixDisplay) GetBackgroundLayerNames() []string

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) GetMaxPictureSize

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

func (*WLEDMatrixDisplay) IsOn

func (d *WLEDMatrixDisplay) IsOn() bool

func (*WLEDMatrixDisplay) ResetBackground added in v1.4.0

func (d *WLEDMatrixDisplay) ResetBackground(ctx *base.Context)

func (*WLEDMatrixDisplay) SetBackgroundColor

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

func (*WLEDMatrixDisplay) SetBackgroundLayer added in v1.4.0

func (d *WLEDMatrixDisplay) SetBackgroundLayer(ctx *base.Context, img image.Image, layerName string)

func (*WLEDMatrixDisplay) SetBrightness

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

func (*WLEDMatrixDisplay) SetColor

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

func (*WLEDMatrixDisplay) SetEffect

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

func (*WLEDMatrixDisplay) Shutdown

func (d *WLEDMatrixDisplay) Shutdown(ctx *base.Context)

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
	ImageQueueSize     int
	MaxAnimationSize   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, backgroundLayers map[string]image.RGBA) *base.OperatorIO

type WLEDSegmentReqeust

type WLEDSegmentReqeust struct {
	ID int      `json:"id"`
	I  []string `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