package { import aether.effects.ImageEffect; import aether.effects.adjustments.SaturationEffect; import aether.effects.common.CompositeEffect; import aether.effects.filters.BlurEffect; import flash.display.BitmapData; /** * Demonstrates how aether's ImageEffect may be extended to create visual effects. * This effect allows you to use several other subeffects to create a Pointilism effect * by applying a pixel dissolve, saturating the image and blurring the result. */ public class graphic_flex_image_effects_10_Flex_PointillismEffect extends ImageEffect { private var _saturation:Number; private var _lightColor:uint; private var _lightAmount:Number; private var _blurAmount:Number; /** * Constructor. Sets the properties of the effect. * * @param saturation The amount of saturation to apply to the image. * @param lightColor The color of the speckles to use in the dissolve. * @param lightAmount The amount of dissolve to apply to the image. * @param blurAmount The blur amount to apply to the dissolved image. * @param blendMode The blend mode to use when applying the effect. * @param alpha The alpha to use when applying the effect. */ public function graphic_flex_image_effects_10_Flex_PointillismEffect( saturation:Number=2.2, lightColor:uint=0xFFFFFFFA, lightAmount:Number=.33, blurAmount:Number=5, blendMode:String=null, alpha:Number=1 ) { init(blendMode, alpha); _saturation = saturation; _lightColor = lightColor; _lightAmount = lightAmount; _blurAmount = blurAmount; } /** * Applies the effect to the specified image. * * @param bitmapData The image to which to apply the effect. */ override protected function applyEffect(bitmapData:BitmapData):void { new CompositeEffect( [ new SaturationEffect(_saturation), new graphic_flex_image_effects_10_Flex_DissolveEffect(_lightAmount, _lightColor), new BlurEffect(_blurAmount, _blurAmount) ] ).apply(bitmapData); } } }