diff --git a/graphics.go b/graphics.go index 70628056b171fda36d3b175ea4e66b867b966318..7ed1e90364ad84b74e794eed3d1b1f6accd4048d 100644 --- a/graphics.go +++ b/graphics.go @@ -92,11 +92,11 @@ type point struct { type EndShape int const ( - // RoundEndShape is a circular end shape. - RoundEndShape EndShape = iota - // SharpEndShape is a square end shape. - SharpEndShape + SharpEndShape EndShape = iota + + // RoundEndShape is a circular end shape. + RoundEndShape ) // NewIMDraw creates a new empty IMDraw. An optional Picture can be used to draw with a Picture. @@ -108,9 +108,9 @@ func NewIMDraw(pic Picture) *IMDraw { tri: tri, d: Drawer{Triangles: tri, Picture: pic}, } - im.Precision(64) im.SetMatrix(IM) im.SetColorMask(NRGBA{1, 1, 1, 1}) + im.Reset() return im } @@ -120,6 +120,15 @@ func (imd *IMDraw) Clear() { imd.d.Dirty() } +// Reset restores all point properties to defaults and removes all Pushed points. +// +// This does not affect matrix and color mask set by SetMatrix and SetColorMask. +func (imd *IMDraw) Reset() { + imd.points = nil + imd.opts = point{} + imd.Precision(64) +} + // Draw draws all currently drawn shapes inside the IM onto another Target. func (imd *IMDraw) Draw(t Target) { imd.d.Draw(t)