gg/util.go

27 lines
434 B
Go
Raw Normal View History

2016-02-18 22:02:57 +01:00
package dd
import (
"image"
"image/png"
"os"
"golang.org/x/image/math/fixed"
)
func writeToPNG(path string, im image.Image) error {
file, err := os.Create(path)
if err != nil {
return err
}
defer file.Close()
return png.Encode(file, im)
}
func fp(x, y float64) fixed.Point26_6 {
return fixed.Point26_6{fixed.Int26_6(x * 64), fixed.Int26_6(y * 64)}
}
func fi(x float64) fixed.Int26_6 {
return fixed.Int26_6(x * 64)
}