Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > DisplacementMapFilter (flash.filters.DisplacementMapFilter) | |||
Object
|
+-flash.filters.BitmapFilter
|
+-flash.filters.DisplacementMapFilter
public class DisplacementMapFilter
extends BitmapFilter
The DisplacementMapFilter class uses the pixel values from the specified BitmapData object (called the displacement map image) to perform a displacement of an object on the Stage, such as a MovieClip instance. You can use this filter to achieve a warped or mottled effect on a BitmapData or MovieClip instance.
The use of filters depends on the object to which you apply the filter.
To apply filters to movie clips at runtime, use the filters property. Setting the filters property of an object does not modify the object and can be undone by clearing the filters property.
To apply filters to BitmapData instances, use the BitmapData.applyFilter() method. Calling applyFilter() on a BitmapData object modifies that BitmapData object and cannot be undone.
You can also apply filter effects to images and video at authoring time. For more information, see your authoring documentation.
If you apply a filter to a movie clip or button, the cacheAsBitmap property of the movie clip or button is set to true. If you clear all filters, the original value of cacheAsBitmap is restored.
The filter uses the following formula:
dstPixel[x, y] = srcPixel[x + ((componentX(x, y) - 128) * scaleX) / 256, y + ((componentY(x, y) - 128) * scaleY) / 256]
where componentX(x, y) gets the componentX color value from the mapBitmap property at (x - mapPoint.x ,y - mapPoint.y).
The map image used by the filter is scaled to match the Stage scaling. It is not scaled in any way when the object itself is scaled.
This filter supports Stage scaling, but not general scaling, rotation, or skewing. If the object itself is scaled (if x-scale and y-scale are not 100%), the filter effect is not scaled. It is scaled only when the Stage is zoomed in.
Here is how the DisplacementMapFilter class works. For each pixel (x,y) in the destination bitmap, the DisplacementMapFilter class does the following:
A filter is not applied if the resulting image would exceed 2880 pixels in width or height. For example, if you zoom in on a large movie clip with a filter applied, the filter is turned off if the resulting image reaches the 2880-pixel limit.
Availability: ActionScript 1.0; Flash Player 8
applyFilter (BitmapData.applyFilter method), filters (MovieClip.filters property), cacheAsBitmap (MovieClip.cacheAsBitmap property)
|
Modifiers |
Property |
Description |
|---|---|---|
|
|
alpha |
Specifies the alpha transparency value to use for out-of-bounds displacements. |
|
|
color |
Specifies what color to use for out-of-bounds displacements. |
|
|
componentX |
Describes which color channel to use in the map image to displace the x result. |
|
|
componentY |
Describes which color channel to use in the map image to displace the y result. |
|
|
mapBitmap |
A BitmapData object containing the displacement map data. |
|
|
mapPoint |
A |
|
|
mode |
The mode for the filter. |
|
|
scaleX |
The multiplier to use to scale the x displacement result from the map calculation. |
|
|
scaleY |
The multiplier to use to scale the y displacement result from the map calculation. |
Properties inherited from class Object
|
Signature |
Description |
|---|---|
|
DisplacementMapFilter |
Initializes a DisplacementMapFilter instance with the specified parameters. |
|
Modifiers |
Signature |
Description |
|---|---|---|
|
|
clone |
Returns a copy of this filter object. |
Methods inherited from class BitmapFilter
Methods inherited from class Object addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch
Version 8
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/8/main/00002169.html
Comments
BukuMartian said on Dec 14, 2005 at 12:38 PM : soulhab said on Nov 1, 2006 at 2:11 PM : No screen name said on May 8, 2007 at 9:04 AM :