diff --git a/cmd/mtseeder/pyramid.go b/cmd/mtseeder/pyramid.go index 8e62860..23609d0 100644 --- a/cmd/mtseeder/pyramid.go +++ b/cmd/mtseeder/pyramid.go @@ -169,7 +169,7 @@ func fuseTile(scratch *image.RGBA, job *pyramidJob) (err error) { draw.Draw(scratch, r, img, sr.Min, draw.Src) } - resized := resize.Resize(256, 256, scratch, resize.Bicubic) + resized := resize.Resize(256, 256, scratch, resize.Lanczos3) var outFile *os.File if outFile, err = os.Create(job.dst); err != nil { diff --git a/common/renderer.go b/common/renderer.go index 34e9a68..c329bf7 100644 --- a/common/renderer.go +++ b/common/renderer.go @@ -346,11 +346,20 @@ func (r *Renderer) CreateShadedImage( stride := pw - width + istride := image.Stride + 4*width + + iofs := image.PixOffset(0, height-1) + + pix := image.Pix + for z := height - 1; z >= 0; z-- { for x := 0; x < width; x++ { colIdx := r.cBuffer[ofs] if colIdx < 0 || colIdx >= numCols { - image.Set(x, z, background) + pix[iofs] = background.R + pix[iofs+1] = background.G + pix[iofs+2] = background.B + pix[iofs+3] = 0xff } else { var y, y1, y2 int32 y = r.yBuffer[ofs] @@ -369,15 +378,16 @@ func (r *Renderer) CreateShadedImage( d = 36 } col := colors[colIdx] - image.Set(x, z, color.RGBA{ - R: safeColor(int32(col.R) + d), - G: safeColor(int32(col.G) + d), - B: safeColor(int32(col.B) + d), - A: 0xff}) + pix[iofs] = safeColor(int32(col.R) + d) + pix[iofs+1] = safeColor(int32(col.G) + d) + pix[iofs+2] = safeColor(int32(col.B) + d) + pix[iofs+3] = 0xff } + iofs += 4 ofs++ } ofs += stride + iofs -= istride } return image }