It is also possible to manipulate bitmaps directly through the
use of the
The target of the manipulation needn't be an actual bitmap. Just as
Flash Player can create a bitmap surface of a display object
automatically, you can create such a surface explicitly. Think of this
process as working with a screenshot. Whether the display object
contains a bitmap or a vector shape is immaterial. You can capture the
bitmap data of that object in either case. Let's start by looking at
creating bitmap data from scratch and highlighting the difference
between bitmap data and a bitmap.
There are two parts to working with a bitmap. One is the bitmap display object, and the other is the bitmap data. Think of the bitmap display object as the picture you see on stage, and the bitmap data as a detailed description of the number of pixels used, their individual colors and alpha values, and so on. You will find out later in this chapter that it is sometimes advantageous to work with bitmap data without ever actually displaying a bitmap.
In the following example, we want to see the fruit of our
labors, so we will work with both elements. The first line of the
script creates a new instance of the
BitmapData class, populating it with
content. The first two parameters sent to the class are the
dimensions of the object, 100 × 100 pixels.
The maximum height and width value of a
BitmapData object is 2880 pixels. If you specify a larger value for either ...