LEDController/internal/patterns/common.go

28 lines
537 B
Go
Raw Permalink Normal View History

package patterns
func Even(number int) bool {
return number %2 == 0
}
func FillPanel(w int, h int, r byte, g byte, b byte) [][]RGBcolor {
grid := make([][]RGBcolor, w)
for i := 0; i < w; i++ {
grid[i] = make([]RGBcolor, h)
}
for x := 0; x < w; x++ {
for y := 0; y < h; y++ {
var rgb [3]byte
rgb[0] = r
rgb[1] = g
rgb[2] = b
grid[x][y] = rgb
}
}
return grid
}
func FillPanelRGB(w int, h int, colour RGBcolor) [][]RGBcolor {
return FillPanel(w,h,colour[0],colour[1],colour[2])
}