hardware

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2019 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	R = iota
	G
	B
	NumBytePixel
)

Red Green Blue an numBytePixel as constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Frame

type Frame interface {
	image.Image
	ToLedStripe() LedStripe
	GetSumHardwarePixel() int
	SetRGBA(x, y int, c color.RGBA)
	Set(x, y int, c color.Color)
	RGBAAt(x, y int) color.RGBA
	GetWidth() int
	GetHeight() int
	// contains filtered or unexported methods
}

Frame is a hardware frame

func NewCopyFrameFromImage

func NewCopyFrameFromImage(other Frame, pictureToCopy *image.RGBA) Frame

NewCopyFrameFromImage creates a new Frame with the reference of Tiles and copies the other image contents into the frame

func NewCopyFrameWithEmptyImage

func NewCopyFrameWithEmptyImage(other Frame) Frame

NewCopyFrameWithEmptyImage creates a new Frame with the reference of Tiles but creates a new image

func NewFrame

func NewFrame(tileConfigs config.TileConfigs) Frame

NewFrame return new Frame

type LedStripe

type LedStripe interface {
	GetBuffer() []uint8
	GetPixelLength() int
	GetColorMap() map[string][]int
	Compare(other LedStripe) *LedStripeCompare
}

LedStripe interface

func NewLedStripe added in v0.1.4

func NewLedStripe(numLed int) LedStripe

NewLedStripe creates a new led stripe buffer

type LedStripeCompare added in v0.1.4

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

LedStripeCompare holds all diffenences between old and new LedStripe buffer

func (*LedStripeCompare) GetFullColor added in v0.1.4

func (l *LedStripeCompare) GetFullColor() Pixel

GetFullColor returns nil when no fullColor is available, otherwise the Pixel

func (*LedStripeCompare) GetOtherDiffPixels added in v0.1.4

func (l *LedStripeCompare) GetOtherDiffPixels() []int

GetOtherDiffPixels returns the slice of changed pixels

func (*LedStripeCompare) HasChanged added in v0.1.4

func (l *LedStripeCompare) HasChanged() bool

HasChanged returns true when a change happened

type Pixel

type Pixel interface {
	color.Color
	Equals(color.Color) bool
	Slice() []uint8
	Int() int
	Hex() string
}

Pixel interface implements color interface

func NewPixelFromColor added in v0.1.4

func NewPixelFromColor(c color.Color) Pixel

NewPixelFromColor creates a new rgb byte struct from color.Color

func NewPixelFromHex added in v0.1.4

func NewPixelFromHex(hex string) (Pixel, error)

NewPixelFromHex parses a "html" hex color-string, either in the 3 "#f0c" or 6 "#ff1034" digits form.

func NewPixelFromInt

func NewPixelFromInt(c int) Pixel

NewPixelFromInt creates a new rgb byte struct from integer

func NewPixelFromInts

func NewPixelFromInts(r, g, b uint32) Pixel

NewPixelFromInts creates a new rgb byte struct from single ints

func NewPixelFromSlice

func NewPixelFromSlice(s []uint8, pos int) Pixel

NewPixelFromSlice creates a new rgb byte struct from uint8 slice

type Tile

type Tile interface {
	MapTilePixelToStripePosition(tilePixel image.Point) int
	MapTilePositionToStipePosition(tileXYPos int) int
	Bounds() image.Rectangle
	NumHardwarePixel() int
	FramePoint(tilePoint image.Point) image.Point
	GetWidth() int
	GetHeight() int
}

Tile hardware interface

func NewTile

func NewTile(tileConfig config.TileConfig, numPreviousLedsOnStripe int) Tile

NewTile creates a new Tile

Jump to

Keyboard shortcuts

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