fogleman / gg

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

Drawing arguments are not coherent with the standard image library. #151

Closed setanarut closed 2 years ago

setanarut commented 2 years ago

Drawing arguments are not coherent with the standard image library. for example I think it should be like this. Not (x, y , v , v);

package main

import (
    "image"
    "image/color"

    "github.com/fogleman/gg"
)

func main() {
    size := image.Point{256, 128}
    circlePoint := image.Point{100, 100}
    myColor := color.RGBA{43, 128, 3, 1}

    dc := gg.NewContext(size)
    dc.DrawCircle(circlePoint, 400)
    dc.SetRGB(myColor)
    dc.Fill()
    dc.SavePNG("out.png")
}

https://pkg.go.dev/image#Rectangle

type Rectangle struct {
    Min, Max Point
}

https://pkg.go.dev/image/color#RGBA

type RGBA struct {
    R, G, B, A uint8
}

https://pkg.go.dev/image#Point

type Point struct {
    X, Y int
}