aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/llgcode/draw2d/draw2dkit/draw2dkit_test.go
blob: 09eb0e4e3a452704cb420e6b409d3390c985caf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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()

	draw2dimg.SaveToPngFile("../output/draw2dkit/TestCircle.png", img)
}