Svg.bitmap.uri: def of gralha-svg-render@0.1.0.1 Import: import gralha-svg-render@0.1.0.1/svg.bend as Svg Lines 2294-2299 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=2294&end_line=2299 import Base import gralha-text-scan@0.1.0.1/scan.bend as U import gralha-css-style@0.1.0.1/css.bend as CSS import gralha-png-decode@0.1.0.1/png.bend as PNG import gralha-jpeg-decode@0.1.0.1/jpeg.bend as JPEG def bitmap.uri(scan: U.Scan) -> Raster: U.Scan{header, content} = scan +mime = CSS.css.lower(header) +data = content U.branch(Raster, U.prefix(mime, "image/png") || U.prefix(mime, "image/apng"), _ => raster.image(PNG.png.decode(bitmap.bytes(mime, data))), _ => U.branch(Raster, U.prefix(mime, "image/jpeg") || U.prefix(mime, "image/jpg"), _ => raster.image(JPEG.jpeg.decode(bitmap.bytes(mime, data))), _ => bitmap.empty())) Uses (11): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.or https://jend.leeeet.dev/definition.txt?path=gralha-css-style@0.1.0.1/css.bend&name=css.lower https://jend.leeeet.dev/definition.txt?path=gralha-jpeg-decode@0.1.0.1/jpeg.bend&name=jpeg.decode https://jend.leeeet.dev/definition.txt?path=gralha-png-decode@0.1.0.1/png.bend&name=png.decode https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=Raster https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=bitmap.bytes https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=bitmap.empty https://jend.leeeet.dev/definition.txt?path=gralha-svg-render@0.1.0.1/svg.bend&name=raster.image https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=Scan https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=branch https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=prefix