Nigel Tao
unread,Jul 6, 2016, 9:43:38 PM7/6/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to simran, Matt Harden, Dan Kortschak, golang-nuts
On Mon, Jul 4, 2016 at 2:50 PM, simran <
simran...@gmail.com> wrote:
> Interestingly though, when i do a colour swap (without any type casting happening now) - the colour problem is still there.
column[y] = color.RGBA{uint8(r), uint8(g), uint8(b), uint8(a)}
Don't do that. As
https://blog.golang.org/go-image-package says,
"There are three important subtleties about the return values...
Second, the channels have a 16-bit effective range: 100% red is
represented by RGBA returning an r of 65535, not 255."
Thus, when creating an color.RGBA value, you want the high 8 bits, not
the low 8 bits. That second line should be:
column[y] = color.RGBA{uint8(r>>8), uint8(g>>8), uint8(b>>8), uint8(a>>8)}