2011-09-27 19 views
1

我需要在託管代碼中使用一些位圖並將它們另存爲PNG文件。我應該使用Microsoft.WindowsAPICodePack.DirectX.WindowsImagingComponent還是System.Windows.Media.Imaging?他們都很相似,我不確定爲什麼我會選擇一個。任何人都可以比較和對比它們嗎?WindowsImagingComponent或System.Windows.Media.Imaging

回答

1

他們都使用WIC,這就是他們如此相似的原因。 Windows API代碼包是退役的內容,因爲它在.NET 3及更高版本上可用,所以您將要使用WPF名稱空間,並且不需要單獨安裝。

+0

您確定API代碼包已被棄用嗎? –

+0

退休與棄用不一樣。它只是不被維護了。 –

0

Microsoft.WindowsAPICodePack.DirectX.WindowsImagingComponent位於Windows API代碼包中,該代碼包是需要構建到應用程序中的源代碼庫。另一方面,.NET Framework中包含System.Windows.Media.Imaging。

如果您沒有其他用途的Windows API代碼包,我會建議使用System.Windows.Media.Imaging。我相信在Windows API代碼包中包含WIC API主要是爲了與代碼包中的DirectX API進行互操作,它們在.NET Framework中沒有等價物。