def filter.morphology

gralha-svg-render@0.1.0.1 · svg.bend:4930

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-xml-doc@0.1.0.1/xml.bend as XML

4930def filter.morphology(+as: List<&2, XML.Attr>, +format: Raster, +input: FilterInput, +units: Matrix, window: FilterWindow, +linear: Bool, +aa: U32) -> Raster:
4931  +values = U.numbers(XML.attr.get(as, "radius", "0"))
4932  +rx = U.max(U.nth(values, 0n, 0.0), 0.0)
4933  +ry = U.max(U.nth(values, 1n, U.nth(values, 0n, 0.0)), 0.0)
4934  +dilate = U.string.equal(XML.attr.get(as, "operator", "erode"), "dilate")
4935  +region = filter.input.region(input)
4936  +first = {FilterInput{filter.draw(format, filter.morphology.axis(matrix.vector(units, Point{rx, 0.0}), raster.scale(format), dilate), input, input, FilterWindow{Bounds{F32.neg(1.0e30), F32.neg(1.0e30), 1.0e30, 1.0e30}, identity(), False{}}, linear, aa), region, False{}, False{}} : FilterInput}
4937  filter.draw(format, filter.morphology.axis(matrix.vector(units, Point{0.0, ry}), raster.scale(format), dilate), first, first, window, linear, aa)

Uses (22)

Used by (1)