如何改进 WPF 绘图应用程序?
下面是我绘制图像作为边框对象背景的代码。
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 图像处理方法都是比我使用的更好的解决方案。 帮我...
The belows are my code to draw image as background of border object.
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;
...
}
The above DrawImage() method is called every seconds.
All operation is work well but too slow.
I want to improve the performance.
Is there any point to improve this ?
Maybe, I guess any bmp image processing method is betther solution than I used.
Help me...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)