Svg.image.svg.place: def of gralha-svg-render@0.1.0.1 Import: import gralha-svg-render@0.1.0.1/svg.bend as Svg Lines 3866-3874 of gralha-svg-render@0.1.0.1/svg.bend: https://jend.leeeet.dev/read.txt?path=gralha-svg-render@0.1.0.1/svg.bend&start_line=3866&end_line=3874 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 import gralha-css-style@0.1.0.1/css.bend as CSS def image.svg.place(+as: List<&2, XML.Attr>, +size: Point, +root: XML.Element, expand: List<&2, XML.Element> -> F32 -> F32 -> List<&2, XML.Element>) -> XML.Element: Point{iw, ih} = size +ratio = image.svg.ratio(image.svg.attrs(root)) +metadata = F32.show(iw) ++ " " ++ F32.show(ih) ++ " " ++ F32.show(ratio) +inside = {Con{root, Nil{}} : List<&2, XML.Element>} +styled = {Con{image.svg.normalized(image.svg.root(CSS.css.tree(inside, CSS.css.rules(CSS.css.sheets(inside, iw, ih), iw, ih), Nil{}, Nil{}, 1, 1)), size), Nil{}} : List<&2, XML.Element>} +frame = {Con{XML.Attr{"#image-size", metadata}, Con{XML.Attr{"x", XML.attr.get(as, "x", "0")}, Con{XML.Attr{"y", XML.attr.get(as, "y", "0")}, Con{XML.Attr{"width", XML.attr.get(as, "width", "auto")}, Con{XML.Attr{"height", XML.attr.get(as, "height", "auto")}, Con{XML.Attr{"viewBox", "0 0 " ++ F32.show(iw) ++ " " ++ F32.show(ih)}, Con{XML.Attr{"preserveAspectRatio", U.choose(String, F32.is_gt(ratio, 0.0), XML.attr.get(as, "preserveAspectRatio", "xMidYMid meet"), "none")}, Con{XML.Attr{"overflow", XML.attr.get(as, "overflow", "hidden")}, Nil{}}}}}}}}} : List<&2, XML.Attr>} XML.Element{"#svg-image", Con{XML.Attr{"#image-size", metadata}, as}, Con{XML.Element{"svg", frame, instance.anonymous(expand(styled)(iw)(ih)), ""}, Nil{}}, ""} Uses (19): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.is_gt https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=F32.show https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=String.append https://jend.leeeet.dev/definition.txt?path=gralha-css-style@0.1.0.1/css.bend&name=css.rules https://jend.leeeet.dev/definition.txt?path=gralha-css-style@0.1.0.1/css.bend&name=css.sheets https://jend.leeeet.dev/definition.txt?path=gralha-css-style@0.1.0.1/css.bend&name=css.tree https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=Point https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=image.svg.attrs https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=image.svg.normalized https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=image.svg.ratio https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=image.svg.root https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=instance.anonymous https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=choose https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=Attr https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=Element https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=attr.get