mtwebmapper: First version of pyramid tile updater. Needs testing.

This commit is contained in:
Sascha L. Teichmann
2014-09-21 17:30:19 +02:00
parent 4e80236e26
commit c428756beb
4 changed files with 139 additions and 34 deletions

View File

@ -5,11 +5,9 @@
package main
import (
"bufio"
"fmt"
"image"
"image/draw"
"image/png"
"io/ioutil"
"log"
"math"
@ -158,7 +156,7 @@ var dps = [4]image.Point{
image.Pt(256, 256),
image.Pt(256, 0)}
func fuseTile(scratch *image.RGBA, job *pyramidJob) (err error) {
func fuseTile(scratch *image.RGBA, job *pyramidJob) error {
for i, path := range job.src {
@ -172,21 +170,7 @@ func fuseTile(scratch *image.RGBA, job *pyramidJob) (err error) {
resized := resize.Resize(256, 256, scratch, resize.Lanczos3)
var outFile *os.File
if outFile, err = os.Create(job.dst); err != nil {
return
}
out := bufio.NewWriter(outFile)
if err = png.Encode(out, resized); err != nil {
outFile.Close()
return
}
out.Flush()
err = outFile.Close()
return
return common.SaveAsPNG(job.dst, resized)
}
func fuseTiles(jobs chan pyramidJob, done *sync.WaitGroup) {