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:

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

See also

applyFilter (BitmapData.applyFilter method), filters (MovieClip.filters property), cacheAsBitmap (MovieClip.cacheAsBitmap property)

Property summary

Modifiers

Property

Description

 

alpha:Number

The alpha transparency value of the substitute color.

 

bias:Number

Bias to add to the result of the matrix transformation.

 

clamp:Boolean

Indicates whether the image should be clamped.

 

color:Number

The hexadecimal color to substitute for pixels that are off the source image.

 

divisor:Number

The divisor used during matrix transformation.

 

matrix:Array

An array of values used for matrix transformation; returns a copy.

 

matrixX:Number

The x dimension of the matrix (the number of columns in the matrix).

 

matrixY:Number

The y dimension of the matrix (the number of rows in the matrix).

 

preserveAlpha:Boolean

Indicates what the convolution applies to.

Properties inherited from class Object

constructor, __proto__, prototype, __resolve


Constructor summary

Signature

Description

ConvolutionFilter(matrixX:Number, matrixY:Number, matrix:Array, [divisor:Number], [bias:Number], [preserveAlpha:Boolean], [clamp:Boolean], [color:Number], [alpha:Number])

Initializes a ConvolutionFilter instance with the specified parameters.

Method summary

Modifiers

Signature

Description

 

clone() : ConvolutionFilter

Returns a copy of this filter object.

Methods inherited from class BitmapFilter

clone


Methods inherited from class Object

addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch



Version 8