Fixed tile fusing.

This commit is contained in:
Sascha L. Teichmann 2014-09-14 23:10:54 +02:00
parent db8c5bd8e0
commit 0850b69028

View File

@ -151,21 +151,22 @@ func loadImage(path string) image.Image {
return img
}
func fuseTile(scratch *image.RGBA, job *pyramidJob) (err error) {
var dps = [4]image.Point{
image.Pt(0, 256),
image.Pt(0, 0),
image.Pt(256, 256),
image.Pt(256, 0)}
var ofs = [4][2]int{
{0, 0},
{0, 256},
{256, 0},
{256, 256}}
func fuseTile(scratch *image.RGBA, job *pyramidJob) (err error) {
for i, path := range job.src {
img := loadImage(path)
draw.Draw(scratch,
image.Rect(ofs[i][0], ofs[i][1], 256, 256),
img, image.ZP, draw.Src)
sr := img.Bounds()
r := sr.Sub(sr.Min).Add(dps[i])
draw.Draw(scratch, r, img, sr.Min, draw.Src)
}
resized := resize.Resize(256, 256, scratch, resize.Bicubic)
@ -184,7 +185,6 @@ func fuseTile(scratch *image.RGBA, job *pyramidJob) (err error) {
out.Flush()
err = outFile.Close()
return
}