Created
February 8, 2010 12:38
-
-
Save slaskis/298110 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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