You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
507 B

package main
import (
"image/color"
)
func getColor(c color.Color, width, height int) [][][4]uint32 {
var pixelmatrix [][][4]uint32
for x := 0; x < width; x++ {
var xRow [][4]uint32
for y := 0; y < height; y++ {
var pixel [4]uint32
pixel[0], pixel[1], pixel[2], pixel[3] = c.RGBA()
pixel[0] = pixel[0] >>8
pixel[1] = pixel[1] >>8
pixel[2] = pixel[2] >>8
pixel[3] = pixel[3] >>8
xRow = append(xRow, pixel)
}
pixelmatrix = append(pixelmatrix, xRow)
}
return pixelmatrix
}