我要強制BitmapData
平滑。flex/as3 - 如何強制BitmapData平滑無法繪製
但我不能做BitmapData.draw()
因爲應用程序的性能。
如果我繪製位圖,應用程序將放慢到下一步。 (這是靈活移動)
所以我需要如何強制bitmapData平滑而不重繪bitmapData。
(也,我不能用Bitmap(bitmapData).smoothing
)
我能爲這個怎麼辦?
我要強制BitmapData
平滑。flex/as3 - 如何強制BitmapData平滑無法繪製
但我不能做BitmapData.draw()
因爲應用程序的性能。
如果我繪製位圖,應用程序將放慢到下一步。 (這是靈活移動)
所以我需要如何強制bitmapData平滑而不重繪bitmapData。
(也,我不能用Bitmap(bitmapData).smoothing
)
我能爲這個怎麼辦?
您正在設想平滑bitmapData中像素的唯一方法是通過在BitmapData.Draw()
中將平滑布爾值設置爲true來重新繪製bitmap
容器。
解決方法是在容器Bitmap
上設置smoothing
對象本身,而不是內部bitmapData
。稍後,您可以隨時更新bitmapData,但Bitmap對象將始終被平滑。
邏輯是一樣的東西如下:
var myBMPData : BitmapData = new BitmapData(320, 240);
myBMPData.draw(someThing); //just draw, no smoothing here for BitmapData
var myBMP : Bitmap = new Bitmap(myBitmapData);
myBMP.smoothing = true; //use smoothing on Bitmap that holds bitmapData
addChild(myBMP);
謝謝,但我告訴我,我不能使用Bitmap.smoothing那裏... – idnumberone
不,你說你不能使用(引用)「位圖(bitmapData).smoothing」,它仍然是針對bitmapData本身。如果BMP數據是100w x 100h,則強制CPU處理10000個項目(像素)。我建議'Bitmap.smoothing'僅針對1個項目的CPU努力,並沒有'畫'參與。看起來很奇怪,但事實就是這樣......我甚至在3D圖形軟件中看到它(爲移動選擇了100萬個多邊形=包含相同數百萬個多邊形=快速的慢VS 1組對象)。所以**平滑容器**而不是單個像素(位圖數據)。視覺效果結果是一樣的。 –
顯示**的示例代碼如何重新創建您的問題** ...是否有技術原因或限制,爲什麼你根本不能使用「Bitmap.smoothing」?否則,你必須編寫自己的雙線性濾波器進行平滑處理。嘗試使用一些基於GPU的[** Pixel Bender平滑器**](http://www.smart-page.net/blog/2010/02/21/smartaa-reconstruct-anti-aliasing-with-pixel-bender/ )代碼在你的AS3項目中。在線教程查看如何在AS3代碼中導入PBJ作爲'= new shader()'對象。無論如何,這只是一個例子。 –
嘗試使用紋理和GPU渲染,尋找[八哥框架(https://www.google.com/search?q=as3+starling+smooth+紋理) –