topical media & game development

talk show tell print

#graphic-flex-image-effects-07-source-aether-effects-common-ChannelEffect.ax

#graphic-flex-image-effects-07-source-aether-effects-common-ChannelEffect.ax [swf] [flash] flex


  package aether.effects.common {
  
          import aether.effects.ImageEffect;
          import aether.utils.ImageUtil;
          
          import flash.display.BitmapData;
          import flash.display.BitmapDataChannel;
          import flash.geom.Matrix;
          import flash.geom.Point;
          
          public class @ax-graphic-flex-image-effects-07-source-aether-effects-common-ChannelEffect extends ImageEffect {
          
                  private var _effect:ImageEffect;
                  private var _channel:uint;
          
                  public function @ax-graphic-flex-image-effects-07-source-aether-effects-common-ChannelEffect(
                          effect:ImageEffect,
                          channel:uint,
                          blendMode:String=null,
                          alpha:Number=1
                  ) {
                          init(blendMode, alpha);
                          _effect = effect;
                          _channel = channel;
                  }
          
                  override protected function applyEffect(bitmapData:BitmapData):void {
                          var clone:BitmapData = ImageUtil.getChannelData(bitmapData, _channel);
                          _effect.apply(clone);
                          bitmapData.copyChannel(clone, clone.rect, new Point(), _channel, _channel);
                  }
          
          }
          
  }


(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.