Skip to content Skip to sidebar Skip to footer

Why Changing Canvas Size Resets Its Parameters?

When I change the canvas size, I notice the parameter 'mozImageSmoothingEnabled' is being reset. HTML Your browser don't support canvas. Jav

Solution 1:

Because when you change the canvas width or height parameters, every properties of the attached context are reset to their default.

From specs

When the canvas element is created, and subsequently whenever the width and height attributes are set (whether to a new value or to the previous value), the bitmap and any associated contexts must be cleared back to their initial state and reinitialized with the newly specified coordinate space dimensions.

Post a Comment for "Why Changing Canvas Size Resets Its Parameters?"