HTML and CSS Reference
In-Depth Information
Chapter 17
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 Code Downloads for this Chapter
The code downloads for this chapter are found at
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.
Search WWH ::

Custom Search