Introducing the HTML5 canvas element
W3C community states that the canvas
element and the drawing functions are as follows:
A resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, or other visual images on the fly.
The canvas
element contains context for drawing and the actual graphics and shapes are drawn by the JavaScript drawing API. There is one key difference between using canvas
and the usual HTML DOM elements. Canvas is an immediate mode while DOM is a retained mode. We describe the DOM tree with elements and attributes, and the browser renders and tracks the objects for us. In Canvas, we have to manage all the attributes and rendering ourselves. The browser doesn't keep the information of what we draw. It only keeps the drawn pixel data.