RosettaCodeData/Task/Bitmap-Midpoint-circle-algorithm/Go/bitmap-midpoint-circle-algorithm-2.go

22 lines
472 B
Go
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
package main
// Files required to build supporting package raster are found in:
// * This task (immediately above)
// * Bitmap
// * Write a PPM file
import (
"raster"
"fmt"
)
func main() {
b := raster.NewBitmap(400, 300)
b.FillRgb(0xffdf20) // yellow
// large circle, demonstrating clipping to image boundaries
b.CircleRgb(300, 249, 200, 0xff2020) // red
if err := b.WritePpmFile("circle.ppm"); err != nil {
fmt.Println(err)
}
}