encodePNG implemented
Fixes #2. Allows passing in an io.Writer to save a PNG.
This commit is contained in:
parent
d4745d7279
commit
93f92929f2
@ -5,6 +5,8 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
"image/draw"
|
||||
"image/png"
|
||||
"io"
|
||||
"math"
|
||||
|
||||
"github.com/golang/freetype/raster"
|
||||
@ -103,6 +105,11 @@ func (dc *Context) SavePNG(path string) error {
|
||||
return SavePNG(path, dc.im)
|
||||
}
|
||||
|
||||
// EncodePNG encodes the image as a PNG and writes it to the provided io.Writer.
|
||||
func (dc *Context) EncodePNG(w io.Writer) error {
|
||||
return png.Encode(w, dc.im)
|
||||
}
|
||||
|
||||
// SetDash sets the current dash pattern to use. Call with zero arguments to
|
||||
// disable dashes. The values specify the lengths of each dash, with
|
||||
// alternating on and off lengths.
|
||||
|
Loading…
Reference in New Issue
Block a user