-
-
Couldn't load subscription status.
- Fork 111
Open
Description
The following program, assuming that I'm understanding things correctly, should create a 100x200 image and draw a triangle in it with vertices at (10,10), (10,190), and (90,190). However, it actually draws at (10,10), (10,11), and (11,11).
package main
import (
"image/png"
"os"
"github.com/tdewolff/canvas"
"github.com/tdewolff/canvas/renderers/rasterizer"
)
func main() {
r := rasterizer.New(100, 200, 1, nil)
c := canvas.NewContext(r)
c.SetCoordSystem(canvas.CartesianIV)
c.SetCoordRect(canvas.Rect{10, 10, 90, 190}, 1, 1)
c.MoveTo(0, 0)
c.LineTo(0, 1)
c.LineTo(1, 1)
c.Close()
c.Fill()
err := png.Encode(os.Stdout, r)
if err != nil {
panic(err)
}
}Changing the calls to
c.LineTo(0, 180)
c.LineTo(80, 180)draws the expected triangle.
Metadata
Metadata
Assignees
Labels
No labels