draw2d/draw2dkit/draw2dkit_test.go

30 lines
575 B
Go
Raw Permalink Normal View History

2015-08-27 08:40:52 +00:00
package draw2dkit
import (
"image"
"image/color"
"testing"
"github.com/llgcode/draw2d/draw2dimg"
)
func TestCircle(t *testing.T) {
width := 200
height := 200
img := image.NewRGBA(image.Rect(0, 0, width, height))
gc := draw2dimg.NewGraphicContext(img)
gc.SetStrokeColor(color.NRGBA{255, 255, 255, 255})
gc.SetFillColor(color.NRGBA{255, 255, 255, 255})
gc.Clear()
gc.SetStrokeColor(color.NRGBA{255, 0, 0, 255})
gc.SetLineWidth(1)
// Draw a circle
Circle(gc, 100, 100, 50)
gc.Stroke()
2015-08-27 13:50:55 +00:00
draw2dimg.SaveToPngFile("../output/draw2dkit/TestCircle.png", img)
2015-08-27 08:40:52 +00:00
}