mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-12-23 16:50:18 +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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user