util

package
v2.0.2-50+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2015 License: MIT Imports: 17 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

View Source
var R = (255 * math.Log10(2)) / (math.Log10(255))

From https://diarmuid.ie/blog/post/pwm-exponential-led-fading-on-arduino-or-other-platforms

Functions

func ConvertImage

func ConvertImage(image *image.RGBA) []byte

func GetLEDConnection

func GetLEDConnection() (io.ReadWriteCloser, error)

func GetLEDConnectionAtRate

func GetLEDConnectionAtRate(baudRate int) (io.ReadWriteCloser, error)

func ResolveImagePath

func ResolveImagePath(relativePath string) string

resolves a relative image path to a fully qialified path.

func SetImageDir

func SetImageDir(newDir string)

the directory used to resolve the

func WriteLEDMatrix

func WriteLEDMatrix(image *image.RGBA, s io.ReadWriteCloser)

Write an image into the led matrix

Types

type AnimatedImage

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

func LoadGif

func LoadGif(src string) *AnimatedImage

func (*AnimatedImage) GetNextFrame

func (i *AnimatedImage) GetNextFrame() *image.RGBA

func (*AnimatedImage) GetPositionFrame

func (i *AnimatedImage) GetPositionFrame(position float64, blend bool) *image.RGBA

GetPositionFrame returns the frame corresponding to the position given 0....1

type Image

type Image interface {
	GetNextFrame() *image.RGBA
	GetPositionFrame(position float64, blend bool) *image.RGBA
}

func LoadImage

func LoadImage(src string) Image

func LoadJpeg

func LoadJpeg(src string) Image

func LoadPng

func LoadPng(src string) Image

type MaskImage

type MaskImage struct {
	Image Image
}
MaskImage wraps an image so that the red level is used as the transparency.

It allows animated gifs to be used as masks, with 255 levels of alpha.

func (*MaskImage) GetNextFrame

func (i *MaskImage) GetNextFrame() *image.RGBA

func (*MaskImage) GetPositionFrame

func (i *MaskImage) GetPositionFrame(position float64, blend bool) *image.RGBA

type SingleImage

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

func NewSingleImage

func NewSingleImage(frame *image.RGBA) *SingleImage

func NewSingleImageConvert

func NewSingleImageConvert(frame image.Image) *SingleImage

func (*SingleImage) GetNextFrame

func (i *SingleImage) GetNextFrame() *image.RGBA

func (*SingleImage) GetPositionFrame

func (i *SingleImage) GetPositionFrame(position float64, blend bool) *image.RGBA

Jump to

Keyboard shortcuts

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