fogleman / gg

Go Graphics - 2D rendering in Go with a simple API.
https://godoc.org/github.com/fogleman/gg
MIT License
4.43k stars 357 forks source link

Transparant gradient problem #54

Closed FlameInTheDark closed 5 years ago

FlameInTheDark commented 6 years ago

This code

        dc := gg.NewContext(300, 400)
    grad := gg.NewLinearGradient(0, 400, 0, 0)
    grad.AddColorStop(0, color.RGBA{30, 30, 200, 0})
    grad.AddColorStop(1, color.RGBA{30, 30, 200, 255})

    dc.SetFillStyle(grad)
    dc.MoveTo(0, 0)
    dc.LineTo(400, 0)
    dc.LineTo(400, 300)
    dc.LineTo(0, 300)
    dc.ClosePath()
    dc.Fill()

draws this image out

FlameInTheDark commented 5 years ago

I found solution. If i use color.NRGBA{...} instead of color.RGBA{...} it works fine.