diff --git a/README.md b/README.md index 8dd6cdb..34a1a8e 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ Rotate(angle float64) RotateAbout(angle, x, y float64) Shear(x, y float64) TransformPoint(x, y float64) (tx, ty float64) +InvertY() Push() Pop() ``` diff --git a/context.go b/context.go index bacc9f5..090da64 100644 --- a/context.go +++ b/context.go @@ -257,7 +257,8 @@ func (dc *Context) Fill() { // Convenient Drawing Functions func (dc *Context) Clear() { - draw.Draw(dc.im, dc.im.Bounds(), image.NewUniform(dc.color), image.ZP, draw.Src) + src := image.NewUniform(dc.color) + draw.Draw(dc.im, dc.im.Bounds(), src, image.ZP, draw.Src) } func (dc *Context) DrawLine(x1, y1, x2, y2 float64) { @@ -375,6 +376,11 @@ func (dc *Context) TransformPoint(x, y float64) (tx, ty float64) { return dc.matrix.TransformPoint(x, y) } +func (dc *Context) InvertY() { + dc.Translate(0, float64(dc.height)) + dc.Scale(1, -1) +} + // Stack func (dc *Context) Push() {