2009-09-01 196 views
2

我試圖擴大在Flash中的圖像,而不使其像素化的,我知道,我會通過擴大寬鬆一些質量 ,但我並不想擴大6倍大或東西:)如何使用Flash BitmapData在不丟失質量的情況下放大圖像?

我試圖使用矩陣和規模,但質量很差...有沒有其他方法可以做到這一點?


所以這裏是我的代碼,

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); 

的事情是,如果我不使用矩陣,一切都很好,而不是像素化的,但如果我用矩陣規模,它的像素化....是有沒有辦法解決這個問題?謝謝

+0

您完全更改了問題的上下文。你應該接受一個答案,並問一個關於在AS3中縮放矩陣和像素的更具體的問題。要麼是,要麼編輯這個標題以反映新的更具體的問題(但是否定了以前編輯的答案)。 – 2009-09-01 21:30:42

+0

您可能甚至不需要位圖數據...如果您使用加載器加載映像,則可以這樣做: 位圖(loader.content).smoothing = true; for more cae scenarios檢查此: http://stackoverflow.com/questions/1058187/rotation-in-flash-causing-image-borders-to-look-pixely-how-to-fix/1058312#1058312 – Cay 2009-09-02 00:12:51

回答

4
var myBitmap : Bitmap = new Bitmap(myBitmapData); 
myBitmap.smoothing = true; 

你也可以看看BitmapData類的繪製方法,該方法有一個平滑參數。顯然這不會有助於解決圖像上升的固有問題,但它可能會稍微減輕它們。

相關問題