Documentation
¶
Index ¶
- Constants
- func DrawProgressBar(img image.Image, label string, x, y, h, w, progress float64) (image.Image, error)
- func DrawProgressBarWithAccent(img image.Image, label string, x, y, h, w, progress float64, hex string) (image.Image, error)
- func DrawText(img image.Image, text string, options DrawTextOptions) (image.Image, error)
- func FindXDoToolKeybindString(code int) string
- func HexColor(hex string) color.RGBA
- func LayerImages(x, y int, images ...image.Image) (image.Image, error)
- func ParseXDoToolKeybindString(keybind string) ([]int, error)
- func ResizeImage(img image.Image, keySize int) image.Image
- func ResizeImageWH(img image.Image, width int, height int) image.Image
- func SubImage(img image.Image, x0, y0, x1, y1 int) image.Image
- type AvailableModules
- type BackgroundHandler
- type CombinedHandler
- type Config
- type Connection
- func (c *Connection) Close()
- func (c *Connection) CommitConfig() error
- func (c *Connection) GetBackgroundExample(serial string, handler string, fields map[string]any, handlerType HandlerType, ...) ([]image.Image, error)
- func (c *Connection) GetConfig() (*Config, error)
- func (c *Connection) GetInfo() ([]*StreamDeckInfo, error)
- func (c *Connection) GetLayersExample(serial string, layers []*Layer, handlerType HandlerType) (image.Image, error)
- func (c *Connection) GetModules() (*AvailableModules, error)
- func (c *Connection) GetObsFields() ([]*Field, error)
- func (c *Connection) PressButton(serial string, keyIndex int) error
- func (c *Connection) RegisterPageListener(cback func(string, int32)) error
- func (c *Connection) ReloadConfig() error
- func (c *Connection) SendKnobEvent(serial string, knobIndex int, event InputEventType) error
- func (c *Connection) SetConfig(config *Config) error
- func (c *Connection) SetPage(serial string, page int) error
- type Deck
- func (d *Deck) GetKeyGridBackground() string
- func (d *Deck) GetKeyGridBackgroundBuff() []image.Image
- func (d *Deck) GetKeyGridBackgroundHandler() BackgroundHandler
- func (d *Deck) GetKeyGridBackgroundHandlerFields() map[string]any
- func (d *Deck) GetTouchPanelBackground() string
- func (d *Deck) GetTouchPanelBackgroundBuff() []image.Image
- func (d *Deck) GetTouchPanelBackgroundHandler() BackgroundHandler
- func (d *Deck) GetTouchPanelBackgroundHandlerFields() map[string]any
- func (d *Deck) SetKeyGridBackgroundBuff(img []image.Image)
- func (d *Deck) SetKeyGridBackgroundHandler(handler BackgroundHandler)
- func (d *Deck) SetTouchPanelBackgroundBuff(img []image.Image)
- func (d *Deck) SetTouchPanelBackgroundHandler(handler BackgroundHandler)
- type DrawTextOptions
- type Field
- type FieldType
- type ForegroundHandler
- type Handler
- type HandlerType
- type HorizontalAlignment
- type IConn
- type IContext
- type IHost
- type InputEvent
- type InputEventType
- type InputHandler
- type Key
- func (k *Key) GetKeyBackground() string
- func (k *Key) GetKeyBackgroundBuff() image.Image
- func (k *Key) GetKeyBackgroundHandler() BackgroundHandler
- func (k *Key) GetKeyBackgroundHandlerFields() map[string]any
- func (k *Key) GetLayers() []*Layer
- func (k *Key) SetKeyBackgroundBuff(img image.Image)
- func (k *Key) SetKeyBackgroundHandler(handler BackgroundHandler)
- type KeyBackgrounder
- type KeyConfig
- func (kc *KeyConfig) GetKeyBackground() string
- func (kc *KeyConfig) GetKeyBackgroundBuff() image.Image
- func (kc *KeyConfig) GetKeyBackgroundHandler() BackgroundHandler
- func (kc *KeyConfig) GetKeyBackgroundHandlerFields() map[string]any
- func (kc *KeyConfig) GetLayers() []*Layer
- func (kc *KeyConfig) SetKeyBackgroundBuff(img image.Image)
- func (kc *KeyConfig) SetKeyBackgroundHandler(handler BackgroundHandler)
- type KeyGridBackgrounder
- type Knob
- func (k *Knob) GetLayers() []*Layer
- func (k *Knob) GetTouchPanelBackground() string
- func (k *Knob) GetTouchPanelBackgroundBuff() image.Image
- func (k *Knob) GetTouchPanelBackgroundHandler() ForegroundHandler
- func (k *Knob) GetTouchPanelBackgroundHandlerFields() map[string]any
- func (k *Knob) SetTouchPanelBackgroundBuff(img image.Image)
- func (k *Knob) SetTouchPanelBackgroundHandler(handler ForegroundHandler)
- type KnobConfig
- func (kc *KnobConfig) GetLayers() []*Layer
- func (kc *KnobConfig) GetTouchPanelBackground() string
- func (kc *KnobConfig) GetTouchPanelBackgroundBuff() image.Image
- func (kc *KnobConfig) GetTouchPanelBackgroundHandler() ForegroundHandler
- func (kc *KnobConfig) GetTouchPanelBackgroundHandlerFields() map[string]any
- func (kc *KnobConfig) SetTouchPanelBackgroundBuff(img image.Image)
- func (kc *KnobConfig) SetTouchPanelBackgroundHandler(handler ForegroundHandler)
- type Layer
- type Layerable
- type LcdBackgrounder
- type LcdSegmentBackgrounder
- type Module
- type ModuleGroup
- type ObsConnectionInfo
- type Overflow
- type Page
- func (p *Page) GetKeyGridBackground() string
- func (p *Page) GetKeyGridBackgroundBuff() []image.Image
- func (p *Page) GetKeyGridBackgroundHandler() BackgroundHandler
- func (p *Page) GetKeyGridBackgroundHandlerFields() map[string]any
- func (p *Page) GetTouchPanelBackground() string
- func (p *Page) GetTouchPanelBackgroundBuff() []image.Image
- func (p *Page) GetTouchPanelBackgroundHandler() BackgroundHandler
- func (p *Page) GetTouchPanelBackgroundHandlerFields() map[string]any
- func (p *Page) SetKeyGridBackgroundBuff(img []image.Image)
- func (p *Page) SetKeyGridBackgroundHandler(handler BackgroundHandler)
- func (p *Page) SetTouchPanelBackgroundBuff(img []image.Image)
- func (p *Page) SetTouchPanelBackgroundHandler(handler BackgroundHandler)
- type StreamDeckInfo
- type VerticalAlignment
- type VisualHandler
Constants ¶
View Source
const BorderClearance = 10
Variables ¶
This section is empty.
Functions ¶
func DrawProgressBar ¶
Types ¶
type AvailableModules ¶ added in v3.0.1
type AvailableModules struct {
GroupModules []ModuleGroup `json:"group_modules"`
IndividualModules []Module `json:"individual_modules"`
}
type BackgroundHandler ¶
type BackgroundHandler interface {
ForegroundHandler
StartGrid(fields map[string]any, handlerType HandlerType, info StreamDeckInfo, callback func(images []image.Image))
}
type CombinedHandler ¶
type CombinedHandler interface {
ForegroundHandler
InputHandler
}
type Config ¶
type Config struct {
Modules []string `json:"modules,omitempty"`
Decks []Deck `json:"decks"`
ObsConnectionInfo ObsConnectionInfo `json:"obs_connection_info"`
}
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func Connect ¶
func Connect() (*Connection, error)
func (*Connection) Close ¶
func (c *Connection) Close()
func (*Connection) CommitConfig ¶
func (c *Connection) CommitConfig() error
func (*Connection) GetBackgroundExample ¶ added in v3.0.1
func (c *Connection) GetBackgroundExample(serial string, handler string, fields map[string]any, handlerType HandlerType, grid bool) ([]image.Image, error)
func (*Connection) GetConfig ¶
func (c *Connection) GetConfig() (*Config, error)
func (*Connection) GetInfo ¶
func (c *Connection) GetInfo() ([]*StreamDeckInfo, error)
func (*Connection) GetLayersExample ¶
func (c *Connection) GetLayersExample(serial string, layers []*Layer, handlerType HandlerType) (image.Image, error)
func (*Connection) GetModules ¶
func (c *Connection) GetModules() (*AvailableModules, error)
func (*Connection) GetObsFields ¶
func (c *Connection) GetObsFields() ([]*Field, error)
func (*Connection) PressButton ¶
func (c *Connection) PressButton(serial string, keyIndex int) error
func (*Connection) RegisterPageListener ¶
func (c *Connection) RegisterPageListener(cback func(string, int32)) error
func (*Connection) ReloadConfig ¶
func (c *Connection) ReloadConfig() error
func (*Connection) SendKnobEvent ¶ added in v3.0.1
func (c *Connection) SendKnobEvent(serial string, knobIndex int, event InputEventType) error
func (*Connection) SetConfig ¶
func (c *Connection) SetConfig(config *Config) error
type Deck ¶
type Deck struct {
Serial string `json:"serial"`
Pages []Page `json:"pages"`
TouchPanelBackground string `json:"touch_panel_background"`
TouchPanelBackgroundBuff []image.Image `json:"-"`
TouchPanelBackgroundHandler BackgroundHandler `json:"-"`
TouchPanelBackgroundHandlerFields map[string]any `json:"touch_panel_background_handler_fields"`
KeyGridBackground string `json:"key_grid_background"`
KeyGridBackgroundBuff []image.Image `json:"-"`
KeyGridBackgroundHandler BackgroundHandler `json:"-"`
KeyGridBackgroundHandlerFields map[string]any `json:"key_grid_background_handler_fields"`
}
func (*Deck) GetKeyGridBackground ¶
func (*Deck) GetKeyGridBackgroundBuff ¶
func (*Deck) GetKeyGridBackgroundHandler ¶
func (d *Deck) GetKeyGridBackgroundHandler() BackgroundHandler
func (*Deck) GetKeyGridBackgroundHandlerFields ¶
func (*Deck) GetTouchPanelBackground ¶
func (*Deck) GetTouchPanelBackgroundBuff ¶
func (*Deck) GetTouchPanelBackgroundHandler ¶
func (d *Deck) GetTouchPanelBackgroundHandler() BackgroundHandler
func (*Deck) GetTouchPanelBackgroundHandlerFields ¶
func (*Deck) SetKeyGridBackgroundBuff ¶
func (*Deck) SetKeyGridBackgroundHandler ¶
func (d *Deck) SetKeyGridBackgroundHandler(handler BackgroundHandler)
func (*Deck) SetTouchPanelBackgroundBuff ¶
func (*Deck) SetTouchPanelBackgroundHandler ¶
func (d *Deck) SetTouchPanelBackgroundHandler(handler BackgroundHandler)
type DrawTextOptions ¶
type DrawTextOptions struct {
FontSize int64
MaxFontSize, MinFontSize int64
VerticalAlignment VerticalAlignment
HorizontalAlignment HorizontalAlignment
FontFace string
Colour string
Overflow Overflow
// With anchor set, the alignments indicate the position of the text the anchor will be in, e.g BOTTOM & RIGHT will put the anchor in the bottom right of the text, so all text will be up and left of it
Anchor *image.Point
}
type ForegroundHandler ¶
type ForegroundHandler interface {
VisualHandler
Start(fields map[string]any, handlerType HandlerType, info StreamDeckInfo, callback func(image image.Image))
}
type HorizontalAlignment ¶
type HorizontalAlignment string
const ( Left HorizontalAlignment = "LEFT" Middle HorizontalAlignment = "MIDDLE" Right HorizontalAlignment = "RIGHT" )
type IContext ¶
type IContext interface {
SetRGB(r, g, b float64)
SetHexColor(color string)
SetFontFace(font font.Face)
WordWrap(text string, width float64) []string
DrawStringWrapped(s string, x, y, ax, ay, width, lineSpacing float64, align gg.Align)
Image() image.Image
MeasureMultilineString(text string, lineSpacing float64) (float64, float64)
Width() int
Height() int
}
type InputEvent ¶
type InputEvent struct {
EventType InputEventType
RotateNotches uint8
ScreenTapX, ScreenTapY uint16
}
type InputEventType ¶
type InputEventType int8
const ( KNOB_CCW InputEventType = iota KNOB_CW KNOB_PRESS SCREEN_SHORT_TAP SCREEN_LONG_TAP SCREEN_SWIPE KEY_PRESS KEY_RELEASE )
type InputHandler ¶
type InputHandler interface {
Handler
Input(fields map[string]any, handlerType HandlerType, info StreamDeckInfo, event InputEvent, host IHost)
}
type Key ¶
type Key struct {
Application map[string]*KeyConfig `json:"application,omitempty"`
ActiveBuff image.Image `json:"-"`
ActiveApplication string `json:"-"`
KeyBackground string `json:"background"`
KeyBackgroundBuff image.Image `json:"-"`
KeyBackgroundHandler BackgroundHandler `json:"-"`
KeyBackgroundHandlerFields map[string]any `json:"key_background_handler_fields"`
Layers []*Layer `json:"layers"`
}
func (*Key) GetKeyBackground ¶
func (*Key) GetKeyBackgroundBuff ¶
func (*Key) GetKeyBackgroundHandler ¶
func (k *Key) GetKeyBackgroundHandler() BackgroundHandler
func (*Key) GetKeyBackgroundHandlerFields ¶
func (*Key) SetKeyBackgroundBuff ¶
func (*Key) SetKeyBackgroundHandler ¶
func (k *Key) SetKeyBackgroundHandler(handler BackgroundHandler)
type KeyBackgrounder ¶
type KeyBackgrounder interface {
GetKeyBackground() string
GetKeyBackgroundBuff() image.Image
SetKeyBackgroundBuff(img image.Image)
GetKeyBackgroundHandler() BackgroundHandler
SetKeyBackgroundHandler(handler BackgroundHandler)
GetKeyBackgroundHandlerFields() map[string]any
}
type KeyConfig ¶
type KeyConfig struct {
Layers []*Layer `json:"layers"`
KeyBackground string `json:"background"`
KeyBackgroundBuff image.Image `json:"-"`
KeyBackgroundHandler BackgroundHandler `json:"-"`
KeyBackgroundHandlerFields map[string]any `json:"key_background_handler_fields"`
}
func (*KeyConfig) GetKeyBackground ¶
func (*KeyConfig) GetKeyBackgroundBuff ¶
func (*KeyConfig) GetKeyBackgroundHandler ¶
func (kc *KeyConfig) GetKeyBackgroundHandler() BackgroundHandler
func (*KeyConfig) GetKeyBackgroundHandlerFields ¶
func (*KeyConfig) SetKeyBackgroundBuff ¶
func (*KeyConfig) SetKeyBackgroundHandler ¶
func (kc *KeyConfig) SetKeyBackgroundHandler(handler BackgroundHandler)
type KeyGridBackgrounder ¶
type KeyGridBackgrounder interface {
GetKeyGridBackground() string
GetKeyGridBackgroundBuff() []image.Image
SetKeyGridBackgroundBuff(img []image.Image)
GetKeyGridBackgroundHandler() BackgroundHandler
SetKeyGridBackgroundHandler(handler BackgroundHandler)
GetKeyGridBackgroundHandlerFields() map[string]any
}
type Knob ¶
type Knob struct {
Application map[string]*KnobConfig `json:"application,omitempty"`
ActiveBuff image.Image `json:"-"`
ActiveApplication string `json:"-"`
Layers []*Layer `json:"layers"`
TouchPanelBackground string `json:"touch_panel_background"`
TouchPanelBackgroundBuff image.Image `json:"-"`
TouchPanelBackgroundHandler ForegroundHandler `json:"-"`
TouchPanelBackgroundHandlerFields map[string]any `json:"touch_panel_background_handler_fields"`
}
func (*Knob) GetTouchPanelBackground ¶
func (*Knob) GetTouchPanelBackgroundBuff ¶
func (*Knob) GetTouchPanelBackgroundHandler ¶
func (k *Knob) GetTouchPanelBackgroundHandler() ForegroundHandler
func (*Knob) GetTouchPanelBackgroundHandlerFields ¶
func (*Knob) SetTouchPanelBackgroundBuff ¶
func (*Knob) SetTouchPanelBackgroundHandler ¶
func (k *Knob) SetTouchPanelBackgroundHandler(handler ForegroundHandler)
type KnobConfig ¶
type KnobConfig struct {
Layers []*Layer `json:"layers"`
TouchPanelBackground string `json:"touch_panel_background"`
TouchPanelBackgroundBuff image.Image `json:"-"`
TouchPanelBackgroundHandler ForegroundHandler `json:"-"`
TouchPanelBackgroundHandlerFields map[string]any `json:"touch_panel_background_handler_fields"`
}
func (*KnobConfig) GetLayers ¶
func (kc *KnobConfig) GetLayers() []*Layer
func (*KnobConfig) GetTouchPanelBackground ¶
func (kc *KnobConfig) GetTouchPanelBackground() string
func (*KnobConfig) GetTouchPanelBackgroundBuff ¶
func (kc *KnobConfig) GetTouchPanelBackgroundBuff() image.Image
func (*KnobConfig) GetTouchPanelBackgroundHandler ¶
func (kc *KnobConfig) GetTouchPanelBackgroundHandler() ForegroundHandler
func (*KnobConfig) GetTouchPanelBackgroundHandlerFields ¶
func (kc *KnobConfig) GetTouchPanelBackgroundHandlerFields() map[string]any
func (*KnobConfig) SetTouchPanelBackgroundBuff ¶
func (kc *KnobConfig) SetTouchPanelBackgroundBuff(img image.Image)
func (*KnobConfig) SetTouchPanelBackgroundHandler ¶
func (kc *KnobConfig) SetTouchPanelBackgroundHandler(handler ForegroundHandler)
type Layer ¶
type Layer struct {
Handler string `json:"handler,omitempty"`
Fields map[string]any `json:"fields,omitempty"`
Visual bool `json:"visual,omitempty"`
Input bool `json:"input,omitempty"`
InputEvents []InputEventType `json:"input_events"`
Global bool `json:"global,omitempty"`
Label string `json:"label,omitempty"`
HandlerStruct Handler `json:"-"`
Buff image.Image `json:"-"`
}
type LcdBackgrounder ¶
type LcdBackgrounder interface {
GetTouchPanelBackground() string
GetTouchPanelBackgroundBuff() []image.Image
SetTouchPanelBackgroundBuff(img []image.Image)
GetTouchPanelBackgroundHandler() BackgroundHandler
SetTouchPanelBackgroundHandler(handler BackgroundHandler)
GetTouchPanelBackgroundHandlerFields() map[string]any
}
type LcdSegmentBackgrounder ¶
type LcdSegmentBackgrounder interface {
GetTouchPanelBackground() string
GetTouchPanelBackgroundBuff() image.Image
SetTouchPanelBackgroundBuff(img image.Image)
GetTouchPanelBackgroundHandler() ForegroundHandler
SetTouchPanelBackgroundHandler(handler ForegroundHandler)
GetTouchPanelBackgroundHandlerFields() map[string]any
}
type Module ¶
type Module struct {
Name string `json:"name,omitempty"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
NewCombined func() Handler `json:"-"`
NewBackground func() BackgroundHandler `json:"-"`
CombinedFields []Field `json:"combined_fields,omitempty"`
BackgroundFields []Field `json:"lcd_fields,omitempty"`
IsForeground bool `json:"is_foreground,omitempty"`
IsInput bool `json:"is_input,omitempty"`
IsBackground bool `json:"is_background,omitempty"`
}
type ModuleGroup ¶ added in v3.0.1
type ObsConnectionInfo ¶
type Page ¶
type Page struct {
Keys []Key `json:"keys"`
Knobs []Knob `json:"knobs"`
TouchPanelBackground string `json:"touch_panel_background"`
TouchPanelBackgroundBuff []image.Image `json:"-"`
TouchPanelBackgroundHandler BackgroundHandler `json:"-"`
TouchPanelBackgroundHandlerFields map[string]any `json:"touch_panel_background_handler_fields"`
KeyGridBackground string `json:"key_grid_background"`
KeyGridBackgroundBuff []image.Image `json:"-"`
KeyGridBackgroundHandler BackgroundHandler `json:"-"`
KeyGridBackgroundHandlerFields map[string]any `json:"key_grid_background_handler_fields"`
}
func (*Page) GetKeyGridBackground ¶
func (*Page) GetKeyGridBackgroundBuff ¶
func (*Page) GetKeyGridBackgroundHandler ¶
func (p *Page) GetKeyGridBackgroundHandler() BackgroundHandler
func (*Page) GetKeyGridBackgroundHandlerFields ¶
func (*Page) GetTouchPanelBackground ¶
func (*Page) GetTouchPanelBackgroundBuff ¶
func (*Page) GetTouchPanelBackgroundHandler ¶
func (p *Page) GetTouchPanelBackgroundHandler() BackgroundHandler
func (*Page) GetTouchPanelBackgroundHandlerFields ¶
func (*Page) SetKeyGridBackgroundBuff ¶
func (*Page) SetKeyGridBackgroundHandler ¶
func (p *Page) SetKeyGridBackgroundHandler(handler BackgroundHandler)
func (*Page) SetTouchPanelBackgroundBuff ¶
func (*Page) SetTouchPanelBackgroundHandler ¶
func (p *Page) SetTouchPanelBackgroundHandler(handler BackgroundHandler)
type StreamDeckInfo ¶
type StreamDeckInfo struct {
Cols int `json:"cols,omitempty"`
Rows int `json:"rows,omitempty"`
IconSize int `json:"icon_size,omitempty"`
Page int `json:"page"`
Serial string `json:"serial,omitempty"`
Name string `json:"name,omitempty"`
Connected bool `json:"connected"`
LastConnected time.Time `json:"last_connected"`
LastDisconnected time.Time `json:"last_disconnected"`
LcdWidth int `json:"lcd_width,omitempty"`
LcdHeight int `json:"lcd_height,omitempty"`
LcdCols int `json:"lcd_cols,omitempty"`
KnobCols int `json:"knob_cols,omitempty"`
PaddingX int `json:"padding_x"`
PaddingY int `json:"padding_y"`
KeyGridBackgroundWidth int `json:"key_grid_background_width"`
KeyGridBackgroundHeight int `json:"key_grid_background_height"`
LcdBackgroundWidth int `json:"lcd_background_width"`
LcdBackgroundHeight int `json:"lcd_background_height"`
}
func (StreamDeckInfo) GetDimensions ¶
func (info StreamDeckInfo) GetDimensions(handlerType HandlerType) (int, int)
func (StreamDeckInfo) GetGridDimensions ¶
func (info StreamDeckInfo) GetGridDimensions(handlerType HandlerType) (int, int)
func (StreamDeckInfo) SplitBackgroundImage ¶
func (info StreamDeckInfo) SplitBackgroundImage(background image.Image, handlerType HandlerType) []image.Image
type VerticalAlignment ¶
type VerticalAlignment string
const ( Top VerticalAlignment = "TOP" Center VerticalAlignment = "CENTER" Bottom VerticalAlignment = "BOTTOM" )
type VisualHandler ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.