Skip to content

Instantly share code, notes, and snippets.

@slaskis
Created February 8, 2010 12:38
Show Gist options
  • Save slaskis/298110 to your computer and use it in GitHub Desktop.
Save slaskis/298110 to your computer and use it in GitHub Desktop.
class Test extends flash.display.Sprite {
public function new() {
super();
var bmd = new flash.display.BitmapData( 200 , 200 );
var channels = flash.display.BitmapDataChannel.RED | flash.display.BitmapDataChannel.BLUE;
bmd.perlinNoise(100, 80, 6, Math.floor(Math.random() * 10), false, true, channels, false, null);
var o = new haxe.io.BytesOutput();
var w = new format.jpg.Writer( o );
var data = {
width: bmd.width,
height: bmd.height,
quality: 80.,
pixels: format.tools.Image.getBytesARGB( bmd )
};
w.write( data );
var l = new flash.display.Loader();
l.loadBytes( o.getBytes().getData() );
addChild( l );
}
static function main() {
var t = new Test();
flash.Lib.current.addChild( t );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment