Fixed polygon filling
This commit is contained in:
@@ -6,14 +6,25 @@ import "image/png"
|
||||
import "git.tebibyte.media/tomo/ggfx"
|
||||
|
||||
func main () {
|
||||
img := image.NewRGBA(image.Rect(0, 0, 800, 600))
|
||||
img := image.NewRGBA(image.Rect(0, 0, 300, 300))
|
||||
canvas := ggfx.Image[uint8] {
|
||||
Pix: img.Pix,
|
||||
Stride: img.Stride,
|
||||
Bounds: img.Rect,
|
||||
Width: 4,
|
||||
}
|
||||
canvas.FillRectangle([]uint8 { 255, 0, 0, 255 }, image.Rect(7, 4, 34, 78))
|
||||
black := []uint8 { 0, 0, 0, 255 }
|
||||
red := []uint8 { 255, 0, 0, 255 }
|
||||
canvas.FillPolygon (
|
||||
black,
|
||||
image.Pt(10, 10),
|
||||
image.Pt(70, 50),
|
||||
image.Pt(20, 70))
|
||||
canvas.StrokePolygon (
|
||||
red, 1,
|
||||
image.Pt(10, 10),
|
||||
image.Pt(70, 50),
|
||||
image.Pt(20, 70))
|
||||
|
||||
file, err := os.Create("TEST.png")
|
||||
if err != nil { panic(err.Error()) }
|
||||
|
||||
Reference in New Issue
Block a user