def filter.morphology.axis

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

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

4923# Rectangular min/max is separable along the transformed primitive axes.
4924# A radius beyond the finite buffer diagonal only visits transparent samples.
4925def filter.morphology.axis(+vector: Point, +step: F32, dilate: Bool) -> FilterOp:
4926  +length = point.distance(vector, Point{0.0, 0.0})
4927  +radius = F32.to_u32(U.clamp(F32.floor((length / step + 0.5 : F32)), 0.0, 2048.0))
4928  FilterMorphology{dilate, radius, point.scale(vector, (step / U.max(length, 0.000001) : F32))}

Uses (12)

Used by (1)