topical media & game development
#graphic-flex-image-effects-07-source-aether-effects-convolution-FindEdgesEffect.ax
#graphic-flex-image-effects-07-source-aether-effects-convolution-FindEdgesEffect.ax
[swf]
[flash]
flex
package aether.effects.convolution {
import aether.utils.Adjustments;
import flash.display.BitmapData;
import flash.geom.Point;
import flash.filters.ColorMatrixFilter;
public class @ax-graphic-flex-image-effects-07-source-aether-effects-convolution-FindEdgesEffect extends ConvolutionEffect {
private var _grayscale:Boolean;
public function @ax-graphic-flex-image-effects-07-source-aether-effects-convolution-FindEdgesEffect(
grayscale:Boolean=false,
blendMode:String=null,
alpha:Number=1
) {
var matrix:Array=[
-1, -1, -1,
-1, 8, -1,
-1, -1, -1
];
super(matrix, 1, 0, blendMode, alpha);
_grayscale = grayscale;
}
override protected function applyEffect(bitmapData:BitmapData):void {
super.applyEffect(bitmapData);
if (_grayscale) {
var gray:ColorMatrixFilter = new ColorMatrixFilter(Adjustments.GRAYSCALE_MATRIX);
bitmapData.applyFilter(bitmapData, bitmapData.rect, new Point(), gray);
}
}
}
}
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.