def filter.subregion
gralha-svg-render@0.1.0.1 · svg.bend:4877
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
4877def filter.subregion(+as: List<&2, XML.Attr>, box: Bounds, viewport: Point) -> Bounds:
4878 Bounds{x0, y0, x1, y1} = box
4879 Point{vw, vh} = viewport
4880 +w = vw
4881 +h = vh
4882 +left = x0
4883 +top = y0
4884 +x = U.branch(F32, Bool.not(U.string.equal(XML.attr.get(as, "x", ""), "")), _ => dimension(as, "x", w, "0"), _ => left)
4885 +y = U.branch(F32, Bool.not(U.string.equal(XML.attr.get(as, "y", ""), "")), _ => dimension(as, "y", h, "0"), _ => top)
4886 Bounds{x, y, (x + U.branch(F32, Bool.not(U.string.equal(XML.attr.get(as, "width", ""), "")), _ => dimension(as, "width", w, "0"), _ => (x1 - left : F32)) : F32), (y + U.branch(F32, Bool.not(U.string.equal(XML.attr.get(as, "height", ""), "")), _ => dimension(as, "height", h, "0"), _ => (y1 - top : F32)) : F32)}