diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f12d9c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +TEST.png diff --git a/examples/glaggle/main.go b/examples/glaggle/main.go new file mode 100644 index 0000000..a8816cd --- /dev/null +++ b/examples/glaggle/main.go @@ -0,0 +1,26 @@ +package main + +import "os" +import "image" +import "image/png" +import "git.tebibyte.media/tomo/ggfx" + +func main () { + img := image.NewRGBA(image.Rect(0, 0, 800, 600)) + 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)) + + file, err := os.Create("TEST.png") + if err != nil { panic(err.Error()) } + defer file.Close() + err = png.Encode(file, img) + if err != nil { panic(err.Error()) } + + println("Open TEST.png to see the result.") +} +