Skip to content

Instantly share code, notes, and snippets.

@JobLeonard
Last active December 10, 2024 13:07
Show Gist options
  • Save JobLeonard/8765ea2a96e2a418b001d9e80be9db82 to your computer and use it in GitHub Desktop.
Save JobLeonard/8765ea2a96e2a418b001d9e80be9db82 to your computer and use it in GitHub Desktop.
Firefox larger than 128px canvas
/*bug-in-github-api-content-can-not-be-empty*/
<canvas width=420 height=220 style="image-rendering:pixelated;width:840px;height:440px"></canvas>
const canvas = document.querySelector("canvas");
const ctx = canvas.getContext("2d");
ctx.fillStyle = "black";
ctx.fillRect(0, 0, 21, 11);
ctx.fillStyle = "white";
ctx.fillRect(1, 1, 9, 9);
ctx.fillRect(11, 1, 9, 9);
ctx.strokeStyle = ctx.fillStyle = "black";
ctx.lineWidth = 1;
ctx.beginPath();
ctx.arc(5.5, 5.5, 2.5, 0, Math.PI * 2);
ctx.fill();
ctx.beginPath();
ctx.arc(5.5, 5.5, 3.5, 0, Math.PI * 2);
ctx.stroke();
ctx.beginPath();
ctx.arc(15.5, 5.5, 2.5, 0, Math.PI * 2);
ctx.fill();
ctx.beginPath();
ctx.arc(16, 6, 3.5, 0, Math.PI * 2);
ctx.stroke();
ctx.imageSmoothingEnabled = false;
ctx.drawImage(canvas, 0, 0, 420 * 20 , 220 * 20)
{"name":"Firefox larger than 128px canvas","settings":{},"filenames":["index.html","index.css","index.js"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment