fogleman / gg

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

drawing lines without gradiant #107

Open frranck opened 4 years ago

frranck commented 4 years ago

Hello Michael, I'm trying to draw colored polygons but I would need their lines not to have any gradient and only use the color I'm filling them with. Any idea how I could do that? Thanks

    dc := gg.NewContext(160, 200)
    for _, p := range pixels {
        dc.Push()
        dc.MoveTo(p.x1, p.y1)
        dc.LineTo(p.x2, p.y2)
        dc.LineTo(p.x3, p.y3)
        dc.LineTo(p.x4, p.y4)
        dc.ClosePath()
        r, g, b := cp(p.pixelNumber)
        dc.SetRGB255(r, g, b)
        dc.SetLineWidth(1)
        dc.Fill()
        dc.Pop()
        dc.Stroke()
    }