I realize this is an old thread, but I am also trying to pre-process images into a spritesheet as well.

Quote Originally Posted by ColbyCheeze
For instance when you rotate a square the corners will get clipped as it rotates since they go outside of the rect area of the draw.
Quote Originally Posted by Incrue View Post
Them use a bigger rectangle and move the stuff inside
Code:
bmdt[i] = new BitmapData((tclip.width + tclip.width/2),(tclip.height + tclip.height/2), true, 0xFFFFFFFF);
This method will not work. What if my source image is a straight line?

VENGEANCE said he was using Math.max(width*√2, height*√2), but this is not as tight as the bounding square could be. I wrote a script in javascript for Photoshop, (viewable here in plain text, so open in notepad or whatever), that works by basically making the canvas larger than needed, rotating the image 36 times in 10 degree increments, then using the "trim()" function which just trims any excess transparent pixels from the sides of the image.

What I would like to do is create the canvas at the smallest possible size to begin with (because there is no "trim()" function in actionscript 3). I know there has to be some geometric formula for this, because we are basically dealing with a circle/hypotenuse here...

Any ideas?