topical media & game development
#graphic-flex-image-effects-07-source-aether-effects-transformations-SimplifyEffect.ax
#graphic-flex-image-effects-07-source-aether-effects-transformations-SimplifyEffect.ax
[swf]
[flash]
flex
package aether.effects.transformations {
import aether.effects.ImageEffect;
import flash.display.BitmapData;
import flash.geom.Matrix;
public class @ax-graphic-flex-image-effects-07-source-aether-effects-transformations-SimplifyEffect extends ImageEffect {
private var _amount:Number;
public function @ax-graphic-flex-image-effects-07-source-aether-effects-transformations-SimplifyEffect(pAmount:Number, blendMode:String=null, alpha:Number=1) {
init(blendMode, alpha);
_amount = pAmount;
}
override protected function applyEffect(bitmapData:BitmapData):void {
var bw:Number = bitmapData.width;
var bh:Number = bitmapData.height;
var w:uint = bw/_amount;
var h:uint = bh/_amount;
var m:Matrix = new Matrix();
m.scale(w/bw, h/bh);
var b:BitmapData = new BitmapData(w, h, true, 0x000000);
b.draw(bitmapData, m);
m = new Matrix();
m.scale(bw/w, bh/h);
bitmapData.draw(b, m);
}
}
}
(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.