AS3的BitmapData到的字节数组数组、字节、BitmapData

由网友(性別女,愛好男。)分享简介:我想序列化的位图存储在XML文件中。我的计划是把的BitmapData成字节数组,但我一直没能罚这样的一个例子。 I am trying to serialize a Bitmap to store in an XML file. My plan is to turn the BitmapData into a by...

我想序列化的位图存储在XML文件中。我的计划是把的BitmapData成字节数组,但我一直没能罚这样的一个例子。

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.

其他建议也欢迎。

推荐答案

这个过程应该是:的BitmapData>的ByteArray>的Base64> XML

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

使用BitmapData的getPixels()方法来获得像素的ByteArray。

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

然后你可以使用像 Hurlant的Base64的 EN codeR将其转换为基础64。

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

然后走另一条路,unbase64,然后使用的BitmapData的的setPixels加载它。

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

阅读全文

相关推荐

最新文章