In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: Mandelbrot Set Rendering with Pixel Bender

@author kobayashi-taro @ kayac inc.
/**
 * Copyright fatmonk ( http://wonderfl.net/user/fatmonk )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/a3ho
 */

// forked from 9re's Mandelbrot Set Rendering with Pixel Bender
package  
{
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.ShaderJob;
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.events.ShaderEvent;
	import flash.geom.Point;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.utils.ByteArray;
	import flash.utils.getTimer;
	import flash.utils.setTimeout;
	import org.libspark.betweenas3.BetweenAS3;
	/**
	 * @author kobayashi-taro @ kayac inc.
	 */
	public class Mandelbrot extends Sprite
	{
		
		private const WONDERFL:int = 465;
		private var _job:ShaderJob;
		private var _bd:BitmapData;
		private var _timer:int;
		private var _kernel:MandelbrotRenderingKernel;
		private var _images:Array;
		private var _buffers:Array;
		private var _lock:Boolean;
		private var _bufferIndex:int = 0;
		private var _basePoint:Point = new Point(-2.5, -2);
		private var _rectLength:Number = 4.0;
		private var _benchInfo:TextField;
		private var _imageLayer:Sprite;
		
		public function Mandelbrot() 
		{
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			stage.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
			stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
			stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
			stage.addEventListener(Event.MOUSE_LEAVE, onMouseLeave);
			
			addChild(_imageLayer = new Sprite);
			addChild(_benchInfo = new TextField);
			
			_benchInfo.defaultTextFormat = new TextFormat("_sans", 12, 0xffffff);
			_benchInfo.mouseEnabled = _benchInfo.mouseWheelEnabled = _benchInfo.selectable = false;
			_benchInfo.background = true;
			_benchInfo.backgroundColor = 0;
			
			buttonMode = true;
			tabEnabled = false;
			
			_images = [];
			_buffers = [];
			
			var image:Image;
			var bd:BitmapData;
			for (var i:int = 0; i < 2; ++i) {
				_images.push(image = new Image);
				_buffers.push(bd = new BitmapData(WONDERFL, WONDERFL));
				image.bitmapData = bd;
			}
			
			var spMask:Sprite = new Sprite;
			spMask.graphics.beginFill(0);
			spMask.graphics.drawRect(0, 0, WONDERFL, WONDERFL);
			spMask.graphics.endFill();
			mask = spMask;
			
			stage.align = StageAlign.TOP_LEFT;
			stage.scaleMode = StageScaleMode.NO_SCALE;
			
			_bd = new BitmapData(WONDERFL, WONDERFL);
			_kernel = new MandelbrotRenderingKernel;
			
			doJob();
		}
		
		private function onJobComplete($event:ShaderEvent):void 
		{
			_job.removeEventListener(ShaderEvent.COMPLETE, onJobComplete);
			_job = null;
			
			var t:Number = getTimer() - _timer;
			_benchInfo.text = "rendering time: " + t + " ms";
			_benchInfo.width = _benchInfo.textWidth + 4;
			_benchInfo.height = _benchInfo.textHeight + 4;
			
			_lock = false;
			var image:Image;
			_bufferIndex = 1 - _bufferIndex;
			image = getCurrentImage();
			image.x = 0;
			image.y = 0;
			image.scaleX = image.scaleY = 1;
			image.alpha = 0;
			BetweenAS3.to(image, { alpha:1 }, 0.25).play();
			setTimeout(clearBackBuffer, 250);
			image.bitmapData = _bd;
			_imageLayer.addChild(image);
		}
		
		private function clearBackBuffer():void
		{
			_images[1 - _bufferIndex].alpha = 0;
		}
		
		private function doJob():void {
			if (_lock) return;
			
			var image:Image = getCurrentImage();
			_basePoint.x += -image.x * _rectLength / WONDERFL;
			_basePoint.y += -image.y * _rectLength / WONDERFL;
			
			var scale:Number = WONDERFL / _rectLength;
			
			if (_kernel.baseX == _basePoint.x && _kernel.baseY == _basePoint.y && _kernel.scale == scale)
				return;
			
			image.alpha = 0;
			_kernel.basePoint = _basePoint;
			_kernel.scale = scale;
			
			_job = new ShaderJob;
			_job.shader = _kernel;
			_job.width = WONDERFL;
			_job.height = WONDERFL;
			_job.target = _bd;
			_job.addEventListener(ShaderEvent.COMPLETE, onJobComplete);

			//image.visible = false;

			_lock = true;
			_timer = getTimer();
			_job.start();
		}
		
		private function onMouseWheel(e:MouseEvent):void 
		{
			if (_lock) return;
			
			var oldLength:Number = _rectLength;
			var scale:Number = (e.delta > 0) ? 0.625 : 1.6;
			_rectLength *= scale;
			scale = (oldLength - _rectLength) / WONDERFL;
			
			var image:Image = getCurrentImage();
			image.alpha = 0;
			
			_basePoint.x += scale * mouseX;
			_basePoint.y += scale * mouseY;
			
			doJob();
		}
		
		private function onMouseDown(e:MouseEvent):void 
		{
			getCurrentImage().startDrag();
		}
		
		private function onMouseUp(e:MouseEvent):void 
		{
			stopDragging();
		}
		
		private function onMouseLeave(e:Event):void 
		{
			stopDragging();
		}
		
		private function stopDragging():void {
			getCurrentImage().stopDrag();
			doJob();
		}
		
		private function getCurrentImage():Image {
			return _images[_bufferIndex];
		}
	}
}

import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.Shader;
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
import flash.utils.ByteArray;
import mx.utils.Base64Decoder;
import mx.utils.Base64Encoder;

class MandelbrotRenderingKernel extends Shader {
	//[Embed(source="../assets/MandelBrot.pbj", mimeType="application/octet-stream")]
	//private var _kernelByteCode:Class;
	private var _baseX:Number;
	private var _baseY:Number;
	private var _scale:Number;
	
	public function MandelbrotRenderingKernel() {
		var decoder:Base64Decoder = new Base64Decoder;
		decoder.decode(<mandelbrotKernel>
DIGlZaUBAAAApAoARHJhd0NpcmNsZaAMbmFtZXNwYWNlADlyZQCgDHZlbmRvcgA5cmUAoAh2ZXJz
aW9uAAEAoAxkZXNjcmlwdGlvbgBkcndpbmcgY2lyY2xlIHdpdGggc2hhZGVyAKEBAgAADF9PdXRD
b29yZAChAgQBAA9yZX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2AAAAAAAAADYAAAAAAAAANgAA
AAAAAAA2AAAAAAAAADYAAAAAAAAAHQYAgAQAwAAdBgBABACAAB0GACAEAEAAMgUAgD+AAAAdBgAQ
BQAAAB0BAPMGABsA</mandelbrotKernel>);
		super(decoder.drain().readObject());
	}
	
	public function set basePoint(value:Point):void {
		data.basePoint.value[0] = value.x;
		data.basePoint.value[1] = value.y;
		_baseX = value.x;
		_baseY = value.y;
	}
	
	
	public function set scale(value:Number):void 
	{
		_scale = value;
		data.scale.value[0] = value;
	}
	public function get scale():Number { return _scale; }
	
	public function get baseX():Number { return _baseX; }
	
	public function get baseY():Number { return _baseY; }
}

class Image extends Sprite {
	private var _bitmap:Bitmap;
	
	public function Image() {
		addChild(_bitmap = new Bitmap);
	}
	
	public function get bitmapData():BitmapData {
		return _bitmap.bitmapData;
	}
	
	public function set bitmapData(value:BitmapData):void {
		_bitmap.bitmapData = value;
	}
}