You are previewing Introducing HTML5.

Introducing HTML5

Cover of Introducing HTML5 by Remy Sharp... Published by New Riders

Chapter 5 Canvas

Remy Sharp

IF THE VIDEO element is the poster boy of HTML5, the canvas element is definitely the Han Solo of HTML5. It’s one of the larger parts of the HTML5 specification, and in fact the canvas API, the 2D drawing context, has been split into a separate document, though the canvas element itself is still part of the official HTML5 spec.

The canvas element provides an API for 2D drawing—lines, fills, images, text, and so on. If you think back to the days of the version of MS Paint that came with Windows 95, you can imagine some of the functionality. In fact, Paint has been replicated using the canvas element, as shown in Figure 5.1. Drawing applications that aim to become fully fledged vector drawing applications are starting ...

The best content for your career. Discover unlimited learning on demand for around $1/day.