You want to apply a filter to a BitmapData.
Use the applyFilter() method of the BitmapData class, or add a filter to the filters array of the enclosing Bitmap.
As mentioned, there are two methods of applying a filter to a bitmap. The first method is to use the applyFilter() method directly on the BitmapData itself. Like some of the other BitmapData methods, this method is applied to one BitmapData, which is the destination bitmap, and it can take another BitmapData as a source bitmap:
srcBmp is the bitmap
file you want to apply the filter to.
sourceRect is the
specific rectangular area from the source bitmap that you want to
apply the filter to.
destPoint parameter specifies the upper
lefthand point from which the pixels will be affected in the
filter, of course, is
an instance of the BitmapFilter that you want to
You can, of course, apply a filter using the same bitmap as both source and destination. Doing so is considered “destructive,” not because it’s a bad thing but because it permanently changes the bitmap.
The values of each pixel are calculated based on the original content and the filter parameters, and these values overwrite the original pixel data. This is useful in a couple of instances:
If you are sure you will never need to change either the bitmap’s content or the filter itself.
When you have multiple or repeated ...