Created
June 23, 2013 14:04
-
-
Save anonymous/5845134 to your computer and use it in GitHub Desktop.
This file contains 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
var bd = Assets.getBitmapData("img/sumachan.png"); | |
var temp:BitmapData = new BitmapData(300, 300, true, 0); | |
temp.copyPixels(bd, new Rectangle(0, 0, 300, 300), new Point(0, 0)); | |
#if flash | |
var data:Data = Tools.build32ARGB(temp.width, temp.height, Bytes.ofData(temp.getPixels(temp.rect))); | |
var bo:BytesOutput = new BytesOutput(); | |
var writer:Writer = new Writer(bo); | |
writer.write(data); | |
var byteArray:ByteArray = bo.getBytes().getData(); | |
var file:flash.net.FileReference = new flash.net.FileReference(); | |
file.save(byteArray, "test.png"); | |
#elseif cpp | |
var byteArray:ByteArray = temp.encode('x'); | |
var file:FileOutput = File.write("test.png", true); | |
file.writeString(byteArray.toString()); | |
#end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment