Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE HTML>
<html class="reftest-wait">
<script src="svg-image-util.js"></script>
<style>
canvas {
background: blue;
}
</style>
<body>
<script>
let viewBoxesAndWidths = [{viewBox: null, width: "300px"}, {viewBox: "0 0 50 50",width: "200px"}, {viewBox: "0 0 50 20", width: "500px"}];
let promises = [];
for (viewBoxAndWidth of viewBoxesAndWidths) {
// Without a given width the viewBox should be used to determine an aspect
// ratio and that applied to the height gives the width.
promises.push(generateCanvasDrawImageSVG("350", "200", viewBoxAndWidth.width, "200px", viewBoxAndWidth.viewBox));
}
Promise.all(promises).then(() => { document.documentElement.className = "" });
</script>
<!-- Body gets populated by script -->
</body>
</html>