I don’t know if I really have a good post here, just want to know why a very useful, very powerful class that is in the Flex framework isn’t in Flash’s AS3 classes. For those of you who are Flash users but not Flex developers, you may not really know about this class (good explanation here, at Doug McCune’s blog.), but it acts as a shortcut/helper class to assist you when creating snapshots out of display objects or anything that implements IBitmapDrawable. It’s pretty nice.
One thing that this class does that is especially cool is let you get around the 2880×2880 pixel limit imposed on all Flash display objects, including our good friends Bitmap and BitmapData. I have been working around trying to get higher res images out of some of my comps lately and I have all but given up using Flash for it. Even when you run Flash through as an AIR app, and use sneaky tricks like employing AS3Corelib (which is a great selection of classes, I might add) to encode a container sprite as JPG or PNG and output them as files to your local machine you are still limited to the 2880 ceiling. Now, I have seen explanations on why the limit exists, and yes, it makes sense for web apps, but if you are already creating a signed or even an unsigned app for that matter that has to run as administrator on a machine, I see no reason why the 2880 ceiling exists. With monitors gaining pixels with every generation, I’m sure this will change someday, but hey… I’m impatient. No really, I am… ask my wife.
So then I was doing something like this linked example to get around it. You can use the numbers on your keyboard to move the canvas around. “C” toggles mouse visibility, “1″ moves the sprite back to it’s origin point, “2″ slides everything left by a bunch of pixels (I have a MacBook Pro, so it’s slightly less than 1440), “3″ moves everything to the right by the same amount, “4″ moves everything down by 600, “5″ moves up by 600… you see where I am going with this? I move the canvas, take the screenshot and then stitch them together in Photoshop. This allows me to get a pretty big canvas. But, it’s a pain. To get a 10k x 10k image (something that will give you a nice 2-3 foot size print) takes dozens of images. So I thought back to some stuff I have been playing with in Flex (more on that in an upcoming post) and want to do the same here. But that requires the ImageSnapshot class which is missing from Flash CS3… hmm. How vexing.
So, now, I’m currently planning on making a Flex developed app that will be deployed as AIR that will take an input SWF, allow you to set your dimensions and DPI and then use the imageSnapshot class to get a big fat uncompressed image out of it. ImageSnapshot supports up to 8192×8192 images of around 256meg. Has anyone seen an app like this around already? I certainly don’t like duplicating efforts as free time is at a premium. Thoughts?
Related to this post… I’m getting curiouser and curiouser as to why AIR doesn’t have a PDF encoder (especially since blazePDF is dead and is only AS2). I know I could find some uses for it. Postscript charts and elements from Flex or Flash anyone? Sounds nice. Especially with all the great work being done over at Degrafa, and the rumblings of the mx:Graphics stuff to come in Flex 4.
Posted on April 20, 2008