All checks were successful
build rgb-board / build (push) Successful in 7m57s
23 lines
464 B
Go
23 lines
464 B
Go
package main
|
|
|
|
import (
|
|
"bytes"
|
|
b64 "encoding/base64"
|
|
"image"
|
|
|
|
"github.com/disintegration/imaging"
|
|
"github.com/fogleman/gg"
|
|
)
|
|
|
|
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)
|
|
a.ctx.Push()
|
|
a.ctx = gg.NewContext(64, 128)
|
|
}
|