You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rgb-led-board/animateDoorbell.go

23 lines
464 B
Go

9 months ago
package main
import (
"bytes"
b64 "encoding/base64"
"image"
"github.com/disintegration/imaging"
9 months ago
"github.com/fogleman/gg"
9 months ago
)
type Doorbell struct {
image image.Image
}
func loadImage(imgType string, img string, a *Animation) {
baseImage, _ := b64.StdEncoding.DecodeString(img)
bigImage, _, _ := image.Decode(bytes.NewReader(baseImage))
a.doorbell.image = imaging.Resize(bigImage, 64, 64, imaging.Lanczos)
9 months ago
a.ctx.Push()
a.ctx = gg.NewContext(64, 128)
9 months ago
}