diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-04-16 14:48:38 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-04-16 14:48:38 +0200 |
commit | 842e3d91b43810385d2942f0b9423fbc3c4ae4b9 (patch) | |
tree | 9e271304e885b39d8a88ba7fefd59d75f7a03623 /testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html | |
parent | 931950a880b3550490422b1855c509be10586858 (diff) | |
parent | 4028f58ce7e9ed54327afc6e2a44f5092005dcda (diff) | |
download | UXP-842e3d91b43810385d2942f0b9423fbc3c4ae4b9.tar UXP-842e3d91b43810385d2942f0b9423fbc3c4ae4b9.tar.gz UXP-842e3d91b43810385d2942f0b9423fbc3c4ae4b9.tar.lz UXP-842e3d91b43810385d2942f0b9423fbc3c4ae4b9.tar.xz UXP-842e3d91b43810385d2942f0b9423fbc3c4ae4b9.zip |
Merge branch 'master' of https://github.com/MoonchildProductions/UXP
Diffstat (limited to 'testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html')
-rw-r--r-- | testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html new file mode 100644 index 000000000..74a00e037 --- /dev/null +++ b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html @@ -0,0 +1,30 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<link rel=match href=drawimage_svg_image_1_ref.html> +<style> + html, body { + margin: 0; + } +</style> +<canvas id="dest" height="100" width="100"></canvas> +<script> + +var sourceWidth = 100; +var sourceHeight = 100; +var smoothingEnabled = false; +var destCanvas = document.getElementById('dest'); +var sourceImg = document.createElementNS('http://www.w3.org/2000/svg', 'image'); +sourceImg.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '../2x2.png'); +sourceImg.width = sourceWidth; +sourceImg.height = sourceHeight; + +sourceImg.onload = function() { + var destCtx = destCanvas.getContext('2d'); + destCtx.fillStyle = "#FF0000"; + destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height); + destCtx.imageSmoothingEnabled = smoothingEnabled; + // 2 arguments, the dest origin is 0,0 + // The source canvas will copied to the 0,0 position of the destination canvas + destCtx.drawImage(sourceImg, 0, 0); +} +</script> |