Added toBitmapData.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@720 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -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.
|
* Create a minimally-sized "error" BitmapData.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user