add IMDraw.Reset
This commit is contained in:
parent
6292035cb9
commit
a3cc6f790e
19
graphics.go
19
graphics.go
|
@ -92,11 +92,11 @@ type point struct {
|
||||||
type EndShape int
|
type EndShape int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// RoundEndShape is a circular end shape.
|
|
||||||
RoundEndShape EndShape = iota
|
|
||||||
|
|
||||||
// SharpEndShape is a square end shape.
|
// 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.
|
// 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,
|
tri: tri,
|
||||||
d: Drawer{Triangles: tri, Picture: pic},
|
d: Drawer{Triangles: tri, Picture: pic},
|
||||||
}
|
}
|
||||||
im.Precision(64)
|
|
||||||
im.SetMatrix(IM)
|
im.SetMatrix(IM)
|
||||||
im.SetColorMask(NRGBA{1, 1, 1, 1})
|
im.SetColorMask(NRGBA{1, 1, 1, 1})
|
||||||
|
im.Reset()
|
||||||
return im
|
return im
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,6 +120,15 @@ func (imd *IMDraw) Clear() {
|
||||||
imd.d.Dirty()
|
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.
|
// Draw draws all currently drawn shapes inside the IM onto another Target.
|
||||||
func (imd *IMDraw) Draw(t Target) {
|
func (imd *IMDraw) Draw(t Target) {
|
||||||
imd.d.Draw(t)
|
imd.d.Draw(t)
|
||||||
|
|
Loading…
Reference in New Issue