5
我試過四處搜尋,但找不到這個問題的答案:在使用ImageBrush填充矩形而不是創建BitmapImage並設置其源屬性方面有性能改進嗎?BitmapImage與ImageBrush的性能
我要渲染大量的圖像(我們正在努力推動5000),和現在我創造他們這樣說:
<Image x:Name="img" RenderOptions.BitmapScalingMode="LowQuality"
Source="{Binding Path, Converter={StaticResource StringToImageConverter}, ConverterParameter={StaticResource string}}" >
</ext:IdImage>
,並在轉換器:
System.Windows.Media.Imaging.BitmapImage image = new System.Windows.Media.Imaging.BitmapImage();
image.BeginInit();
image.UriSource = new Uri(value as String);
image.DecodePixelWidth = int.Parse((String)parameter);
image.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad;
image.EndInit();
return image;
注意:我必須使用轉換器來設置DecodePixelWidth屬性。
使用ImageBrush根據我讀的內容,我可以凍結畫筆,提高性能,所以我想知道是否應該改變構建圖像的方式。
P.S.圖像不是靜態的,而是被翻譯。
渲染圖像時速度低? 我很慢或者使用ImageBrusch的BitmapImage? – daniele3004 2014-10-23 06:43:20
歡迎來到StackOverflow!請參閱「[應該在標題中包含」標籤「的問題嗎?](http://meta.stackexchange.com/questions/19190/)」,其中的共識是「不,他們不應該」 – 2014-10-23 06:59:44
爲什麼你不自己實施性能基準?只是在說' ... – 2014-10-23 07:00:56