<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #EAE6E0]" height="291" width="420" applicationComplete="init()" viewSourceURL="srcview/index.html"> <mx:Script> <![CDATA[ import com.quasimondo.geom.CoordinateShuffler; private var shuffler:CoordinateShuffler; private var map:BitmapData; private function init():void { map = new BitmapData( img.width, img.height, false, 0 ); img.source = new Bitmap( map ); shuffler = new CoordinateShuffler( img.width, img.height, seed.value, shuffleDepth.value, tableSize.value ); index.maximum = shuffler.maximumIndex - 1; update(); } private function update():void { var point:Point; map.lock(); map.fillRect( map.rect, 0 ); if ( accumulate.selected ) { var pts:Array = shuffler.getCoordinates( int( index.value ) ); for each ( point in pts ) { map.setPixel( point.x, point.y, 0xffffff ); } } else { var minIndex:int = int ( index.value ); var maxIndex:int = minIndex + pixelsPerStep.value; for ( var i:int = minIndex; i < maxIndex; i++ ) { point = shuffler.getCoordinate( i ); map.setPixel( point.x, point.y, 0xffffff ); } } map.unlock(); } ]]> </mx:Script> <mx:Image width="400" height="200" id="img" x="10" y="10"/> <mx:HSlider liveDragging="true" x="10" y="214" width="300" id="index" minimum="0" maximum="0" dataTipPrecision="0" change="update()" height="17" allowTrackClick="true"/> <mx:NumericStepper x="10" y="243" id="seed" minimum="0" maximum="99999999" value="123456" change="shuffler.seed = seed.value; update()" stepSize="1" /> <mx:NumericStepper x="125" y="243" minimum="1" maximum="10" id="shuffleDepth" value="3" width="78" change="shuffler.shuffleDepth = shuffleDepth.value; update()" stepSize="1"/> <mx:NumericStepper x="211" y="243" minimum="1" maximum="500" id="tableSize" value="256" change="shuffler.lookupTableSize = tableSize.value; update()" stepSize="1"/> <mx:Label x="8" y="265" text="RandomSeed" color="#312B2B"/> <mx:Label x="122" y="265" text="Shuffle Count" color="#312B2B"/> <mx:NumericStepper x="322" y="243" minimum="1" maximum="5000" id="pixelsPerStep" value="500" width="88" change="update();" stepSize="25"/> <mx:Label x="322" y="264" text="Pixels per Step" color="#312B2B"/> <mx:Label x="211" y="265" text="Table Size" color="#312B2B"/> <mx:CheckBox x="322" y="215" label="Accumulate" id="accumulate" click="update();"/> </mx:Application>