Added toBitmapData.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@720 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Ray Greenwell
2008-11-24 23:14:33 +00:00
parent 8584678701
commit cecdbfa320
+18
View File
@@ -67,6 +67,24 @@ public class ImageUtil
*/
}
/**
* Takes a BitmapData, Bitmap, or Class that will turn into either, and returns
* a reference to the BitmapData, or returns null.
*/
public static function toBitmapData (spec :*) :BitmapData
{
if (spec is Class) {
spec = new (Class(spec))();
}
if (spec is BitmapData) {
return BitmapData(spec);
} else if (spec is Bitmap) {
return Bitmap(spec).bitmapData;
} else {
return null;
}
}
/**
* Create a minimally-sized "error" BitmapData.
*/