Skip to content

Commit

Permalink
updated BitmapImage to handle all IBitmapDrawable instances
Browse files Browse the repository at this point in the history
  • Loading branch information
benstucki committed Dec 5, 2011
1 parent af641d7 commit c1c7c5c
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/reflex/graphics/BitmapImage.as
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package reflex.graphics
{
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.IBitmapDrawable;
import flash.display.Loader;
import flash.events.Event;
import flash.geom.Matrix;
Expand Down Expand Up @@ -80,10 +81,19 @@ package reflex.graphics
loader.load(request, new LoaderContext(true));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete, false, 0, true);
} else if (source is Class) {
var display:Bitmap = new (source as Class)();
measured.width = display.width;
measured.height = display.height;
original = display.bitmapData;
var display:Object = new (source as Class)();
if(display is Bitmap) {
//var display:Bitmap = new (source as Class)();
measured.width = display.width;
measured.height = display.height;
original = display.bitmapData;
} else if(display is IBitmapDrawable) {
var bitmap:BitmapData = new BitmapData(display.width, display.height, true, 0);
bitmap.draw(display as IBitmapDrawable);
measured.width = bitmap.width;
measured.height = bitmap.height;
original = bitmap;
}
draw();
} else if (source is BitmapData) {
var bitmapdata:BitmapData = source as BitmapData;
Expand Down

0 comments on commit c1c7c5c

Please sign in to comment.