AS3 BitmapData to byteArray

匿名 (未验证) 提交于 2019-12-03 10:24:21

问题:

I am trying to serialize a Bitmap to store in an XML file. My plan is to turn the BitmapData into a byteArray, but I haven't been able to fine an example of this.

Other suggestions are also welcome.

回答1:

The process should be: BitmapData > ByteArray > Base64 > XML

Use the BitmapData getPixels() method to get a ByteArray of the pixels.

Then you can use something like Hurlant's Base64 encoder to convert it to base 64.

Then going the other way, "unbase64" it, then use BitmapData's setPixels to load it.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!