y int, c color.Color) {
r, g, b, a := c.RGBA()
r /= 257
g /= 257
b /= 257
a /= 257
pos := (y * LedpanelWidth) + x
img[pos + 0] = r / 257
img[pos + 1] = b / 257
img[pos + 2] = g / 257
img[pos + 3] = a / 257
fmt.Println(x, y, pos, img)
}
Why does the img stay 0 0 0 0 0 0 :C?
IIRC, RGBA() returns uint8 whose max value is 255. You are dividing everything by 257. And r,g,b,a are integers. You are dividing integers with a integer. The end result will be an integer rounded off to a suitable value.
Обсуждают сегодня