mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-17 15:48:17 +01:00
Fixed tile fusing.
This commit is contained in:
parent
db8c5bd8e0
commit
0850b69028
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user