mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-26 05:16:25 +02:00
update all downstream dependencies
no specific features I'm looking to add, just keeping thing up to date. Unit tests and my manual testing seems like everything is still working as expected.
This commit is contained in:
parent
17f19d612f
commit
b5984d2822
25 changed files with 1661 additions and 486 deletions
54
vendor/github.com/disintegration/imaging/effects.go
generated
vendored
54
vendor/github.com/disintegration/imaging/effects.go
generated
vendored
|
|
@ -62,28 +62,22 @@ func blurHorizontal(src *image.NRGBA, kernel []float64) *image.NRGBA {
|
|||
}
|
||||
|
||||
for y := 0; y < height; y++ {
|
||||
|
||||
r, g, b, a := 0.0, 0.0, 0.0, 0.0
|
||||
var r, g, b, a float64
|
||||
for ix := start; ix <= end; ix++ {
|
||||
weight := kernel[absint(x-ix)]
|
||||
i := y*src.Stride + ix*4
|
||||
r += float64(src.Pix[i+0]) * weight
|
||||
g += float64(src.Pix[i+1]) * weight
|
||||
b += float64(src.Pix[i+2]) * weight
|
||||
a += float64(src.Pix[i+3]) * weight
|
||||
wa := float64(src.Pix[i+3]) * weight
|
||||
r += float64(src.Pix[i+0]) * wa
|
||||
g += float64(src.Pix[i+1]) * wa
|
||||
b += float64(src.Pix[i+2]) * wa
|
||||
a += wa
|
||||
}
|
||||
|
||||
r = math.Min(math.Max(r/weightSum, 0.0), 255.0)
|
||||
g = math.Min(math.Max(g/weightSum, 0.0), 255.0)
|
||||
b = math.Min(math.Max(b/weightSum, 0.0), 255.0)
|
||||
a = math.Min(math.Max(a/weightSum, 0.0), 255.0)
|
||||
|
||||
j := y*dst.Stride + x*4
|
||||
dst.Pix[j+0] = uint8(r + 0.5)
|
||||
dst.Pix[j+1] = uint8(g + 0.5)
|
||||
dst.Pix[j+2] = uint8(b + 0.5)
|
||||
dst.Pix[j+3] = uint8(a + 0.5)
|
||||
|
||||
dst.Pix[j+0] = clamp(r / a)
|
||||
dst.Pix[j+1] = clamp(g / a)
|
||||
dst.Pix[j+2] = clamp(b / a)
|
||||
dst.Pix[j+3] = clamp(a / weightSum)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -116,28 +110,22 @@ func blurVertical(src *image.NRGBA, kernel []float64) *image.NRGBA {
|
|||
}
|
||||
|
||||
for x := 0; x < width; x++ {
|
||||
|
||||
r, g, b, a := 0.0, 0.0, 0.0, 0.0
|
||||
var r, g, b, a float64
|
||||
for iy := start; iy <= end; iy++ {
|
||||
weight := kernel[absint(y-iy)]
|
||||
i := iy*src.Stride + x*4
|
||||
r += float64(src.Pix[i+0]) * weight
|
||||
g += float64(src.Pix[i+1]) * weight
|
||||
b += float64(src.Pix[i+2]) * weight
|
||||
a += float64(src.Pix[i+3]) * weight
|
||||
wa := float64(src.Pix[i+3]) * weight
|
||||
r += float64(src.Pix[i+0]) * wa
|
||||
g += float64(src.Pix[i+1]) * wa
|
||||
b += float64(src.Pix[i+2]) * wa
|
||||
a += wa
|
||||
}
|
||||
|
||||
r = math.Min(math.Max(r/weightSum, 0.0), 255.0)
|
||||
g = math.Min(math.Max(g/weightSum, 0.0), 255.0)
|
||||
b = math.Min(math.Max(b/weightSum, 0.0), 255.0)
|
||||
a = math.Min(math.Max(a/weightSum, 0.0), 255.0)
|
||||
|
||||
j := y*dst.Stride + x*4
|
||||
dst.Pix[j+0] = uint8(r + 0.5)
|
||||
dst.Pix[j+1] = uint8(g + 0.5)
|
||||
dst.Pix[j+2] = uint8(b + 0.5)
|
||||
dst.Pix[j+3] = uint8(a + 0.5)
|
||||
|
||||
dst.Pix[j+0] = clamp(r / a)
|
||||
dst.Pix[j+1] = clamp(g / a)
|
||||
dst.Pix[j+2] = clamp(b / a)
|
||||
dst.Pix[j+3] = clamp(a / weightSum)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
@ -171,7 +159,7 @@ func Sharpen(img image.Image, sigma float64) *image.NRGBA {
|
|||
i := y*src.Stride + x*4
|
||||
for j := 0; j < 4; j++ {
|
||||
k := i + j
|
||||
val := int(src.Pix[k]) + (int(src.Pix[k]) - int(blurred.Pix[k]))
|
||||
val := int(src.Pix[k])<<1 - int(blurred.Pix[k])
|
||||
if val < 0 {
|
||||
val = 0
|
||||
} else if val > 255 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue