mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-17 15:48:17 +01:00
When generating shaded tiles draw to pix buffer directly instead of calling Set() for each pixel. Set resize filter for generating pyramid tiles to Lanczos3 because of better visual results.
This commit is contained in:
parent
0850b69028
commit
90bfc225b8
@ -169,7 +169,7 @@ func fuseTile(scratch *image.RGBA, job *pyramidJob) (err error) {
|
|||||||
draw.Draw(scratch, r, img, sr.Min, 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.Lanczos3)
|
||||||
|
|
||||||
var outFile *os.File
|
var outFile *os.File
|
||||||
if outFile, err = os.Create(job.dst); err != nil {
|
if outFile, err = os.Create(job.dst); err != nil {
|
||||||
|
@ -346,11 +346,20 @@ func (r *Renderer) CreateShadedImage(
|
|||||||
|
|
||||||
stride := pw - width
|
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 z := height - 1; z >= 0; z-- {
|
||||||
for x := 0; x < width; x++ {
|
for x := 0; x < width; x++ {
|
||||||
colIdx := r.cBuffer[ofs]
|
colIdx := r.cBuffer[ofs]
|
||||||
if colIdx < 0 || colIdx >= numCols {
|
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 {
|
} else {
|
||||||
var y, y1, y2 int32
|
var y, y1, y2 int32
|
||||||
y = r.yBuffer[ofs]
|
y = r.yBuffer[ofs]
|
||||||
@ -369,15 +378,16 @@ func (r *Renderer) CreateShadedImage(
|
|||||||
d = 36
|
d = 36
|
||||||
}
|
}
|
||||||
col := colors[colIdx]
|
col := colors[colIdx]
|
||||||
image.Set(x, z, color.RGBA{
|
pix[iofs] = safeColor(int32(col.R) + d)
|
||||||
R: safeColor(int32(col.R) + d),
|
pix[iofs+1] = safeColor(int32(col.G) + d)
|
||||||
G: safeColor(int32(col.G) + d),
|
pix[iofs+2] = safeColor(int32(col.B) + d)
|
||||||
B: safeColor(int32(col.B) + d),
|
pix[iofs+3] = 0xff
|
||||||
A: 0xff})
|
|
||||||
}
|
}
|
||||||
|
iofs += 4
|
||||||
ofs++
|
ofs++
|
||||||
}
|
}
|
||||||
ofs += stride
|
ofs += stride
|
||||||
|
iofs -= istride
|
||||||
}
|
}
|
||||||
return image
|
return image
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user