Saturday, April 14, 2012

ActionScript 3.0 Bitmap Classes: The Bitmap Factory Method At Work

Bitmap Factory Method At WorkBuilding a Bitmap Factory
The idea of taking a perfectly good graphic file and taking it apart and putting it back together again has a surprising appeal. You may wonder why one would want to do that? For me, it’s a chance to explore the Bitmap classes built into ActionScript 3.0 and see if there is some way to manage the pixel set better and learn as much as possible about the behavior of bitmap data, filters and anything else that might be useful for speeding things up.
More importantly for design pattern development is creating bitmap data objects and moving them around between participants in a pattern and making changes and additions to a program. In creating this pattern, I found it relatively easy to create a concrete product class from an abstract class used in loading and changing standard bitmap files into ActionScript 3.0 bitmap code; however, I had to spend some time calling for a bitmap object through a creator. In other words, getting something up on the stage using a Factory Method design pattern was more than just duplicating what I had done before with the Loader class and bitmap graphic files.
To get started, download the files used and take a look at the outcome by pressing the Play button.
play buttondownload this sucker
You will find examples from three types of bitmapped graphics: GIF, JPEG and PNG. Identical code was used to break them into bitmap objects from ActionScript 3.0 classes.
The Bitmap Product
The design participants to see first are the abstract and concrete bitmap products (BitMapProduct, BitMapSam). The abstract class contains the properties used in both loading the bitmaps and working with Bitmap and BitmapData properties and methods. [...]
Read more: ActionScript 3.0 Bitmap Classes: The Bitmap Factory Method At Work

No comments:

Post a Comment