/*** BitmapMirror.as Compiler: Flash CS3 / AS3 Date: 2007/9/28 Author: Sho Hashimoto WebSite: http://shokai.org ***/ package { import flash.display.BitmapData; import flash.geom.*; public class BitmapMirror { public var bmd:BitmapData; private var bmd_mirror:BitmapData; public var threshold; public function BitmapMirror(bmd:BitmapData) { trace("Construct: BitmapMirror"); this.bmd = bmd; bmd_mirror = new BitmapData(bmd.width*2, bmd.height); threshold = bmd.width/2; } public function getBitmapData():BitmapData{ return this.bmd_mirror; } public function process():void { bmd_mirror.copyPixels(bmd, new Rectangle(0,0,threshold,bmd.height), new Point(0,0)); bmd_mirror.fillRect(new Rectangle(threshold*2,0, bmd_mirror.width, bmd_mirror.height), 0xFFFFFFFF); for(var y:int = 0; y < bmd.height;y++){ for(var x:int = threshold; x < threshold*2; x++){ bmd_mirror.setPixel(x, y, bmd.getPixel(threshold-(x-threshold), y)); } } } } }