add IMDraw.Reset

This commit is contained in:
faiface 2017-03-14 22:58:06 +01:00
parent 6292035cb9
commit a3cc6f790e
1 changed files with 14 additions and 5 deletions

View File

@ -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)