def clip.reference
gralha-svg-render@0.1.0.1 · svg.bend:2497
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
2497def clip.reference(result: Maybe<&2, XML.Element>, +box: Bounds, +m: Matrix,
2498 build: List<&2, XML.Element> -> Matrix -> Clip) -> Clip:
2499 match result:
2500 case None{}: ClipAll{}
2501 case Some{XML.Element{n, as, kids, txt}}:
2502 +tag = n
2503 +attrs = as
2504 U.branch(Clip, U.string.equal(tag, "clipPath"),
2505 _ => build(Con{XML.Element{tag, attrs, kids, txt}, Nil{}})(matrix.mul(m,
2506 U.choose(Matrix, U.string.equal(XML.attr.get(attrs, "clipPathUnits", "userSpaceOnUse"), "objectBoundingBox"),
2507 gradient.box(box), identity()))), _ => ClipAll{})