Documentation
¶
Index ¶
- Constants
- Variables
- func AnimationLinear(t float64) float64
- func ApplyAlpha(c colors.LedColor) colors.LedColor
- func Decode(r io.Reader) (image.Image, error)
- func DecodeConfig(r io.Reader) (image.Config, error)
- func InitGradientPalettes(fileName string)
- func InitUniformPalettes()
- func LoadImage(fileName string) draw.Image
- func ScaleFixedFont(face *basicfont.Face, factor int, newName string)
- type Align
- type AlignEmbed
- type AngleEmbed
- type AnimColors
- type AnimNumbers
- type AnimPoints
- type AnimValue
- type AnimValueFunc
- func Const[T AnimValue](v T) AnimValueFunc[T]
- func RandAlpha(a, b uint8) AnimValueFunc[uint8]
- func RandColor(new bool) AnimValueFunc[colors.LedColor]
- func RandFloat(a, b float64) AnimValueFunc[float64]
- func RandGroupColor(group colors.ColorGroup, new bool) AnimValueFunc[colors.LedColor]
- func RandPoint(r geom.Rectangle) AnimValueFunc[geom.Point]
- func RandPointTrunc(r geom.Rectangle, t float64) AnimValueFunc[geom.Point]
- func RandSize(s1, s2 geom.Point) AnimValueFunc[geom.Point]
- type Animation
- type AnimationController
- func (a *AnimationController) Add(anims ...Animation)
- func (a *AnimationController) Continue()
- func (a *AnimationController) Del(anim Animation)
- func (a *AnimationController) DelAt(idx int)
- func (a *AnimationController) IsRunning() bool
- func (a *AnimationController) Now() time.Time
- func (a *AnimationController) Purge()
- func (a *AnimationController) Stopwatch() *Stopwatch
- func (a *AnimationController) Suspend()
- type AnimationCurve
- type BLM
- type BlinkenFile
- type BlinkenFrame
- type BlinkenHeader
- type ByteCount
- type Canvas
- func (c *Canvas) Add(objs ...CanvasObject)
- func (c *Canvas) At(x, y int) color.Color
- func (c *Canvas) Bounds() image.Rectangle
- func (c *Canvas) Clear(col colors.LedColor)
- func (c *Canvas) Close()
- func (c *Canvas) ColorModel() color.Model
- func (c *Canvas) Del(obj CanvasObject)
- func (c *Canvas) Purge()
- func (c *Canvas) Refresh()
- func (c *Canvas) Reset()
- func (c *Canvas) Set(x, y int, col color.Color)
- func (c *Canvas) Stopwatch() *Stopwatch
- type CanvasObject
- type CanvasObjectEmbed
- type ColorAnimation
- type ColorEmbed
- type ColorFillable
- type ColorFunc
- type ColorShaderAnim
- func (a *ColorShaderAnim) Continue()
- func (a *ColorShaderAnim) Duration() time.Duration
- func (a *ColorShaderAnim) IsRunning() bool
- func (a *ColorShaderAnim) SetDuration(d time.Duration)
- func (a *ColorShaderAnim) Start()
- func (a *ColorShaderAnim) StartAt(t time.Time)
- func (a *ColorShaderAnim) Suspend()
- func (a *ColorShaderAnim) Update(t time.Time) bool
- type ColorShaderFunc
- type ColorSource
- type ColorStop
- type Colorable
- type Delay
- type DirectGridClient
- func (c *DirectGridClient) Close()
- func (c *DirectGridClient) Gamma() (r, g, b float64)
- func (c *DirectGridClient) ModuleConfig() conf.ModuleConfig
- func (c *DirectGridClient) NumLeds() int
- func (c *DirectGridClient) Send(buffer []byte)
- func (c *DirectGridClient) SetGamma(r, g, b float64)
- func (c *DirectGridClient) Stopwatch() *Stopwatch
- type DisplayEmbed
- func (d *DisplayEmbed) Bounds() image.Rectangle
- func (d *DisplayEmbed) Display(buffer []byte)
- func (d *DisplayEmbed) Gamma() (r, g, b float64)
- func (d *DisplayEmbed) Init(impl Displayer, numLeds int)
- func (d *DisplayEmbed) ModuleConfig() conf.ModuleConfig
- func (d *DisplayEmbed) NumLeds() int
- func (d *DisplayEmbed) SetGamma(r, g, b float64)
- func (d *DisplayEmbed) SetModuleConfig(cnf conf.ModuleConfig)
- func (d *DisplayEmbed) SetPixelStatus(idx int, stat LedStatusType)
- type Displayer
- type Dot
- type DurationEmbed
- type Ellipse
- type Fadable
- type FadeAnimation
- type FadeEmbed
- type FadeTransition
- type FadeType
- type FileSaveClient
- func (p *FileSaveClient) Close()
- func (p *FileSaveClient) Gamma() (r, g, b float64)
- func (p *FileSaveClient) ModuleConfig() conf.ModuleConfig
- func (p *FileSaveClient) NumLeds() int
- func (p *FileSaveClient) Send(buffer []byte)
- func (p *FileSaveClient) SetGamma(r, g, b float64)
- func (p *FileSaveClient) Stopwatch() *Stopwatch
- type FilledColorEmbed
- type Filter
- type FilterBase
- type FilterIdent
- type FilterImpl
- type Fire
- func (f *Fire) Continue()
- func (f *Fire) Draw(c *Canvas)
- func (f *Fire) Duration() time.Duration
- func (f *Fire) IsRunning() bool
- func (f *Fire) SetDuration(dur time.Duration)
- func (f *Fire) Start()
- func (f *Fire) StartAt(t time.Time)
- func (f *Fire) Stop()
- func (f *Fire) Suspend()
- func (f *Fire) Update(pit time.Time) bool
- type FixedPosAnimation
- type FixedPosEmbed
- type FixedPositionable
- type FixedText
- type FloatAnimation
- type GammaArg
- type GenericAnimation
- type GeomPath
- type GradientPalette
- type GridClient
- type GridServer
- func (p *GridServer) Close()
- func (p *GridServer) Gamma() (r, g, b float64)
- func (p *GridServer) HandleEvents()
- func (p *GridServer) HandleMessage(conn net.Conn)
- func (p *GridServer) HandleTCP(lsnr *net.TCPListener)
- func (p *GridServer) ModuleConfig() conf.ModuleConfig
- func (p *GridServer) RPCGamma(arg int, reply *GammaArg) error
- func (p *GridServer) RPCModuleConfig(arg int, reply *ModuleConfigArg) error
- func (p *GridServer) RPCNumLeds(arg int, reply *NumLedsArg) error
- func (p *GridServer) RPCSetGamma(arg GammaArg, reply *int) error
- func (p *GridServer) SetGamma(r, g, b float64)
- func (p *GridServer) SetPixelStatus(idx int, stat LedStatusType)
- func (p *GridServer) Stopwatch() *Stopwatch
- func (p *GridServer) ToggleTestPattern() bool
- type Group
- type Image
- type IntAnimation
- type IntPosEmbed
- type IntegerPosAnimation
- type IntegerPositionable
- type Job
- type JsonPalette
- type LedGrid
- func (g *LedGrid) At(x, y int) color.Color
- func (g *LedGrid) Bounds() image.Rectangle
- func (g *LedGrid) Canvas(layer int) *Canvas
- func (g *LedGrid) Clear(c colors.LedColor)
- func (g *LedGrid) Close()
- func (g *LedGrid) ColorModel() color.Model
- func (g *LedGrid) DelCanvas(canv *Canvas)
- func (g *LedGrid) LedColorAt(x, y int) colors.LedColor
- func (g *LedGrid) NewCanvas() (*Canvas, int)
- func (g *LedGrid) PixOffset(x, y int) int
- func (g *LedGrid) Reset()
- func (g *LedGrid) Set(x, y int, c color.Color)
- func (g *LedGrid) SetLedColor(x, y int, c colors.LedColor)
- func (g *LedGrid) Show()
- func (g *LedGrid) StartRefresh()
- type LedStatusType
- type Line
- type ModuleConfigArg
- type MyUniform
- func (c *MyUniform) At(x, y int) color.Color
- func (c *MyUniform) Bounds() image.Rectangle
- func (c *MyUniform) ColorModel() color.Model
- func (c *MyUniform) Convert(color.Color) color.Color
- func (c *MyUniform) Opaque() bool
- func (c *MyUniform) RGBA() (r, g, b, a uint32)
- func (c *MyUniform) RGBA64At(x, y int) color.RGBA64
- type NetGridClient
- func (p *NetGridClient) Close()
- func (p *NetGridClient) Gamma() (r, g, b float64)
- func (p *NetGridClient) ModuleConfig() conf.ModuleConfig
- func (p *NetGridClient) NumLeds() int
- func (p *NetGridClient) Send(buffer []byte)
- func (p *NetGridClient) SetGamma(r, g, b float64)
- func (p *NetGridClient) Stopwatch() *Stopwatch
- type NormAnimation
- type NormAnimationEmbed
- func (a *NormAnimationEmbed) Continue()
- func (a *NormAnimationEmbed) Duration() time.Duration
- func (a *NormAnimationEmbed) Extend(wrapper NormAnimation)
- func (a *NormAnimationEmbed) IsRunning() bool
- func (a *NormAnimationEmbed) Start()
- func (a *NormAnimationEmbed) StartAt(t time.Time)
- func (a *NormAnimationEmbed) Suspend()
- func (a *NormAnimationEmbed) TimeInfo() (start, end time.Time, total float64)
- func (a *NormAnimationEmbed) Update(t time.Time) bool
- type NormShaderFunc
- type NumLedsArg
- type PaletteAnimation
- type PaletteFadeAnimation
- type PaletteFader
- type PaletteFuncType
- type Path
- type PathAnimation
- type PathFunctionType
- type Pixel
- type PolygonPath
- type PosEmbed
- type Positionable
- type Rectangle
- type RegularPolygon
- type Rotateable
- type Sequence
- func (a *Sequence) Add(tasks ...Task)
- func (a *Sequence) Continue()
- func (a *Sequence) IsRunning() bool
- func (a *Sequence) Put(tasks ...Task)
- func (a *Sequence) Start()
- func (a *Sequence) StartAt(t time.Time)
- func (a *Sequence) Suspend()
- func (a *Sequence) TimeInfo() (start, end time.Time)
- func (a *Sequence) Update(t time.Time) bool
- type Shader
- type ShaderAnimation
- func (a *ShaderAnimation) Continue()
- func (a *ShaderAnimation) Duration() time.Duration
- func (a *ShaderAnimation) IsRunning() bool
- func (a *ShaderAnimation) SetDuration(d time.Duration)
- func (a *ShaderAnimation) Start()
- func (a *ShaderAnimation) StartAt(t time.Time)
- func (a *ShaderAnimation) Suspend()
- func (a *ShaderAnimation) Update(t time.Time) bool
- type SimpleTask
- type SizeAnimation
- type SizeEmbed
- type Sizeable
- type SlicePalette
- type Sprite
- type Stopwatch
- type StrokeWidthEmbed
- type StrokeWidtheable
- type Task
- type Text
- type TimedAnimation
- type Timeline
- type TimelineSlot
- type UniformPalette
- func (p *UniformPalette) At(x, y int) color.Color
- func (p *UniformPalette) Bounds() image.Rectangle
- func (p *UniformPalette) Color(v float64) colors.LedColor
- func (p *UniformPalette) ColorModel() color.Model
- func (p *UniformPalette) Name() string
- func (p *UniformPalette) Set(x, y int, c colors.LedColor)
- type WS2801
- type WipeDirection
- type WipeTransition
- type WipeType
Constants ¶
const ( DefDataPort = 5333 DefRPCPort = 5332 )
const ( RedChain = iota YellowChain GreenChain CyanChain BlueChain MagentaChain WhiteChain NumColorModes )
const ( // Fuer Animationen, die endlos wiederholt weren sollen, kann diese Konstante // fuer die Anzahl Wiederholungen verwendet werden. AnimationRepeatForever = -1 )
const (
NumLayers = 5
)
Variables ¶
var ( CirclePath = NewGeomPath(circlePathFunc, 0, 1) LinearPath = NewGeomPath(linearPathFunc, 0, 1) RectanglePath = NewGeomPath(rectPathFunc, 0, 1) )
var ( // Die Animationskurven, welche auf quadratischen und kubischen Parabeln // basieren, sind bereits vorgefertigt. AnimationEaseIn = NewAnimationCurve(genericIn, 2.0) AnimationEaseOut = NewAnimationCurve(genericOut, 2.0) AnimationEaseInOut = NewAnimationCurve(genericInOut, 2.0) AnimationCubicIn = NewAnimationCurve(genericIn, 3.0) AnimationCubicOut = NewAnimationCurve(genericOut, 3.0) AnimationCubicInOut = NewAnimationCurve(genericInOut, 3.0) )
var ( // Alle vorhandenen Paletten sind in diesem Slice aufgefuehrt. Falls // applikatorisch weitere Paletten erzeugt werden, ist es Aufgabe der // Applikation, diesen Slice nachzufuehren. PaletteNames = []string{} // Im Gegensatz zu [PaletteList] sind hier die Paletten unter ihrem // Namen abgelegt. Siehe auch Kommentar bei [PaletteList] betr. // Nachfuehrung. PaletteMap = map[string]ColorSource{} ColorNames = []string{} ColorMap = map[string]*UniformPalette{} )
var Fixed5x7 = &basicfont.Face{
Advance: 6,
Width: 5,
Height: 9,
Ascent: 7,
Descent: 0,
Mask: maskFixed5x7,
Ranges: glyphRangeFull,
}
var Lightdot6x8 = &basicfont.Face{ Advance: 7, Width: 6, Height: 9, Ascent: 8, Descent: 0, Mask: maskLightdot6x8, Ranges: []basicfont.Range{ {'\u0030', '\u003a', 0}, }, }
var Lightdot8x8 = &basicfont.Face{ Advance: 9, Width: 8, Height: 9, Ascent: 8, Descent: 0, Mask: maskLightdot8x8, Ranges: []basicfont.Range{ {'\u0030', '\u003a', 0}, }, }
var Pico3x5 = &basicfont.Face{
Advance: 4,
Width: 3,
Height: 8,
Ascent: 5,
Descent: 0,
Mask: maskPico3x5,
Ranges: glyphRangeFull,
}
var Pico6x10 = &basicfont.Face{
Advance: 8,
Width: 6,
Height: 16,
Ascent: 10,
Descent: 0,
Mask: maskPico6x10,
Ranges: glyphRangeFull,
}
var Pico9x15 = &basicfont.Face{
Advance: 12,
Width: 9,
Height: 24,
Ascent: 15,
Descent: 0,
Mask: maskPico9x15,
Ranges: glyphRangeFull,
}
Functions ¶
func AnimationLinear ¶ added in v1.3.0
Linearer Verlauf zwischen 0.0 und 1.0.
func InitGradientPalettes ¶ added in v1.4.1
func InitGradientPalettes(fileName string)
func InitUniformPalettes ¶ added in v1.4.1
func InitUniformPalettes()
Types ¶
type Align ¶ added in v1.4.1
type Align int
Die folgenden Typen, Structs (embeddable), Konstanten, etc. sind fuer das Ausrichten von Textbloecken in vertikaler und horizontaler Richtung vorgesehen.
type AlignEmbed ¶ added in v1.4.1
type AlignEmbed struct {
// contains filtered or unexported fields
}
Jeder Typ, der eine horizontale und vertikale Ausrichtung kennt oder anbieten will, kann den Typ alignEmbed einbetten. Damit erhaelt er zwei Fliesskomma-Variablen (ax und ay), welche ueber die Methode SetAlign gesetzt werden koennen und folgede Bedeutung haben: ax: 0.0: x-Pos des Objektes bezieht sich auf seinen linken Rand
0.5: x-Pos des Objektes bezieht sich auf Mitte (horizontal) 1.0: x-Pos des Objektes bezieht sich auf seinen rechten Rand
ay: 0.0: y-Pos des Objektes bezieht sich auf seinen unteren Rand
0.5: y-Pos des Objektes bezieht sich auf Mitte (vertikal) 1.0: y-Pos des Objektes bezieht sich auf seinen oberen Rand
(ax und ay nehmen also in math. korrekter Richtung zu)
func (*AlignEmbed) SetAlign ¶ added in v1.4.1
func (a *AlignEmbed) SetAlign(align Align)
Setzt die Ausrichtung auf den in align kodierten Wert. Sowohl x- als auch y-Ausrichtung koennen damit gesetzt werden. Falls bei einer Ausrichtung mehrere Werte angegeben wurden (bspw. AlignLeft | AlignCenter), so wird fuer diese Ausrichtung keinen neuen Wert gesetzt.
type AngleEmbed ¶ added in v1.4.1
type AngleEmbed struct {
Angle float64
}
func (*AngleEmbed) AnglePtr ¶ added in v1.4.1
func (e *AngleEmbed) AnglePtr() *float64
type AnimColors ¶ added in v1.4.1
AnimColors enthaelt bloss einen Datentyp fuer animierbare Farben.
type AnimNumbers ¶ added in v1.4.1
Dies sind die animierbaren skalaren Datentypen.
type AnimPoints ¶ added in v1.4.1
AnimPoints sind die animierbaren 2D-Vektoren von denen es 3 Typen gibt.
type AnimValue ¶ added in v1.4.1
type AnimValue interface {
AnimNumbers | AnimPoints | AnimColors
}
AnimValue schliesslich ist der Zusammenschluss aller animierbaren Typen.
type AnimValueFunc ¶ added in v1.4.1
type AnimValueFunc[T AnimValue] func() T
Die eigentliche Arbeit erbringen Funktionen vom Typ AnimValueFunc, welche ohne Parameter aufgerufen werden und als Rueckgabewert einen Wert des Typs AnimValue haben.
func Const ¶ added in v1.4.1
func Const[T AnimValue](v T) AnimValueFunc[T]
Nicht alles muss immer animiert werden, soll sich aber dem Interface moeglichst anpassen. Dazu kann mit der Funktion Const eine AnimValueFunc erzeugt werden, die bei jedem Aufruf den selben Wert zurueckliefert.
func RandAlpha ¶ added in v1.3.0
func RandAlpha(a, b uint8) AnimValueFunc[uint8]
Liefert eine zufaellig gewaehlte natuerliche Zahl im Interval [a,b).
func RandFloat ¶ added in v1.3.0
func RandFloat(a, b float64) AnimValueFunc[float64]
Liefert eine zufaellig gewaehlte Fliesskommazahl im Interval [a,b).
func RandGroupColor ¶ added in v1.4.1
func RandGroupColor(group colors.ColorGroup, new bool) AnimValueFunc[colors.LedColor]
func RandPoint ¶ added in v1.3.0
func RandPoint(r geom.Rectangle) AnimValueFunc[geom.Point]
Liefert bei jedem Aufruf einen zufaellig gewaehlten Punkt innerhalb des Rechtecks r.
func RandPointTrunc ¶ added in v1.3.0
Wie RandPoint, sorgt jedoch dafuer dass die Koordinaten auf ein Vielfaches von t abgeschnitten werden.
type Animation ¶ added in v1.1.0
Animationen schliesslich sind Jobs, koennen also gestoppt und gestartet werden, haben jedoch zusaetzlich klare Laufzeiten und werden periodisch durch den AnimationController aufgerufen, damit sie ihren Animations-Kram erledigen koennen. Man kann sie ausserdem Suspendieren und Fortsetzen.
type AnimationController ¶ added in v1.3.0
type AnimationController struct {
AnimList []Animation
// contains filtered or unexported fields
}
Das Herzstueck der ganzen Animationen ist der AnimationController. Er sorgt dafuer, dass alle 30 ms (siehe Variable refreshRate) die Update-Methoden aller Animationen aufgerufen werden und veranlasst im Anschluss, dass alle darstellbaren Objekte neu gezeichnet werden und sendet das Bild schliesslich dem PixelController (oder dem PixelEmulator).
var ( // Weil es nur einen (1) Animations-Kontroller geben kann, ist in diesem // Package eine globale Variable dafuer vorgesehen. AnimCtrl *AnimationController )
func NewAnimationController ¶ added in v1.3.0
func NewAnimationController(syncChan chan bool) *AnimationController
func (*AnimationController) Add ¶ added in v1.3.0
func (a *AnimationController) Add(anims ...Animation)
Fuegt weitere Animationen hinzu. Der Zugriff auf den entsprechenden Slice wird synchronisiert, da die Bearbeitung der Animationen durch den Background-Thread ebenfalls relativ haeufig auf den Slice zugreift.
func (*AnimationController) Continue ¶ added in v1.3.0
func (a *AnimationController) Continue()
Setzt die Animationen wieder fort. TO DO: Die Fortsetzung sollte fuer eine:n Beobachter:in nahtlos erfolgen. Im Moment tut es das nicht - man muesste sich bei den Methoden und Ideen von AnimationEmbed bedienen.
func (*AnimationController) Del ¶ added in v1.3.0
func (a *AnimationController) Del(anim Animation)
Loescht eine einzelne Animation.
func (*AnimationController) DelAt ¶ added in v1.4.0
func (a *AnimationController) DelAt(idx int)
func (*AnimationController) IsRunning ¶ added in v1.4.1
func (a *AnimationController) IsRunning() bool
func (*AnimationController) Now ¶ added in v1.4.0
func (a *AnimationController) Now() time.Time
func (*AnimationController) Purge ¶ added in v1.3.0
func (a *AnimationController) Purge()
Loescht alle Animationen.
func (*AnimationController) Stopwatch ¶ added in v1.4.2
func (a *AnimationController) Stopwatch() *Stopwatch
func (*AnimationController) Suspend ¶ added in v1.4.1
func (a *AnimationController) Suspend()
Mit Suspend koennen die Animationen und die Darstellung auf der Hardware unterbunden werden.
type AnimationCurve ¶ added in v1.1.0
Mit dem Funktionstyp AnimationCurve kann der Verlauf einer Animation beeinflusst werden. Der Parameter [t] ist ein Wert im Intervall [0,1] und zeigt an, wo sich die Animation gerade befindet (t=0: Animation wurde eben gestartet; t=1: Animation ist zu Ende). Der Rueckgabewert ist ebenfalls ein Wert im Intervall [0,1] und hat die gleiche Bedeutung wie [t].
func NewAnimationCurve ¶ added in v1.4.2
func NewAnimationCurve(fnc genericCurve, a float64) AnimationCurve
Mit dieser Methode schliesslich, werden konkrete Animationskurven erstellt. Der erste Parameter bezeichnet eine der generischen Funktionen und mit dem Parameter a wird der gewuenschte Exponent fix hinterlegt. Das Resultat ist eine Funktion des Typs AnimationCurve, der im Feld [Curve] einer Animation hinterlegt werden kann.
type BLM ¶ added in v1.4.1
Der Typ BLM und die gleich danach definierten Methoden/Funktionen sind nach Vorbild 'image/gif' implementiert und koennen zum Laden von BlinkenLight-Animationen verwendet werden.
type BlinkenFile ¶ added in v1.1.0
type BlinkenFile struct {
XMLName xml.Name `xml:"blm"`
Width int `xml:"width,attr"`
Height int `xml:"height,attr"`
Bits int `xml:"bits,attr"`
Channels int `xml:"channels,attr"`
Header BlinkenHeader `xml:"header"`
Frames []BlinkenFrame `xml:"frame"`
}
Fuer die Einbindung von Animationen im BlinkenLight-Format sind hier erst mal die Typen für die Verarbeitung der XML-Dateien.
func ReadBlinkenFile ¶ added in v1.1.0
func ReadBlinkenFile(fileName string) *BlinkenFile
Mit folgender Funktion wird eine Datei im BlinkenLight-Format eingelesen. Die Bilddaten werden dabei noch nicht decodiert, d.h. noch nicht in ein 'image'-Format umgewandelt (siehe dazu auch die Methode Decode).
func (*BlinkenFile) Decode ¶ added in v1.3.0
func (b *BlinkenFile) Decode(idx int) draw.Image
Hier schliesslich werden die Bilddaten des Frames mit Index idx decodiert und als image.RGBA-Struktur zurückgegeben.
func (*BlinkenFile) Duration ¶ added in v1.3.0
func (b *BlinkenFile) Duration(idx int) time.Duration
Retourniert die Anzeigedauer des Frames mit Index idx. Für eine Aufsummierung der Anzeigewerte zur Berechnung der Anzeigedauer der gesamten Bildfolge ist ein aufrufendes Programm verantwortlich.
func (*BlinkenFile) NumFrames ¶ added in v1.3.0
func (b *BlinkenFile) NumFrames() int
Retourniert die Anzahl Frames in der BlinkenLight-Animation.
func (*BlinkenFile) SetAllDuration ¶ added in v1.4.0
func (b *BlinkenFile) SetAllDuration(durMs int)
type BlinkenFrame ¶ added in v1.1.0
type BlinkenHeader ¶ added in v1.1.0
type ByteCount ¶ added in v1.4.1
type ByteCount int64
Der Datentyp ByteCount kann zum Zaehlen von Bytes verwendet werden (bspw. bei Netzwerk- oder Datei-IO). Die Ausgabe als Text wird formatiert. So werden 1024 als '1.0 kB' oder 4096 als '4.0 kB' dargestellt.
type Canvas ¶ added in v1.3.0
type Canvas struct {
ObjList *list.List
BackColor colors.LedColor
Rect image.Rectangle
Img draw.Image
GC *gg.Context
Mask image.Image
// contains filtered or unexported fields
}
Ein Canvas ist eine animierbare Zeichenflaeche. Ihr koennen eine beliebige Anzahl von zeichenbaren Objekten (Interface CanvasObject) hinzugefuegt werden.
func (*Canvas) Add ¶ added in v1.3.0
func (c *Canvas) Add(objs ...CanvasObject)
Fuegt der Zeichenflaeche weitere Objekte hinzu. Der Zufgriff auf den entsprechenden Slice wird nicht synchronisiert.
func (*Canvas) ColorModel ¶ added in v1.4.1
The following methods implement the image.Image (resp. draw.Image) interface. A Canvas object can therefore be used as the destination as well as the source for all kind of drawings.
func (*Canvas) Del ¶ added in v1.4.1
func (c *Canvas) Del(obj CanvasObject)
Loescht ein einzelnes Objekt von der Zeichenflaeche.
func (*Canvas) Purge ¶ added in v1.3.0
func (c *Canvas) Purge()
Loescht alle Objekte von der Zeichenflaeche.
type CanvasObject ¶ added in v1.3.0
Alle Objekte, die durch den Controller auf dem LED-Grid dargestellt werden sollen, muessen das CanvasObject-Interface implementieren. Dieses enthaelt einerseits Methoden zum Ein-/Ausblenden von Objekten und andererseits die Methode Draw, mit welcher das CanvasObject auf einer Zeichenflaeche gezeichnet werden kann.
type CanvasObjectEmbed ¶ added in v1.3.0
type CanvasObjectEmbed struct {
// contains filtered or unexported fields
}
Wie bei den Animationen gibt es für die darstellbaren Objekte (CanvasObject) ein entsprechendes Embedable, welche die für die meisten Objekte brauchbaren Methoden enthält.
func (*CanvasObjectEmbed) Extend ¶ added in v1.4.0
func (c *CanvasObjectEmbed) Extend(wrapper CanvasObject)
func (*CanvasObjectEmbed) Hide ¶ added in v1.3.0
func (c *CanvasObjectEmbed) Hide()
func (*CanvasObjectEmbed) IsVisible ¶ added in v1.4.1
func (c *CanvasObjectEmbed) IsVisible() bool
func (*CanvasObjectEmbed) Show ¶ added in v1.3.0
func (c *CanvasObjectEmbed) Show()
type ColorAnimation ¶ added in v1.3.0
type ColorAnimation struct {
GenericAnimation[colors.LedColor]
}
Animation fuer einen Verlauf zwischen zwei Farben.
func NewColorAnim ¶ added in v1.4.1
func NewFillColorAnim ¶ added in v1.4.1
func NewFillColorAnim(obj ColorFillable, val2 colors.LedColor, dur time.Duration) *ColorAnimation
func (*ColorAnimation) Tick ¶ added in v1.3.0
func (a *ColorAnimation) Tick(t float64)
type ColorEmbed ¶ added in v1.4.1
func (*ColorEmbed) ColorPtr ¶ added in v1.4.1
func (e *ColorEmbed) ColorPtr() *colors.LedColor
type ColorFillable ¶ added in v1.4.1
type ColorShaderAnim ¶ added in v1.4.1
type ColorShaderAnim struct {
ValPtr *colors.LedColor
X, Y, Z float64
Idx, NPix int
Fnc ColorShaderFunc
// contains filtered or unexported fields
}
func NewColorShaderAnim ¶ added in v1.4.1
func NewColorShaderAnim(obj Colorable, x, y, z float64, idx, nPix int, fnc ColorShaderFunc) *ColorShaderAnim
func (*ColorShaderAnim) Continue ¶ added in v1.4.1
func (a *ColorShaderAnim) Continue()
Setzt die Ausfuehrung der Animation fort.
func (*ColorShaderAnim) Duration ¶ added in v1.4.1
func (a *ColorShaderAnim) Duration() time.Duration
func (*ColorShaderAnim) IsRunning ¶ added in v1.4.1
func (a *ColorShaderAnim) IsRunning() bool
Liefert den Status der Animation zurueck.
func (*ColorShaderAnim) SetDuration ¶ added in v1.4.1
func (a *ColorShaderAnim) SetDuration(d time.Duration)
func (*ColorShaderAnim) Start ¶ added in v1.4.1
func (a *ColorShaderAnim) Start()
func (*ColorShaderAnim) StartAt ¶ added in v1.4.1
func (a *ColorShaderAnim) StartAt(t time.Time)
Startet die Animation.
func (*ColorShaderAnim) Suspend ¶ added in v1.4.1
func (a *ColorShaderAnim) Suspend()
Unterbricht die Ausfuehrung der Animation.
type ColorShaderFunc ¶ added in v1.4.1
type ColorSource ¶ added in v1.1.0
type ColorSource interface {
// Liefert in Abhaengigkeit des Parameters v eine Farbe aus der Palette
// zurueck. v kann vielfaeltig verwendet, resp. interpretiert werden,
// bsp. als Parameter im Intervall [0,1], als Index (natuerliche Zahl)
// einer Farbenliste oder gar nicht, wenn die Farbquelle einfarbig ist.
Color(v float64) colors.LedColor
// Da alle Paletten noch einen Namen haben, der bspw. in einem GUI- oder
// TUI-Element dargestellt werden kann, existiert diese Methode.
Name() string
}
Alles, was im Sinne einer Farbpalette Farben erzeugen kann, implementiert das ColorSource Interface.
type ColorStop ¶ added in v1.1.0
Dieser (interne) Typ wird verwendet, um einen bestimmten Wert im Interval [0,1] mit einer Farbe zu assoziieren.
type Delay ¶ added in v1.4.1
type Delay struct {
NormAnimationEmbed
}
Ein Delay kann als ganz normale Animation ueberall dort eingefuegt werden, wo ein unmittelbares Fortfahren der Animationen nicht gewuenscht ist und wo der Einsatz der Timeline zu aufwaendig ist.
type DirectGridClient ¶ added in v1.4.2
type DirectGridClient struct {
Disp Displayer
// contains filtered or unexported fields
}
func (*DirectGridClient) Close ¶ added in v1.4.2
func (c *DirectGridClient) Close()
func (*DirectGridClient) Gamma ¶ added in v1.4.2
func (c *DirectGridClient) Gamma() (r, g, b float64)
func (*DirectGridClient) ModuleConfig ¶ added in v1.4.2
func (c *DirectGridClient) ModuleConfig() conf.ModuleConfig
func (*DirectGridClient) NumLeds ¶ added in v1.4.2
func (c *DirectGridClient) NumLeds() int
func (*DirectGridClient) Send ¶ added in v1.4.2
func (c *DirectGridClient) Send(buffer []byte)
func (*DirectGridClient) SetGamma ¶ added in v1.4.2
func (c *DirectGridClient) SetGamma(r, g, b float64)
func (*DirectGridClient) Stopwatch ¶ added in v1.4.2
func (c *DirectGridClient) Stopwatch() *Stopwatch
type DisplayEmbed ¶ added in v1.4.1
type DisplayEmbed struct {
ModConf conf.ModuleConfig
// contains filtered or unexported fields
}
Each implementation of a Displayer should embed this embeddable. It provides default implementations for a number of general methods.
func (*DisplayEmbed) Bounds ¶ added in v1.4.1
func (d *DisplayEmbed) Bounds() image.Rectangle
See Bounds in interface Displayer.
func (*DisplayEmbed) Display ¶ added in v1.4.1
func (d *DisplayEmbed) Display(buffer []byte)
See Display in interface Displayer.
func (*DisplayEmbed) Gamma ¶ added in v1.4.1
func (d *DisplayEmbed) Gamma() (r, g, b float64)
See Gamma in interface Displayer.
func (*DisplayEmbed) Init ¶ added in v1.4.1
func (d *DisplayEmbed) Init(impl Displayer, numLeds int)
An embedding type needs to call this method once in order to set initial values correctly.
func (*DisplayEmbed) ModuleConfig ¶ added in v1.4.1
func (d *DisplayEmbed) ModuleConfig() conf.ModuleConfig
See ModuleConfig in interface Displayer.
func (*DisplayEmbed) NumLeds ¶ added in v1.4.1
func (d *DisplayEmbed) NumLeds() int
See NumLeds in interface Displayer.
func (*DisplayEmbed) SetGamma ¶ added in v1.4.1
func (d *DisplayEmbed) SetGamma(r, g, b float64)
See SetGamma in interface Displayer.
func (*DisplayEmbed) SetModuleConfig ¶ added in v1.4.1
func (d *DisplayEmbed) SetModuleConfig(cnf conf.ModuleConfig)
See SetModuleConfig in interface Displayer.
func (*DisplayEmbed) SetPixelStatus ¶ added in v1.4.1
func (d *DisplayEmbed) SetPixelStatus(idx int, stat LedStatusType)
See SetPixelStatus in interface Displayer.
type Displayer ¶ added in v1.2.0
type Displayer interface {
// Returns the number of addressable NeoPixels in this implementation.
// Will be used by the Server to allocate memory for buffer.
NumLeds() int
// Returns a Rectangle enclosing the whole display. Because the
// configuration of the modules allow empty space within this
// rectangle, you cannot derive the number of NeoPixels from this value.
Bounds() image.Rectangle
// Returns the module configuration of this displayer.
ModuleConfig() conf.ModuleConfig
// Sets a new module configuration
SetModuleConfig(cnf conf.ModuleConfig)
// Sets the status of NeoPixel with index idx to stat.
SetPixelStatus(idx int, stat LedStatusType)
// Returns the gamma values that should be used by default on this
// displayer.
DefaultGamma() (r, g, b float64)
// Returns the currently set values for the gamma correction
Gamma() (r, g, b float64)
// Set new values for the gamma correction.
SetGamma(r, g, b float64)
// Display is used by a Server to show the image data in buffer. The bytes
// in buffer must already be in a suitable order for this specific device.
// The order of RGB has to be in device order as well but the data hasn't
// to be gamma corrected.
Display(buffer []byte)
// Send is called by Display and must not be called from other parts of
// the software
Send(buffer []byte)
// Closes the connection to the displaying hardware and releases any
// allocated ressources.
Close()
}
The output device can be realized in several ways. For example a SPI bus with a chain of NeoPixels, driven by WS2801 - this for sure is the default. But think of development: there may be an emulation of this (quite expensive) hardware. Every"thing" which can be used as a display must implement this interface.
type Dot ¶ added in v1.4.0
type Dot struct {
CanvasObjectEmbed
PosEmbed
ColorEmbed
FadeEmbed
}
Ein einzelnes Pixel, dessen Bewegungen weicher (smooth) animiert werden koennen, ist der Typ Dot. Da er grosse Aehnlichkeit zum Typ Pixel aufweist, werden auch hier die Koordinaten als Spalten-, resp. Zeilenindex interpretiert.
type DurationEmbed ¶ added in v1.3.0
type DurationEmbed struct {
// contains filtered or unexported fields
}
Haben Animationen eine Dauer, so koennen sie dieses Embeddable einbinden und erhalten somit die klassischen Methoden fuer das Setzen und Abfragen der Dauer.
func (*DurationEmbed) Duration ¶ added in v1.3.0
func (d *DurationEmbed) Duration() time.Duration
func (*DurationEmbed) SetDuration ¶ added in v1.3.0
func (d *DurationEmbed) SetDuration(dur time.Duration)
type Ellipse ¶ added in v1.3.0
type Ellipse struct {
CanvasObjectEmbed
PosEmbed
SizeEmbed
AngleEmbed
FilledColorEmbed
StrokeWidthEmbed
FillColorFnc string
}
Mit Ellipse sind alle kreisartigen Objekte abgedeckt. Pos bezeichnet die Position des Mittelpunktes und mit Size ist die Breite und Hoehe des gesamten Objektes gemeint. Falls ein Rand gezeichnet werden soll, muss BorderWith einen Wert >0 enthalten und FillColor, resp. BorderColor enthalten die Farben fuer Rand und Flaeche.
func NewEllipse ¶ added in v1.3.0
Erzeugt eine 'klassische' Ellipse mit einer Randbreite von einem Pixel und setzt die Fuellfarbe gleich Randfarbe mit Alpha-Wert von 0.3. Will man die einzelnen Werte flexibler verwenden, empfiehlt sich die Erzeugung mittels &Ellipse{...}.
type FadeAnimation ¶ added in v1.4.1
type FadeAnimation struct {
GenericAnimation[uint8]
}
func NewFadeAnim ¶ added in v1.4.1
func NewFadeAnim(obj Fadable, fade FadeType, dur time.Duration) *FadeAnimation
func (*FadeAnimation) Tick ¶ added in v1.4.1
func (a *FadeAnimation) Tick(t float64)
type FadeEmbed ¶ added in v1.4.1
type FadeEmbed struct {
// contains filtered or unexported fields
}
type FadeTransition ¶ added in v1.4.1
type FadeTransition struct {
NormAnimationEmbed
// contains filtered or unexported fields
}
This is the simplest form of a transition: it will mask the whole canvas with the same alpha value. With it you can realize smooth fadings from one canvas to another.
func NewFadeTransition ¶ added in v1.4.1
func NewFadeTransition(c *Canvas, a0, a1 uint8, d time.Duration) *FadeTransition
Creates a new fade transition on canvas c, varying the alpha value of that canvas from a0 to a1 within duration d. For a transition to another canvas, you have to use a second fade transition on the other canvas, running from a1 to a0 within the same duration.
func (*FadeTransition) Bounds ¶ added in v1.4.1
func (a *FadeTransition) Bounds() image.Rectangle
func (*FadeTransition) ColorModel ¶ added in v1.4.1
func (a *FadeTransition) ColorModel() color.Model
func (*FadeTransition) Init ¶ added in v1.4.1
func (a *FadeTransition) Init()
func (*FadeTransition) Tick ¶ added in v1.4.1
func (a *FadeTransition) Tick(t float64)
type FileSaveClient ¶ added in v1.4.1
type FileSaveClient struct {
// contains filtered or unexported fields
}
Dieser Client-Typ schreibt alle Bilddaten in eine Datei, welche im Anschluss auf ein System mit echter Hardware transferiert und dort wie ein Film abgespielt wird.
func (*FileSaveClient) Close ¶ added in v1.4.1
func (p *FileSaveClient) Close()
func (*FileSaveClient) Gamma ¶ added in v1.4.1
func (p *FileSaveClient) Gamma() (r, g, b float64)
func (*FileSaveClient) ModuleConfig ¶ added in v1.4.1
func (p *FileSaveClient) ModuleConfig() conf.ModuleConfig
func (*FileSaveClient) NumLeds ¶ added in v1.4.1
func (p *FileSaveClient) NumLeds() int
func (*FileSaveClient) Send ¶ added in v1.4.1
func (p *FileSaveClient) Send(buffer []byte)
func (*FileSaveClient) SetGamma ¶ added in v1.4.1
func (p *FileSaveClient) SetGamma(r, g, b float64)
func (*FileSaveClient) Stopwatch ¶ added in v1.4.2
func (p *FileSaveClient) Stopwatch() *Stopwatch
type FilledColorEmbed ¶ added in v1.4.1
type FilledColorEmbed struct {
ColorEmbed
FillColor colors.LedColor
}
func (*FilledColorEmbed) FillColorPtr ¶ added in v1.4.1
func (e *FilledColorEmbed) FillColorPtr() *colors.LedColor
type FilterBase ¶ added in v1.4.1
type FilterBase struct {
// contains filtered or unexported fields
}
func (*FilterBase) Bounds ¶ added in v1.4.1
func (f *FilterBase) Bounds() image.Rectangle
func (*FilterBase) ColorModel ¶ added in v1.4.1
func (f *FilterBase) ColorModel() color.Model
func (*FilterBase) Extend ¶ added in v1.4.1
func (f *FilterBase) Extend(img draw.Image, flt FilterImpl)
type FilterIdent ¶ added in v1.4.1
type FilterIdent struct {
FilterBase
}
func NewFilterIdent ¶ added in v1.4.1
func NewFilterIdent(img draw.Image) *FilterIdent
type FilterImpl ¶ added in v1.4.1
type Fire ¶ added in v1.1.0
type Fire struct {
CanvasObjectEmbed
Pos, Size image.Point
// contains filtered or unexported fields
}
func (*Fire) SetDuration ¶ added in v1.4.1
type FixedPosAnimation ¶ added in v1.3.0
type FixedPosAnimation struct {
GenericAnimation[fixed.Point26_6]
}
func NewFixedPosAnim ¶ added in v1.4.1
func NewFixedPosAnim(obj FixedPositionable, val2 fixed.Point26_6, dur time.Duration) *FixedPosAnimation
func (*FixedPosAnimation) Tick ¶ added in v1.3.0
func (a *FixedPosAnimation) Tick(t float64)
type FixedPosEmbed ¶ added in v1.4.1
func (*FixedPosEmbed) PosPtr ¶ added in v1.4.1
func (e *FixedPosEmbed) PosPtr() *fixed.Point26_6
type FixedPositionable ¶ added in v1.4.1
Animation fuer eine Positionsveraenderung anhand des Fixed-Datentyps fixed/Point26_6. Dies wird insbesondere für die Positionierung von Schriften verwendet.
type FixedText ¶ added in v1.3.0
type FixedText struct {
CanvasObjectEmbed
AlignEmbed
FixedPosEmbed
ColorEmbed
FadeEmbed
// contains filtered or unexported fields
}
func NewFixedText ¶ added in v1.3.0
func (*FixedText) Size ¶ added in v1.4.2
func (t *FixedText) Size() fixed.Rectangle26_6
type FloatAnimation ¶ added in v1.3.0
type FloatAnimation struct {
GenericAnimation[float64]
}
Animation fuer einen Verlauf zwischen zwei Fliesskommazahlen. Kann fuer verschiedene konkrete Animationen verwendet werden.
func NewAngleAnim ¶ added in v1.4.1
func NewAngleAnim(obj Rotateable, val2 float64, dur time.Duration) *FloatAnimation
func NewStrokeWidthAnim ¶ added in v1.4.1
func NewStrokeWidthAnim(obj StrokeWidtheable, val2 float64, dur time.Duration) *FloatAnimation
func (*FloatAnimation) Tick ¶ added in v1.3.0
func (a *FloatAnimation) Tick(t float64)
type GenericAnimation ¶ added in v1.4.1
type GenericAnimation[T AnimValue] struct { // NormAnimationEmbed wird eingebunden, um Methoden wie Start(), Suspend(), // Continue() nur einmal implementieren zu muessen. NormAnimationEmbed // ValPtr zeigt auf jenes Feld eines Objektes, welches durch diese // Animation veraendert werden soll. Die Animation kennt also den // Grund-Typ (Rectangle, Circle, Pixel, etc) nicht, sondern nur die zu // animierende Eigenschaft. ValPtr *T // Val1 und Val2 enthalten Funktionen, mit welchen der Start-, resp. End- // wert einer Animation zum Startzeitpunkt ermittelt werden. Damit lassen // sich die Animationen sehr dynamisch gestalten. Val1, Val2 AnimValueFunc[T] // Ist Cont (Continue) auf true, dann wird val1 zum Startzeitpunkt mit // dem aktuellen Wert hinter ValPtr belegt und nicht mit dem Funktionswert // aus Val1. Cont bool // contains filtered or unexported fields }
Damit der Code zu den Animationen so knapp und uebersichtlich wie moeglich wird, ist ein Grossteil generisch implementiert. GenericAnimation wird als Grund-Typ von (nahezu) allen Animationen verwendet. Die Instanziierung erfolgt ueber einen der Datenypen, welche in AnimValue zusammengefasst sind.
func (*GenericAnimation[T]) Init ¶ added in v1.4.1
func (a *GenericAnimation[T]) Init()
func (*GenericAnimation[T]) InitAnim ¶ added in v1.4.1
func (a *GenericAnimation[T]) InitAnim(valPtr *T, val2 T, dur time.Duration)
type GeomPath ¶ added in v1.4.1
type GeomPath struct {
// contains filtered or unexported fields
}
Geometrische Pfade heissen deshalb so, weil ihre Grundlage um Punkte zu bauen irgendwo in der Geometrie zu suchen ist.
func NewGeomPath ¶ added in v1.4.1
func NewGeomPath(fnc PathFunctionType, t0, l float64) *GeomPath
Alle geom. Pfade beruhen auf einer Pfad-Funktion (erster Parameter), der beim Erstellen eines Pfades zwingend angegeben werden muss. Mit t0 und l kann der Startpunkt, bzw. die Laenge der Animation im Vergleich zur gesamten Laenge von fnc bestimmt werden.
func (*GeomPath) NewStart ¶ added in v1.4.1
Baut aus dem geom. Pfad p einen neuen, indem der Anfangspunkt auf t0 verlegt wird.
func (*GeomPath) NewStartLen ¶ added in v1.4.1
Baut aus dem geom. Pfad p einen neuen, indem der Anfangspunkt auf t0 und die totale Laenge des Pfades auf l gesetzt wird.
type GradientPalette ¶ added in v1.1.0
type GradientPalette struct {
// contains filtered or unexported fields
}
Gradienten-Paletten basieren auf einer Anzahl Farben (Stuetzstellen) zwischen denen eine Farbe interpoliert werden kann. Jede Stuetzstelle besteht aus einer Position (Zahl im Intervall [0,1]) und einer dazu gehoerenden Farbe.
func NewGradientPalette ¶ added in v1.1.0
func NewGradientPalette(name string, cl ...ColorStop) *GradientPalette
Erzeugt eine neue Palette unter Verwendung der Stuetzwerte in cl. Die Stuetzwerte muessen nicht sortiert sein. Per Default ist 0.0 mit Schwarz und 1.0 mit Weiss vorbelegt - sofern in cl keine Stuetzwerte fuer 0.0 und 1.0 angegeben sind.
func NewGradientPaletteByList ¶ added in v1.1.0
func NewGradientPaletteByList(name string, cycle bool, cl ...colors.LedColor) *GradientPalette
Erzeugt eine neue Gradienten-Palette unter Verwendung der Farben in cl, wobei die Farben aequidistant ueber das Interval [0,1] verteilt werden. Ist cycle true, dann wird die erste Farbe in cl auch als letzte Farbe verwendet.
func (*GradientPalette) Color ¶ added in v1.1.0
func (p *GradientPalette) Color(t float64) (c colors.LedColor)
Hier nun spielt die Musik: aufgrund des Wertes t (muss im Intervall [0,1] liegen) wird eine neue Farbe interpoliert.
func (*GradientPalette) ColorStops ¶ added in v1.1.0
func (p *GradientPalette) ColorStops() []ColorStop
Retourniert den Slice mit den Stutzwerten (wird wohl eher fuer Debugging verwendet).
func (*GradientPalette) Name ¶ added in v1.4.1
func (p *GradientPalette) Name() string
func (*GradientPalette) SetColorStop ¶ added in v1.1.0
func (p *GradientPalette) SetColorStop(colStop ColorStop)
Setzt in der Palette einen neuen Stuetzwert. Existiert bereits eine Farbe an dieser Position, wird sie ueberschrieben.
type GridClient ¶ added in v1.4.1
type GridClient interface {
Send(buffer []byte)
NumLeds() int
Gamma() (r, g, b float64)
SetGamma(r, g, b float64)
ModuleConfig() conf.ModuleConfig
Stopwatch() *Stopwatch
Close()
}
Um den clientseitigen Code so generisch wie moeglich zu halten, ist der GridClient als Interface definiert. Aktuell stehen zwei Implementationen am Start:
NetGridClient - Verbindet sich via UDP und RPC mit einem externen
gridController.
FileSaveClient - Schreibt die Bilddaten in ein File, welches dann auf das
System mit dem Grid-Controller kopiert und dort direkt
abgespielt werden kann.
func NewDirectGridClient ¶ added in v1.4.2
func NewDirectGridClient(Disp Displayer) GridClient
func NewFileSaveClient ¶ added in v1.4.1
func NewFileSaveClient(fileName string, modConf conf.ModuleConfig) GridClient
func NewNetGridClient ¶ added in v1.4.1
func NewNetGridClient(host string, network string, port, rpcPort uint) GridClient
type GridServer ¶ added in v1.4.1
type GridServer struct {
Disp Displayer
RecvBytes, SentBytes ByteCount
// contains filtered or unexported fields
}
Der GridServer wird auf jenem Geraet gestartet, an dem das LedGrid via SPI angeschlossen ist oder allenfalls der Emulator laeuft.
func NewGridServer ¶ added in v1.4.1
func NewGridServer(dataPort, rpcPort uint, disp Displayer) *GridServer
Damit wird eine neue Instanz eines GridServers erzeugt. Mit dataPort wird der Port sowohl fuer die UDP-, als auch fuer die TCP-Verbindung angegeben mit mit rpcPort der Port fuer die RPC-Calls. Mit disp wird dem Server ein konkretes, anzeigefaehiges Geraet (sog. Displayer) mitgegeben.
func (*GridServer) Close ¶ added in v1.4.1
func (p *GridServer) Close()
Schliesst die diversen Verbindungen.
func (*GridServer) Gamma ¶ added in v1.4.1
func (p *GridServer) Gamma() (r, g, b float64)
Retourniert die Gamma-Werte fuer die drei Farben.
func (*GridServer) HandleEvents ¶ added in v1.4.1
func (p *GridServer) HandleEvents()
func (*GridServer) HandleMessage ¶ added in v1.4.1
func (p *GridServer) HandleMessage(conn net.Conn)
Dies ist die zentrale Verarbeitungs-Funktion des GridServers. In ihr wird laufend ein Datenpaket via UDP empfangen und die empfangenen Werte auf ein Ausgabegeraet uebertragen (SPI-Bus, Emulation, etc.) Die genaue Konfiguration des LED-Grids (Anordnung der Lichterketten) ist dem GridServer nicht bekannt.
func (*GridServer) HandleTCP ¶ added in v1.4.1
func (p *GridServer) HandleTCP(lsnr *net.TCPListener)
Damit werden Meldungen via TCP empfangen und verarbeitet.
func (*GridServer) ModuleConfig ¶ added in v1.4.1
func (p *GridServer) ModuleConfig() conf.ModuleConfig
func (*GridServer) RPCGamma ¶ added in v1.4.1
func (p *GridServer) RPCGamma(arg int, reply *GammaArg) error
func (*GridServer) RPCModuleConfig ¶ added in v1.4.1
func (p *GridServer) RPCModuleConfig(arg int, reply *ModuleConfigArg) error
func (*GridServer) RPCNumLeds ¶ added in v1.4.1
func (p *GridServer) RPCNumLeds(arg int, reply *NumLedsArg) error
func (*GridServer) RPCSetGamma ¶ added in v1.4.1
func (p *GridServer) RPCSetGamma(arg GammaArg, reply *int) error
func (*GridServer) SetGamma ¶ added in v1.4.1
func (p *GridServer) SetGamma(r, g, b float64)
Setzt die Gamma-Werte fuer die Farben und aktualisiert die Mapping-Tabelle.
func (*GridServer) SetPixelStatus ¶ added in v1.4.1
func (p *GridServer) SetPixelStatus(idx int, stat LedStatusType)
func (*GridServer) Stopwatch ¶ added in v1.4.2
func (p *GridServer) Stopwatch() *Stopwatch
func (*GridServer) ToggleTestPattern ¶ added in v1.4.1
func (p *GridServer) ToggleTestPattern() bool
type Group ¶ added in v1.3.0
type Group struct {
DurationEmbed
// Gibt an, wie oft diese Gruppe wiederholt werden soll.
RepeatCount int
// Liste, der durch diese Gruppe gestarteten Tasks.
Tasks []Task
// contains filtered or unexported fields
}
Eine Gruppe dient dazu, eine Anzahl von Animationen gleichzeitig zu starten. Die Laufzeit der Gruppe ist gleich der laengsten Laufzeit ihrer Animationen oder einer festen Dauer (je nachdem, welche Dauer groesser ist). Die Animationen, welche ueber eine Gruppe gestartet werden, sollten keine Endlos-Animationen sein, da sonst die Laufzeit der Gruppe ebenfalls endlos wird.
func NewGroup ¶ added in v1.3.0
Erstellt eine neue Gruppe, welche die Animationen in [anims] zusammen startet. Per Default ist die Laufzeit der Gruppe gleich der laengsten Laufzeit der hinzugefuegten Animationen.
func (*Group) Continue ¶ added in v1.4.0
func (a *Group) Continue()
Setzt die Ausfuehrung der Gruppe fort.
type Image ¶ added in v1.1.0
type Image struct {
CanvasObjectEmbed
AlignEmbed
PosEmbed
SizeEmbed
AngleEmbed
Img draw.Image
Mask *MyUniform
}
Zur Darstellung von beliebigen Bildern (JPEG, PNG, etc). Wie Pos genau interpretiert wird, ist vom Alignment (wie beim Text) abhaengig. Size ist die Zielgroesse des Bildes auf dem LedGrid, ist per Default (0,0), was soviel wie "verwende Img.Bounds()" bedeutet. Andernfalls wird das Bild bei der Ausgabe entsprechend skaliert.
type IntAnimation ¶ added in v1.4.1
type IntAnimation struct {
GenericAnimation[int]
}
func NewIntAnimation ¶ added in v1.4.1
func NewIntAnimation(valPtr *int, val2 int, dur time.Duration) *IntAnimation
func (*IntAnimation) Tick ¶ added in v1.4.1
func (a *IntAnimation) Tick(t float64)
type IntPosEmbed ¶ added in v1.4.1
func (*IntPosEmbed) PosPtr ¶ added in v1.4.1
func (e *IntPosEmbed) PosPtr() *image.Point
type IntegerPosAnimation ¶ added in v1.4.0
type IntegerPosAnimation struct {
GenericAnimation[image.Point]
}
func NewIntegerPosAnim ¶ added in v1.4.1
func NewIntegerPosAnim(obj IntegerPositionable, val2 image.Point, dur time.Duration) *IntegerPosAnimation
func (*IntegerPosAnimation) Tick ¶ added in v1.4.0
func (a *IntegerPosAnimation) Tick(t float64)
type IntegerPositionable ¶ added in v1.4.1
type Job ¶ added in v1.4.0
Ein Job besitzt alle Eigenschaften und Moeglichkeiten eines Tasks, bietet jedoch zusaetzlich die Moeglichkeit, von aussen bewusst gestoppt zu werden.
type JsonPalette ¶ added in v1.2.0
type JsonPalette struct {
ID int
Name string `json:"Title"`
IsCyclic bool
IsSlice bool
Colors []colors.LedColor
Stops []ColorStop
}
func ReadJsonData ¶ added in v1.2.0
func ReadJsonData(fileName string) []JsonPalette
type LedGrid ¶
type LedGrid struct {
// Groesse des LedGrids. Falls dieses LedGrid Teil eines groesseren
// Panels sein sollte, dann muss Rect.Min nicht unbedingt {0, 0} sein.
Rect image.Rectangle
// Enthaelt die Farbwerte red, green, blue (RGB) fuer jede LED, welche
// das LedGrid ausmachen. Die Reihenfolge entspricht dabei der
// Verkabelung!
Pix []uint8
Client GridClient
// Neu ist das Objekt LedGrid die zentrale steuernde Instanz. Das bedeutet
// dass sowohl AnimationController als auch Canvas(es) hier vermerkt
// sein muessen.
AnimCtrl *AnimationController
// Es koennen eine ganze Reihe von Canvas'es verwendet werden - so um bspw.
// mit mehreren Layern oder Ueberblendungen zu arbeiten. Die Canvas'es
// werden in einer dynamischen Liste verwaltet. Die Darstellung beginnt
// mit dem hintersten Canvas und stellt zuletzt (d.h. zuvorderst) das
// Canvas am Anfang der Liste dar.
CanvasList *list.List
// contains filtered or unexported fields
}
Entspricht dem Bild, welches auf einem LED-Panel angezeigt werden kann. Implementiert die Interfaces image.Image und draw.Image, also die Methoden ColorModel, Bounds, At und Set.
func NewLedGrid ¶
func NewLedGrid(client GridClient, modConf conf.ModuleConfig) *LedGrid
Erstellt ein neues LedGrid-Objekt, welches als Verkabelung modConf hat.
func NewLedGridBySize ¶ added in v1.4.1
func NewLedGridBySize(client GridClient, size image.Point) *LedGrid
Erstellt ein neues LedGrid-Objekt, welches die Groesse size in Anzahl LEDs horizontal, resp. vertikal hat. Die Verkabelung wird vollflaechig und gem. Methode DefaultModuleConfig vorgenommen.
func (*LedGrid) Canvas ¶ added in v1.4.1
Liefert das Canvas-Objekt zurueck, welches fuer den Layer layer definiert ist. Per Default ist nur Layer 0 vorhanden, die Methode bricht ab, wenn es kein Canvas-Objekt zum gewuenschten Layer gibt.
func (*LedGrid) Clear ¶ added in v1.1.0
Mit Clear kann das ganze Grid geloescht, resp. alle LEDs auf die gleiche Farbe gebracht werden. Das Anzeigen, resp. der Refresh des Panel ist Teil dieser Methode.
func (*LedGrid) ColorModel ¶
The following methods implement the draw.Image interface, LedGrid can therefore be used as the destination for all kind of drawings - especially for a call to draw.Draw() in order to compose the data from Canvas objects before sending the picture to a GridClient.
func (*LedGrid) LedColorAt ¶
Dient dem schnelleren Zugriff auf den Farbwert einer bestimmten Zelle, resp. einer bestimmten LED. Analog zu At(), retourniert den Farbwert jedoch als LedColor-Typ.
func (*LedGrid) NewCanvas ¶ added in v1.4.1
Erzeugt ein neues Canvas-Objekt und hanegt es an den Schluss der Liste. Beim Zeichnen geht LedGrid von hinten nach vorne
func (*LedGrid) PixOffset ¶
Damit wird der Offset eines bestimmten Farbwerts innerhalb des Slices Pix berechnet. Dabei wird beruecksichtigt, dass das die LED's im LedGrid schlangenfoermig angeordnet sind, und der Beginn der LED-Kette frei waehlbar in einer Ecke des Panels liegen kann.
func (*LedGrid) SetLedColor ¶
Analoge Methode zu Set(), jedoch ohne zeitaufwaendige Konvertierung.
func (*LedGrid) Show ¶ added in v1.4.1
func (g *LedGrid) Show()
Zeigt den aktuellen Inhalt des Grid auf der beim Erstellen spezifizierten Hardware dar.
func (*LedGrid) StartRefresh ¶ added in v1.4.1
func (g *LedGrid) StartRefresh()
type LedStatusType ¶ added in v1.4.1
type LedStatusType byte
This type has been introduced in order to mark some NeoPixels on the chain as 'ok' (the default), 'defect' or 'missing' (see constants LedOK, LedDefect or LedMissing for more information).
const ( // LedOK is the default state of a NeoPixel. LedOK LedStatusType = iota // NeoPixels with status LedDefect will be blacked out. This means that // the sent color data for this pixel will always be (0,0,0), i.e. black. // This status can be used if a NeoPixel propagates data as expected // but is not able to correctly display its own color. LedDefect // LedMissing can be used, if a NeoPixel does not even propagate data // to NeoPixels further down the chain. Such a pixel has to be cut out // of the chain and the wires need to be shortened. For the time till a // replacement pixel is organized and soldered in, the pixel must have // status LedMissing. LedMissing )
type Line ¶ added in v1.3.0
type Line struct {
CanvasObjectEmbed
PosEmbed
SizeEmbed
AngleEmbed
ColorEmbed
StrokeWidthEmbed
FadeEmbed
}
Fuer Geraden resp. Segmente ist dieser Datentyp vorgesehen, der von Pos nach Pos + Size verlaeuft. Damit das funktioniert, duerfen bei diesem Typ die Koordinaten von Size auch negativ sein. Alternative Definition: ein Segment ist nur durch einen Positionspunkt definiert (entspricht den Koordinaten des Mittelpunktes) plus einer Groesse (Size - wobei nur die X-Koordinate beruecksichtigt wird) und einem Winkel entspricht der Drehung des Segments um den Mittelpunkt.
type ModuleConfigArg ¶ added in v1.4.1
type ModuleConfigArg struct {
ModuleConfig conf.ModuleConfig
}
type MyUniform ¶ added in v1.4.1
func NewMyUniform ¶ added in v1.4.1
func (*MyUniform) ColorModel ¶ added in v1.4.1
type NetGridClient ¶ added in v1.4.1
type NetGridClient struct {
// contains filtered or unexported fields
}
Mit diesem Typ wird die klassische Verwendung auf zwei Nodes realisiert.
func (*NetGridClient) Close ¶ added in v1.4.1
func (p *NetGridClient) Close()
Schliesst die Verbindung zum Controller.
func (*NetGridClient) Gamma ¶ added in v1.4.1
func (p *NetGridClient) Gamma() (r, g, b float64)
func (*NetGridClient) ModuleConfig ¶ added in v1.4.1
func (p *NetGridClient) ModuleConfig() conf.ModuleConfig
func (*NetGridClient) NumLeds ¶ added in v1.4.1
func (p *NetGridClient) NumLeds() int
Die folgenden Methoden verpacken die entsprechenden RPC-Calls zum Grid-Server.
func (*NetGridClient) Send ¶ added in v1.4.1
func (p *NetGridClient) Send(buffer []byte)
Sendet die Bilddaten in der LedGrid-Struktur zum Controller.
func (*NetGridClient) SetGamma ¶ added in v1.4.1
func (p *NetGridClient) SetGamma(r, g, b float64)
func (*NetGridClient) Stopwatch ¶ added in v1.4.2
func (p *NetGridClient) Stopwatch() *Stopwatch
type NormAnimation ¶ added in v1.1.0
type NormAnimation interface {
TimedAnimation
// Init wird vom Animationsframework aufgerufen, wenn diese Animation
// gestartet wird. Wichtig: Wiederholungen und Umkehrungen (AutoReverse)
// zaehlen nicht als Start!
Init()
// In Tick schliesslich ist die eigentliche Animationslogik enthalten.
// Der Parameter t gibt an, wie weit die Animation bereits gelaufen ist.
// t=0: Animation wurde eben gestartet
// t=1: Die Animation ist fertig
Tick(t float64)
}
Jede konkrete Animation (Farben, Positionen, Groessen, etc.) muss das Interface NormAnimation implementieren.
type NormAnimationEmbed ¶ added in v1.4.0
type NormAnimationEmbed struct {
// Falls true, wird die Animation einmal vorwaerts und einmal rueckwerts
// abgespielt.
AutoReverse bool
// Curve bezeichnet eine Interpolationsfunktion, welche einen beliebigen
// Verlauf der Animation erlaubt (Beschleunigung am Anfang, Abbremsen
// gegen Schluss, etc).
Curve AnimationCurve
// Bezeichnet die Anzahl Wiederholungen dieser Animation.
RepeatCount int
// Ueber dieses Embeddable werden Variablen und Methdoden zum Setzen und
// Abfragen der Laufzeit importiert.
DurationEmbed
// Falls die Animation nicht am Anfang starten soll, sondern zu einem
// beliebigen Punkt, setzt man dieses Feld auf einen Wert zwischen 0 und
// 1.
Pos float64
// contains filtered or unexported fields
}
Dieses Embeddable wird von allen Animationen verwendet, welche eine Animation implementieren, die folgende Kriterien aufweist:
- sie hat eine begrenzte Laufzeit (ohne Beruecksichtiung von Umkehrungen und Wiederholungen!)
func (*NormAnimationEmbed) Continue ¶ added in v1.4.0
func (a *NormAnimationEmbed) Continue()
Setzt eine mit [Stop] angehaltene Animation wieder fort.
func (*NormAnimationEmbed) Duration ¶ added in v1.4.0
func (a *NormAnimationEmbed) Duration() time.Duration
Mit Duration wird die gesamte Laufzeit der Animation (als inkl. Umkehrungen und Wiederholungen) ermittelt. Falls die Anzahl Wiederholgungen auf -1 (d.h. Endloswiederholgung) gesetzt ist, liefert Duration die Laufzeit eines Animationszyklus.
func (*NormAnimationEmbed) Extend ¶ added in v1.4.0
func (a *NormAnimationEmbed) Extend(wrapper NormAnimation)
Muss beim Erstellen einer Animation aufgerufen werden, welche dieses Embeddable einbindet.
func (*NormAnimationEmbed) IsRunning ¶ added in v1.4.0
func (a *NormAnimationEmbed) IsRunning() bool
Liefert true, falls die Animation mittels [Stop] angehalten wurde oder falls die Animation zu Ende ist.
func (*NormAnimationEmbed) Start ¶ added in v1.4.0
func (a *NormAnimationEmbed) Start()
func (*NormAnimationEmbed) StartAt ¶ added in v1.4.1
func (a *NormAnimationEmbed) StartAt(t time.Time)
Startet die Animation mit jenen Parametern, die zum Startzeitpunkt aktuell sind. Ist die Animaton bereits am Laufen ist diese Methode ein no-op.
func (*NormAnimationEmbed) Suspend ¶ added in v1.4.1
func (a *NormAnimationEmbed) Suspend()
Haelt die Animation an, laesst sie jedoch in der Animation-Queue der Applikation. Mit [Continue] kann eine gestoppte Animation wieder fortgesetzt werden.
func (*NormAnimationEmbed) TimeInfo ¶ added in v1.4.1
func (a *NormAnimationEmbed) TimeInfo() (start, end time.Time, total float64)
Retourniert einige Werte, welche das Timing der Animation betreffen. Wird wohl eher fuer Debugging verwendet. Ausserdem ist der Zugriff nicht synchronisiert! Passt man nicht auf, kriegt man inkonsistente Angaben.
func (*NormAnimationEmbed) Update ¶ added in v1.4.0
func (a *NormAnimationEmbed) Update(t time.Time) bool
Diese Methode ist fuer die korrekte Abwicklung (Beachtung von Reverse und RepeatCount, etc) einer Animation zustaendig. Wenn die Animation zu Ende ist, retourniert Update false. Der Parameter t ist ein fortlaufender "Point in Time", der fuer das gesamte Animationsframework konsistent ermittelt wird. Nur wenn der AnimationController angehalten wird, stoppt auch diese Zeitbasis.
type NormShaderFunc ¶ added in v1.4.1
type NumLedsArg ¶ added in v1.4.1
type NumLedsArg int
Die folgenden Methoden koennen via RPC vom Client aufgerufen werden.
type PaletteAnimation ¶ added in v1.3.0
type PaletteAnimation struct {
GenericAnimation[colors.LedColor]
// contains filtered or unexported fields
}
Animation fuer einen Farbverlauf ueber die Farben einer Palette.
func NewPaletteAnim ¶ added in v1.4.1
func NewPaletteAnim(obj Colorable, pal ColorSource, dur time.Duration) *PaletteAnimation
func (*PaletteAnimation) Tick ¶ added in v1.3.0
func (a *PaletteAnimation) Tick(t float64)
type PaletteFadeAnimation ¶ added in v1.3.0
type PaletteFadeAnimation struct {
NormAnimationEmbed
Fader *PaletteFader
Val2 ColorSource
ValFunc PaletteFuncType
}
Dies schliesslich ist eine Animation, bei welcher stufenlos von einer Palette auf eine andere umgestellt wird.
func NewPaletteFadeAnim ¶ added in v1.4.3
func NewPaletteFadeAnim(fader *PaletteFader, pal2 ColorSource, dur time.Duration) *PaletteFadeAnimation
func (*PaletteFadeAnimation) Init ¶ added in v1.3.0
func (a *PaletteFadeAnimation) Init()
func (*PaletteFadeAnimation) Tick ¶ added in v1.3.0
func (a *PaletteFadeAnimation) Tick(t float64)
type PaletteFader ¶ added in v1.1.0
type PaletteFader struct {
Pals [2]ColorSource
T float64
// contains filtered or unexported fields
}
Mit diesem Typ kann ein fliessender Uebergang von einer Palette zu einer anderen realisiert werden.
func NewPaletteFader ¶ added in v1.1.0
func NewPaletteFader(pal ColorSource) *PaletteFader
Initialisiert wird der Fader mit der aktuell anzuzeigenden Palette. Der PaletteFader wird anschliessend anstelle der ueblichen Palette verwendet.
func (*PaletteFader) AlphaPtr ¶ added in v1.4.3
func (p *PaletteFader) AlphaPtr() *uint8
func (*PaletteFader) Color ¶ added in v1.1.0
func (p *PaletteFader) Color(v float64) (c colors.LedColor)
Mit dieser Methode wird der aktuelle Farbwert retourniert. Damit implementiert der Fader das ColorSource-Interface und kann als Farbquelle verwendet werden - genau wie anderen Paletten-, resp. Farbtypen.
func (*PaletteFader) Name ¶ added in v1.1.0
func (p *PaletteFader) Name() string
type PaletteFuncType ¶ added in v1.3.0
type PaletteFuncType func() ColorSource
Dies ist ein etwas unbeholfener Versuch, die Zielwerte bestimmter Animationen dynamisch berechnen zu lassen. Alle XXXFuncType sind Funktionstypen fuer einen bestimmten Datentyp, der in den Animationen verwendet wird und dessen dynamische Berechnung Sinn macht.
func RandPalette ¶ added in v1.3.0
func RandPalette() PaletteFuncType
RandPalette liefert eine Funktion, die bei jedem Aufruf eine zufaellig gewaehlte Palette retourniert.
func SeqPalette ¶ added in v1.3.0
func SeqPalette() PaletteFuncType
SeqPalette liefert eine Funktion, die bei jedem Aufruf die naechste Palette als Resultat zurueckgibt.
type Path ¶ added in v1.4.1
Ein Pfad ist im Grunde nichts anderes, als eine Funktion der Form
[0,1] -> (x,y)
type PathAnimation ¶ added in v1.3.0
type PathAnimation struct {
GenericAnimation[geom.Point]
Path Path
}
func NewPathAnim ¶ added in v1.4.1
func NewPathAnim(obj Positionable, path *GeomPath, size geom.Point, dur time.Duration) *PathAnimation
func NewPolyPathAnim ¶ added in v1.4.1
func NewPolyPathAnim(obj Positionable, path *PolygonPath, dur time.Duration) *PathAnimation
func NewPositionAnim ¶ added in v1.4.1
func NewPositionAnim(obj Positionable, val2 geom.Point, dur time.Duration) *PathAnimation
func (*PathAnimation) Tick ¶ added in v1.3.0
func (a *PathAnimation) Tick(t float64)
type PathFunctionType ¶ added in v1.3.0
Im Folgenden sind einige Pfad-generierende Funktionen zusammengestellt, die als Parameter [pathFunc] bei NewPathAnimation verwendet werden können. Eigene Pfad-Funktionen sind ebenfalls möglich, die Bedingungen an eine solche Funktion sind:
- Wird mit einer Fliesskommazahl (t) aufgerufen und retourniert einen 2D-Punkt
- t ist in [0,1]
- f(0) muss (0,0) sein
- max(f(t).X) - min(f(t).X) = 1.0 und max(f(t).Y) - min(f(t).Y) = 1.0 d.h. die generierten Punkte duerfen sowohl in X- als auch in Y-Richtung einen maximalen Abstand von 1.0 haben.
type Pixel ¶ added in v1.3.0
type Pixel struct {
CanvasObjectEmbed
IntPosEmbed
ColorEmbed
FadeEmbed
}
Will man ein einzelnes Pixel exakt an einer LED-Position zeichnen, so eignet sich dieser Typ. Im Gegensatz zu den obigen Typen sind die Koordinaten eines Pixels ganze Zahlen und das Zeichnen erfolgt direkt in die draw.Image Struktur und nicht in gg.Context. Es ist zu beachten, dass bei diesem Typ die Koordinaten von pos als Spalten-, resp. Zeilenindex des Led-Grids interpretiert werden!
type PolygonPath ¶ added in v1.3.0
type PolygonPath struct {
// contains filtered or unexported fields
}
Neben den vorhandenen Pfaden (Kreise, Halbkreise, Viertelkreise) koennen Positions-Animationen auch entlang komplett frei definierten Pfaden erfolgen. Der Schluessel dazu ist der Typ PolygonPath.
func NewPolygonPath ¶ added in v1.3.0
func NewPolygonPath(points ...geom.Point) *PolygonPath
Erstellt ein neues PolygonPath-Objekt und verwendet die Punkte in points als Eckpunkte eines offenen Polygons.
type PosEmbed ¶ added in v1.4.1
Embeddables fuer die einfachere Animation diverser Attribute. Diese Records sind jeweils so aufgebaut, dass ihr Name auf den Namen des Attributes verweist (Bsp: PosEmbed hat ein Feld namens Pos und eine Methode PosPtr(), welche einen Pointer auf das Feld Pos liefert).
type Positionable ¶ added in v1.4.1
Animation fuer das Fahren entlang eines Pfades. Mit fnc kann eine konkrete, Pfad-generierende Funktion angegeben werden. Siehe auch [PathFunction]
type Rectangle ¶ added in v1.3.0
type Rectangle struct {
CanvasObjectEmbed
PosEmbed
SizeEmbed
AngleEmbed
FilledColorEmbed
StrokeWidthEmbed
FillColorFnc string
}
Rectangle ist fuer alle rechteckigen Objekte vorgesehen. Pos bezeichnet den Mittelpunkt des Objektes und Size die Breite, rsep. Hoehe.
func NewRectangle ¶ added in v1.3.0
type RegularPolygon ¶ added in v1.3.0
type RegularPolygon struct {
CanvasObjectEmbed
PosEmbed
SizeEmbed
AngleEmbed
FilledColorEmbed
StrokeWidthEmbed
FillColorFnc string
N int
}
Auch gleichmaessige Polygone duerfen nicht fehlen.
func NewRegularPolygon ¶ added in v1.3.0
Erzeugt ein neues regelmaessiges Polygon mit n Ecken. Mit pos wird der Mittelpunkt des Polygons bezeichnet und size enthaelt die Groesse (d.h. Breite, bzw. Hoehe) des Polygons. Bem: nur die X-Koordinate von size wird beruecksichtigt!
func (*RegularPolygon) Draw ¶ added in v1.3.0
func (p *RegularPolygon) Draw(c *Canvas)
type Rotateable ¶ added in v1.4.1
type Rotateable interface {
AnglePtr() *float64
}
type Sequence ¶ added in v1.3.0
type Sequence struct {
DurationEmbed
// Gibt an, wie oft diese Sequenz wiederholt werden soll.
RepeatCount int
Tasks []Task
// contains filtered or unexported fields
}
Mit einer Sequence lassen sich eine Reihe von Animationen hintereinander ausfuehren. Dabei wird eine nachfolgende Animation erst dann gestartet, wenn die vorangehende beendet wurde.
func NewSequence ¶ added in v1.3.0
Erstellt eine neue Sequenz welche die Animationen in [anims] hintereinander ausfuehrt.
func (*Sequence) Continue ¶ added in v1.4.0
func (a *Sequence) Continue()
Setzt die Ausfuehrung der Sequenz fort.
type Shader ¶ added in v1.1.0
type Shader TimedAnimation
Fuer den klassischen Shader wird pro Pixel folgende Animation gestartet.
type ShaderAnimation ¶ added in v1.3.0
type ShaderAnimation struct {
ValPtr *colors.LedColor
Pal ColorSource
X, Y float64
Fnc NormShaderFunc
// contains filtered or unexported fields
}
func NewShaderAnim ¶ added in v1.4.1
func NewShaderAnim(obj Colorable, pal ColorSource, x, y float64, fnc NormShaderFunc) *ShaderAnimation
func (*ShaderAnimation) Continue ¶ added in v1.3.0
func (a *ShaderAnimation) Continue()
Setzt die Ausfuehrung der Animation fort.
func (*ShaderAnimation) Duration ¶ added in v1.3.0
func (a *ShaderAnimation) Duration() time.Duration
func (*ShaderAnimation) IsRunning ¶ added in v1.4.0
func (a *ShaderAnimation) IsRunning() bool
Liefert den Status der Animation zurueck.
func (*ShaderAnimation) SetDuration ¶ added in v1.3.0
func (a *ShaderAnimation) SetDuration(d time.Duration)
func (*ShaderAnimation) Start ¶ added in v1.3.0
func (a *ShaderAnimation) Start()
func (*ShaderAnimation) StartAt ¶ added in v1.4.1
func (a *ShaderAnimation) StartAt(t time.Time)
Startet die Animation.
func (*ShaderAnimation) Suspend ¶ added in v1.4.1
func (a *ShaderAnimation) Suspend()
Unterbricht die Ausfuehrung der Animation.
type SimpleTask ¶ added in v1.4.1
type SimpleTask struct {
// contains filtered or unexported fields
}
Mit einem Task koennen beliebige Funktionsaufrufe in die Animationsketten aufgenommen werden. Sie koennen beliebig oft gestartet werden. Es empfiehlt sich, nur kurze Aktionen damit zu realisieren (bspw. Setzen von Variablen)
func NewTask ¶ added in v1.4.1
func NewTask(fn func()) *SimpleTask
func (*SimpleTask) Start ¶ added in v1.4.1
func (a *SimpleTask) Start()
func (*SimpleTask) StartAt ¶ added in v1.4.1
func (a *SimpleTask) StartAt(t time.Time)
type SizeAnimation ¶ added in v1.4.1
type SizeAnimation struct {
GenericAnimation[geom.Point]
Path Path
}
func NewSizeAnim ¶ added in v1.4.1
func (*SizeAnimation) Tick ¶ added in v1.4.1
func (a *SizeAnimation) Tick(t float64)
type SlicePalette ¶ added in v1.1.0
Palette mit 256 einzelnen dedizierten Farbwerten - kein Fading oder sonstige Uebergaenge.
func NewSlicePalette ¶ added in v1.1.0
func NewSlicePalette(name string, cl ...colors.LedColor) *SlicePalette
func (*SlicePalette) Color ¶ added in v1.1.0
func (p *SlicePalette) Color(v float64) colors.LedColor
func (*SlicePalette) Name ¶ added in v1.4.1
func (p *SlicePalette) Name() string
type Sprite ¶ added in v1.4.1
type Sprite struct {
Image
NormAnimationEmbed
// contains filtered or unexported fields
}
Mit ImageList (TO DO: besserer Name waere wohl schon Sprite) lassen sich animierte Bildfolgen darstellen. ImageList ist eine Erweiterung des Typs Image. Die einzelnen Bilder koennen entweder ueber die Methode Add oder aus einer BlinkenLight Animation mit der Methode AddBlinkenLight hinzuge- fuegt werden.
func (*Sprite) Add ¶ added in v1.4.1
Fuegt der Liste von Bilern img hinzu, welches fuer die Dauer von dur angezeigt werden soll. Falls dies das erste Bild ist, welches hinzugefuegt wird, dann wird Img und Size auf dieses Bild und auf die Groesse dieses Bildes gesetzt.
func (*Sprite) AddBlinkenLight ¶ added in v1.4.1
func (i *Sprite) AddBlinkenLight(b *BlinkenFile)
type Stopwatch ¶ added in v1.2.0
type Stopwatch struct {
Num int
Total, Max, Min time.Duration
// contains filtered or unexported fields
}
Simple way to measure the number and duration of events, simply by enclose the code to be measured by Start() and Stop().
func NewStopwatch ¶ added in v1.2.0
func NewStopwatch() *Stopwatch
func (*Stopwatch) Avg ¶ added in v1.2.0
Berechnet die durchschnittliche Messdauer (also den Quotienten von Total() / Num()).
func (*Stopwatch) Reset ¶ added in v1.2.0
func (s *Stopwatch) Reset()
Setzt die gemessene Dauer auf 0 und die Anzahl Messungen ebenfalls.
func (*Stopwatch) Start ¶ added in v1.2.0
func (s *Stopwatch) Start()
Starts the stopwatch. If the stopwatch is already running, the previous starting time is cancelled.
type StrokeWidthEmbed ¶ added in v1.4.1
type StrokeWidthEmbed struct {
StrokeWidth float64
}
func (*StrokeWidthEmbed) StrokeWidthPtr ¶ added in v1.4.1
func (e *StrokeWidthEmbed) StrokeWidthPtr() *float64
type StrokeWidtheable ¶ added in v1.4.1
type StrokeWidtheable interface {
StrokeWidthPtr() *float64
}
type Task ¶ added in v1.4.0
Die folgenden Interfaces geben einen guten Ueberblick ueber die Arten von Hintergrundaktivitaeten.
Ein Task hat nur die Moeglichkeit, gestartet zu werden. Anschl. lauft er asynchron ohne weitere Moeglichkeiten der Einflussnahme. Es ist sinnvoll, wenn der Code hinter einem Task so kurz wie moeglich gehalten wird.
type Text ¶ added in v1.1.0
type Text struct {
CanvasObjectEmbed
AlignEmbed
PosEmbed
AngleEmbed
ColorEmbed
FadeEmbed
Text string
// contains filtered or unexported fields
}
Zur Darstellung von Text mit TrueType-Schriften
type TimedAnimation ¶ added in v1.4.1
type Timeline ¶ added in v1.3.0
type Timeline struct {
DurationEmbed
// Gibt an, wie oft diese Timeline wiederholt werden soll.
RepeatCount int
Slots []*TimelineSlot
// contains filtered or unexported fields
}
Mit einer Timeline koennen einzelne oder mehrere Animationen zu bestimmten Zeiten gestartet werden. Die Zeit ist relativ zur Startzeit der Timeline selber zu verstehen. Nach dem Start werden die Animationen nicht mehr weiter kontrolliert.
func NewTimeline ¶ added in v1.3.0
Erstellt eine neue Timeline mit Ausfuehrungsdauer d. Als d kann auch Null angegeben werden, dann ist die Laufzeit der Timeline gleich dem groessten Ausfuehrungszeitpunkt der hinterlegten Animationen.
func (*Timeline) Add ¶ added in v1.3.0
Fuegt der Timeline die Animation anim hinzu mit Ausfuehrungszeitpunkt dt nach Start der Timeline. Im Moment muessen die Animationen noch in der Reihenfolge ihres Ausfuehrungszeitpunktes hinzugefuegt werden.
func (*Timeline) Continue ¶ added in v1.4.0
func (a *Timeline) Continue()
Setzt die Ausfuehrung der Timeline fort.
type TimelineSlot ¶ added in v1.4.0
Interner Typ, mit dem Ausfuehrungszeitpunkt und Animationen festgehalten werden koennen.
type UniformPalette ¶ added in v1.1.0
type UniformPalette struct {
// contains filtered or unexported fields
}
Damit auch einzelne Farben wie Paletten verwendet werden koennen, existiert der Typ UniformPalette. Die Ueberlegungen dazu sind analog zum Typ image.Uniform.
func NewUniformPalette ¶ added in v1.1.0
func NewUniformPalette(name string, color colors.LedColor) *UniformPalette
Erstellt eine neue einfarbige Farbquelle mit gegebenem namen.
func (*UniformPalette) Bounds ¶ added in v1.2.0
func (p *UniformPalette) Bounds() image.Rectangle
func (*UniformPalette) Color ¶ added in v1.1.0
func (p *UniformPalette) Color(v float64) colors.LedColor
Damit wird das ColorSource-Interface implementiert. Der Parameter [v] hat bei dieser Farbquelle keine Bedeutung und wird ignoriert.
func (*UniformPalette) ColorModel ¶ added in v1.2.0
func (p *UniformPalette) ColorModel() color.Model
func (*UniformPalette) Name ¶ added in v1.4.1
func (p *UniformPalette) Name() string
type WS2801 ¶ added in v1.4.1
type WS2801 struct {
DisplayEmbed
// contains filtered or unexported fields
}
Dies ist die Implementation eines Displayers, welcher eine Lichterkette von NeoPixeln mit WS2801 via SPI-Bus auf einem RaspberryPi ansteuert.
func NewWS2801 ¶ added in v1.4.1
func NewWS2801(spiDev string, baud int, modConf conf.ModuleConfig) *WS2801
Erstellt eine neue Instanz. spiDev ist das Device-File des SPI-Buses, baud die Taktrate (in Bit pro Sekunde) und numLeds die Anzahl NeoPixel auf der Lichterkette - ohne die entfernten NeoPixel zu beruecksichtigen.
func (*WS2801) Close ¶ added in v1.4.1
func (p *WS2801) Close()
Schliesst den Displayer, in diesem Fall den SPI-Port.
func (*WS2801) DefaultGamma ¶ added in v1.4.1
Diese Methode gehoert zum Displayer-Interface und retourniert die empfohlenen Gamma-Werte fuer die drei Farbkanaele Rot, Gruen und Blau.
func (*WS2801) Send ¶ added in v1.4.1
Sendet die Farbwerte in buffer via SPI-Bus zur NeoPixel Lichterkette. Die Reihenfolge der Pixel muss bereits vorgaengig der effektiven Verkabelung angepasst worden sein, ebenso die Farbwertkorrektur. Diese Methode wird ueblicherweise vom DisplayEmbed und nicht von Benutzercode aufgerufen.
type WipeDirection ¶ added in v1.4.1
type WipeDirection int
Wipe transitions offer an effect which is very common in film an tv. It gives the illusion of a cover which is pulled away in any of the four possible ways.
const ( WipeL2R WipeDirection = iota WipeR2L WipeT2B WipeB2T )
type WipeTransition ¶ added in v1.4.1
type WipeTransition struct {
NormAnimationEmbed
// contains filtered or unexported fields
}
func NewWipeTransition ¶ added in v1.4.1
func NewWipeTransition(c *Canvas, dir WipeDirection, typ WipeType, d time.Duration) *WipeTransition
func (*WipeTransition) Bounds ¶ added in v1.4.1
func (a *WipeTransition) Bounds() image.Rectangle
func (*WipeTransition) ColorModel ¶ added in v1.4.1
func (a *WipeTransition) ColorModel() color.Model
func (*WipeTransition) Init ¶ added in v1.4.1
func (a *WipeTransition) Init()
func (*WipeTransition) Tick ¶ added in v1.4.1
func (a *WipeTransition) Tick(t float64)
Source Files
¶
- animCtrls.go
- animPaths.go
- animation.go
- blinken.go
- canvas.go
- displayer.go
- filter.go
- fixedFonts.go
- fontDigitsOnly.go
- fontFixed5x7.go
- fontPico3x5.go
- fontPico6x10.go
- fontPico9x15.go
- gridClient-file.go
- gridClient-local.go
- gridClient-tcpip.go
- gridClient.go
- gridServer-raspberry.go
- ledGrid.go
- palette.go
- paletteSetup.go
- stopwatch.go
- transition.go
- ws2801-raspberrypi.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
gridEmulator
command
|
|
|
gridPlotter
command
|
|
|
anim
module
|
|
|
colorEdit
module
|
|
|
gridController
module
|
|
|
gui
module
|
|
|
paletteGui
module
|
|
|
pixelemulator
module
|
|
|
playground
module
|
|