HTML and CSS Reference
Playing with Pixels
What's in this chapter?
• Reviewing 2-D Physics
• Reading pixel data from an image and from Canvas
• Writing pixels back to Canvas
Wrox.com Code Downloads for this Chapter
title.cgi?isbn=9781118301326 on the Download Code tab. The code is in the chapter 17 download and individu-
ally named according to the names throughout the chapter.
One of the much-heralded features of the new HTML5 Canvas tag is the capability to access pixel data directly.
So far you haven't played around with pixels, but in this chapter you see what it takes to inspect and manipulate
pixels directly. As a practical application to use pixel data, you build a Lander -style game that involves flying a
ship around a map using small bursts of thruster (see Figure 17-1 ) . But first, this chapter takes a brief diversion
into 2-D physics to get the basis to build Lander.