How does one load and split a massive image in flash?

旧巷老猫 提交于 2019-12-11 22:23:03

问题


How do you load an image that exceeds the 4096×4096 limitations of flash while splitting it?

Note: This is a direct extension of another question.


回答1:


it must be in a raw format (or compressed with zlib).As you load it (via urlloader or socket) you split the resulting bytearray in chunks and you can populate some pregenerated bitmapdatas with them.Example:you're loading a 5120x5120 raw 24bits img. you load it via urlloader and get its bytearray. then, you create n bitmapdata tiles (10x10 512px side) and n bytearrays(512x512*4).then you cycle the whole stride and put the read data in the bytearray associated to the proper tile. lastly you cycle all tiles and call setPixels for each of them passing the associated buffer as an argumen




回答2:


I've given an answer to such a question here. When loaded to a ByteArray as a bitmap you can split it as you want... Or you can even find/write a C program which does it for you.



来源:https://stackoverflow.com/questions/5583250/how-does-one-load-and-split-a-massive-image-in-flash

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