Chapter 36. Programming Bitmap Graphics
FEATURED CLASSES
flash.display.BitmapData
flash.display.Bitmap
flash.display.IBitmapDrawable
Complementing the vector graphics API described in Chapter 35, "Programming Vector Graphics," Flash Player has an easy-to-use bitmap graphics API. Bitmap graphics are composed of pixels instead of strokes and fills. They are a direct way to work with on-screen graphics. Just as having direct access to binary data opens a whole set of possibilities, direct access to the pixels on-screen means you can display anything you can imagine, or at least anything you can figure out how to code.
Draw bitmap graphics in Flash Player with two classes: BitmapData
and Bitmap
. The BitmapData
class stores image data, but by itself, BitmapData
doesn't display anything. The Bitmap
class is a DisplayObject
that displays the contents of the BitmapData
object associated with it. In other words, BitmapData
is the model and Bitmap
is the view; you need a Bitmap
to display a BitmapData
.
In this chapter you'll see many applications of the bitmap drawing API from the mundane to the magical as you learn how to use the Bitmap
and BitmapData
classes.
Bitmaps and Their Applications
A bitmap is the simplest and most literal representation of an image. Bitmaps store the color of every pixel in the image. They usually do this in some sort of two-dimensional array, so you can access the color of a given pixel by its location in the matrix. Bitmaps in Flash Player store one 32-bit integer value ...
Get ActionScript 3.0 Bible now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.