def filter.convolution.at
gralha-svg-render@0.1.0.1 · svg.bend:4679
import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
import gralha-image@0.1.0.1/image.bend as Img
4679def filter.convolution.at(+input: FilterInput, +limits: Bounds, +edge: U32, +raster: Raster, p: Point, +linear: Bool) -> Img.Color:
4680 Raster{Point{ox, oy}, step, width, height, depth, stored, pixels} = raster
4681 Point{x, y} = p
4682 +fx = ((x - ox) / step - 0.5 : F32)
4683 +fy = ((y - oy) / step - 0.5 : F32)
4684 +ix = F32.floor(fx)
4685 +iy = F32.floor(fy)
4686 +dx = (fx - ix : F32)
4687 +dy = (fy - iy : F32)
4688 U.branch(Img.Color, F32.is_eq(dy, 0.0), _ => filter.convolution.horizontal(input, limits, edge, ix, iy, dx, linear),
4689 _ => color.mix(filter.convolution.horizontal(input, limits, edge, ix, iy, dx, linear), filter.convolution.horizontal(input, limits, edge, ix, (iy + 1.0 : F32), dx, linear), dy))