Copy link to clipboard
Copied
Hello,
I am trying to import a .png file and break it up into an array of 10x10 pixel blocks, while ignoring the alphas. I have no sample code to analyze, as I am not sure how to begin. Any help would be appreciated. Cheers.
Copy link to clipboard
Copied
use the bitmapdata class'es draw method to create your 10x10 blocks. the draw method has a clip rectangle property ideal for you.
Copy link to clipboard
Copied
FWIW, copypixels is faster than draw(). I'd use draw() to get the entire thing out of the library asset, then copyPixels() to draw each one. However, you may want to rethink if you actually need to store each 10x10 area. It might work just as well to know where they are, then use copyPixels to draw the one you want when you need it.
To find example code, search on Actionscript Blitting or Flash Blitting.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now