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 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{ func fuseTile(scratch *image.RGBA, job *pyramidJob) (err error) {
{0, 0},
{0, 256},
{256, 0},
{256, 256}}
for i, path := range job.src { for i, path := range job.src {
img := loadImage(path) img := loadImage(path)
draw.Draw(scratch, sr := img.Bounds()
image.Rect(ofs[i][0], ofs[i][1], 256, 256), r := sr.Sub(sr.Min).Add(dps[i])
img, image.ZP, draw.Src)
draw.Draw(scratch, r, img, sr.Min, draw.Src)
} }
resized := resize.Resize(256, 256, scratch, resize.Bicubic) resized := resize.Resize(256, 256, scratch, resize.Bicubic)
@ -184,7 +185,6 @@ func fuseTile(scratch *image.RGBA, job *pyramidJob) (err error) {
out.Flush() out.Flush()
err = outFile.Close() err = outFile.Close()
return return
} }