mirror of https://github.com/status-im/resize.git
Change order of fields in filterModel
This commit is contained in:
parent
bf006ca38d
commit
0c69e0e0b7
20
filters.go
20
filters.go
|
@ -46,15 +46,15 @@ func boolToUint(b bool) (i uint) {
|
||||||
|
|
||||||
// describe a resampling filter
|
// describe a resampling filter
|
||||||
type filterModel struct {
|
type filterModel struct {
|
||||||
// for optimized access to image points
|
// resampling is done by convolution with a (scaled) kernel
|
||||||
converter
|
kernel func(float32) float32
|
||||||
|
|
||||||
// instead of blurring an image before downscaling to avoid aliasing,
|
// instead of blurring an image before downscaling to avoid aliasing,
|
||||||
// to filter is scaled by a factor which leads to a similar effect
|
// to filter is scaled by a factor which leads to a similar effect
|
||||||
factor [2]float32
|
factor [2]float32
|
||||||
|
|
||||||
// resampling is done by convolution with a (scaled) kernel
|
// for optimized access to image points
|
||||||
kernel func(float32) float32
|
converter
|
||||||
|
|
||||||
// temporaries used by Interpolate
|
// temporaries used by Interpolate
|
||||||
tempRow, tempCol []colorArray
|
tempRow, tempCol []colorArray
|
||||||
|
@ -112,38 +112,38 @@ func createFilter(img image.Image, factor [2]float32, size int, kernel func(floa
|
||||||
switch img.(type) {
|
switch img.(type) {
|
||||||
default:
|
default:
|
||||||
f = &filterModel{
|
f = &filterModel{
|
||||||
|
kernel, factor,
|
||||||
&genericConverter{img},
|
&genericConverter{img},
|
||||||
factor, kernel,
|
|
||||||
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
||||||
}
|
}
|
||||||
case *image.RGBA:
|
case *image.RGBA:
|
||||||
f = &filterModel{
|
f = &filterModel{
|
||||||
|
kernel, factor,
|
||||||
&rgbaConverter{img.(*image.RGBA)},
|
&rgbaConverter{img.(*image.RGBA)},
|
||||||
factor, kernel,
|
|
||||||
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
||||||
}
|
}
|
||||||
case *image.RGBA64:
|
case *image.RGBA64:
|
||||||
f = &filterModel{
|
f = &filterModel{
|
||||||
|
kernel, factor,
|
||||||
&rgba64Converter{img.(*image.RGBA64)},
|
&rgba64Converter{img.(*image.RGBA64)},
|
||||||
factor, kernel,
|
|
||||||
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
||||||
}
|
}
|
||||||
case *image.Gray:
|
case *image.Gray:
|
||||||
f = &filterModel{
|
f = &filterModel{
|
||||||
|
kernel, factor,
|
||||||
&grayConverter{img.(*image.Gray)},
|
&grayConverter{img.(*image.Gray)},
|
||||||
factor, kernel,
|
|
||||||
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
||||||
}
|
}
|
||||||
case *image.Gray16:
|
case *image.Gray16:
|
||||||
f = &filterModel{
|
f = &filterModel{
|
||||||
|
kernel, factor,
|
||||||
&gray16Converter{img.(*image.Gray16)},
|
&gray16Converter{img.(*image.Gray16)},
|
||||||
factor, kernel,
|
|
||||||
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
||||||
}
|
}
|
||||||
case *image.YCbCr:
|
case *image.YCbCr:
|
||||||
f = &filterModel{
|
f = &filterModel{
|
||||||
|
kernel, factor,
|
||||||
&ycbcrConverter{img.(*image.YCbCr)},
|
&ycbcrConverter{img.(*image.YCbCr)},
|
||||||
factor, kernel,
|
|
||||||
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
make([]colorArray, sizeX), make([]colorArray, sizeY),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue