Hi Nigel,

Thankyou so very very much mate. This really fixed up the colour issues i
was having - really can't thank you enough for pointing this out, it was
eluding me for a long time (and probably would have continued to), but as
soon as you mentioned it, it makes perfect sense of course :)

I owe you a drink whenever you are in Sydney mate :)

cheers,

simran.

On Thu, Jul 7, 2016 at 11:43 AM, Nigel Tao <nigel...@golang.org> wrote:

> On Mon, Jul 4, 2016 at 2:50 PM, simran <simrangamb...@gmail.com> wrote:
> > Interestingly though, when i do a colour swap (without any type casting
> happening now) - the colour problem is still there.
>
> https://github.com/simran91/monkeysee/blob/master/mimage/mimage.go says:
>
> r, g, b, a := colour.RGBA()
> 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)}
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to