views:

1390

answers:

1

I'm trying scale up an image in Flash without making it pixelated, I know that I will loose some quality by scaling up, but i'm not trying to scale 6 times bigger or something :)

I tried to use matrix and scale, but the quality is just bad... is there any other ways to do this?


so here's my code,

var _bmpData:BitmapData = new BitmapData( stage.stageWidth, stage.stageHeight, true, 0x00000000 );
var _scale:Number = Math.max(stage.stageWidth/_imageLoad.contentAsBitmap.width, stage.stageHeight/_imageLoad.contentAsBitmap.height)
var _matrix:Matrix = new Matrix();
_matrix.scale(_scale, _scale);

_bmpData.draw( _imageLoad.contentAsBitmap, _matrix, null, null, null, true);

var _bmp:Bitmap = new Bitmap( _bmpData, 'always', true );

The thing is that if I dont use matrix, everything's fine and not pixelated, but if I use matrix to scale, it's pixelated.... is there any way to fix this? thanks

+3  A: 
var myBitmap : Bitmap = new Bitmap(myBitmapData);
myBitmap.smoothing = true;

You can also look at the draw method of the BitmapData class, which has a smoothing parameter. Obviously this isn't going to help with the inherent issues of upresing an image, but it might mitigate them slightly.

Joel Hooks