【发布时间】:2011-07-07 04:06:04
【问题描述】:
以下是我将图像绘制为边框对象背景的代码。
void DrawImage()
{
MemoryStream ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
System.Windows.Media.Imaging.BitmapImage chartBitmapImage = new System.Windows.Media.Imaging.BitmapImage();
chartBitmapImage.BeginInit();
chartBitmapImage.StreamSource = new MemoryStream(ms.ToArray());
chartBitmapImage.EndInit();
imageBrush.ImageSource = chartBitmapImage;
aBorder.Background = imageBrush;
...
}
上面的 DrawImage() 方法每秒钟调用一次。 所有操作都运行良好,但速度太慢。
我想提高性能。 有什么改进的地方吗? 也许,我想任何 bmp 图像处理方法都比我使用的更好。 帮帮我...
【问题讨论】:
-
您的图像是否在每次绘制时都会发生变化 - 如果没有,为什么不保存并重复使用它(或仅在它发生变化时更新它)?
-
我的图片每秒都在变化。
-
它是否会在一个周期内发生变化(因此您获得的不同图像数量有限),还是每个图像都不同?
标签: wpf performance image bmp