-
-
Save alijaya/5845138 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)); | |
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(); | |
#if flash | |
var file:flash.net.FileReference = new flash.net.FileReference(); | |
file.save(byteArray, "test.png"); | |
#elseif cpp | |
var file:FileOutput = File.write("test.png", true); | |
file.writeBytes(bo.getBytes()); | |
#end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment