Flash 8 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > ConvolutionFilter (flash.filters.ConvolutionFilter) | |||
Object
|
+-flash.filters.BitmapFilter
|
+-flash.filters.ConvolutionFilter
public class ConvolutionFilter
extends BitmapFilter
The ConvolutionFilter class applies a matrix convolution filter effect. A convolution combines pixels in the input image with neighboring pixels to produce an image. A wide variety of imaging operations can be achieved through convolutions, including blurring, edge detection, sharpening, embossing, and beveling. You can apply this effect on bitmaps and MovieClip instances.
The use of filters depends on the object to which you apply the filter:
filters property. Setting the filters property of an object does not modify the object and can be undone by clearing the filters property.BitmapData.applyFilter() method. Calling applyFilter() on a BitmapData object takes the source BitmapData object and the filter object and generates a filtered image as a result.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.
A matrix convolution is based on an n x m matrix, which describes how a given pixel value in the input image is combined with its neighboring pixel values to produce a resulting pixel value. Each result pixel is determined by applying the matrix to the corresponding source pixel and its neighboring pixels.
For a 3 x 3 matrix convolution, the following formula is used for each independent color channel:
dst (x, y) = ((src (x-1, y-1) * a0 + src(x, y-1) * a1.... src(x, y+1) * a7 + src (x+1,y+1) * a8) / divisor) + bias
When run by a processor that offers SSE (Streaming SIMD Extensions), certain filter specifications perform faster.
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 |
The alpha transparency value of the substitute color. |
|
|
bias |
Bias to add to the result of the matrix transformation. |
|
|
clamp |
Indicates whether the image should be clamped. |
|
|
color |
The hexadecimal color to substitute for pixels that are off the source image. |
|
|
divisor |
The divisor used during matrix transformation. |
|
|
matrix |
An array of values used for matrix transformation; returns a copy. |
|
|
matrixX |
The x dimension of the matrix (the number of columns in the matrix). |
|
|
matrixY |
The y dimension of the matrix (the number of rows in the matrix). |
|
|
preserveAlpha |
Indicates what the convolution applies to. |
Properties inherited from class Object
|
Signature |
Description |
|---|---|
|
ConvolutionFilter |
Initializes a ConvolutionFilter 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