topical media & game development
#graphic-flex-image-effects-07-source-aether-effects-texture-TextureEffect.ax
#graphic-flex-image-effects-07-source-aether-effects-texture-TextureEffect.ax
[swf]
[flash]
flex
package aether.effects.texture {
import aether.effects.ImageEffect;
import aether.textures.ITexture;
import flash.display.BitmapData;
import flash.display.Shape;
public class @ax-graphic-flex-image-effects-07-source-aether-effects-texture-TextureEffect extends ImageEffect {
private var _texture:ITexture;
public function @ax-graphic-flex-image-effects-07-source-aether-effects-texture-TextureEffect(texture:ITexture, blendMode:String=null, alpha:Number=1) {
init(blendMode, alpha);
_texture = texture;
}
override protected function applyEffect(bitmapData:BitmapData):void {
var pattern:BitmapData = _texture.draw();
var shape:Shape = new Shape();
shape.graphics.beginBitmapFill(pattern);
shape.graphics.drawRect(0, 0, bitmapData.width, bitmapData.height);
shape.graphics.endFill();
bitmapData.draw(shape);
}
}
}
(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.