问题
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