O'Reilly logo

ActionScript 3.0 Bible by Roger Braunstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required