I have a canvas that is mostly filled black but some of the pixels have been turned transparent using the following code where imageData is one transparent pixel32:
const ctx = canvas.getContext("2d");
ctx.putImageData(imageData, x, y);
How can I scale the canvas so that as it's own size grows, the placement of the transparent pixels is also scaled? I suppose this would mean losing some transparent pixels if making the canvas smaller in size and adding some transparent pixels if making the canvas larger in size.
There are a lot of similar questions but none of their answers seem to achieve this functionality.