当前位置:网站首页>WPF 关于绘图个人总结
WPF 关于绘图个人总结
2020-11-07 20:58:00 【程序猿欧文】
内容均为个人总结。
如果错误请告知,并多多见谅。
总的来说绘图是分为两个范围,一是形状,二是像素填充。
形状也就是绘制矩形,圆形,复杂组合形状。
像素填充例如图像填充,但更多是位图操作,同样也是可以绘制形状,不过对于形状的填充算法相对很难,是需要独立进行计算。
在WPF中,对应着分为控件绘图,位图操作。
对于简单的绘图我也不多加复述,通常一般的难点,也就是复杂性绘图,大规模绘图等。
一般呢,对于有形状绘图有一下方案
1 直接重载OnRender方法并在内使用DrawingContext进行绘图
2 劫持承载控件,并创建继承DrawingVisual控件,并使用RenderOpen方法进行绘制
3 使用GDI+绘图并配合Bitmap后使用DrawingContext后经行绘图
通常,方法1,可能使用范围过小,方法3呢效果不错,但是放大后效果不好。
所以我们重点说一下方法2
使用方法很简单,主要是里面绘制的方法。
最好的办法就是使用DrawGeometry。
但是问题是是提交多个控件绘图对应内容呢? 还是提交一次后内部多次绘制呢?
举例来说,我之前发的矩形格子,使用的是多次提交,每次提交少量绘制,当绘制大量内容后意味大量提交,大量绘制,虽然单次绘图很快基本0.2毫秒,但架不住多啊,也就造成卡顿。
所以正确的方法应该是少量.........
版权声明
本文为[程序猿欧文]所创,转载请带上原文链接,感谢
https://my.oschina.net/mikeowen/blog/4707704
边栏推荐
猜你喜欢

Git代码提交操作,以及git push提示failed to push some refs'XXX'

Didi's distributed ID generator (tinyid), easy to use

Do not understand the underlying principle of database index? That's because you don't have a B tree in your heart

Web API系列(三)统一异常处理

awk实现类sql的join操作

The samesite problem of cross domain cookie of Chrome browser results in abnormal access to iframe embedded pages

Exception calling 'downloadstring' with '1' arguments: 'operation timed out'

想要忘记以前连接到Mac的WiFi网络,试试这个方法!

三步一坑五步一雷,高速成长下的技术团队怎么带?

Three steps, one pit, five steps and one thunder, how to lead the technical team under the rapid growth?
随机推荐
不要把异常当做业务逻辑,这性能可能你无法承受
sed之查找替换
[random talk] the goal and way of software design
Implementation of multi GPU distributed training with horovod in Amazon sagemaker pipeline mode
What should be considered in the promotion plan outside the station?
DOM节点操作
Huawei HCIA notes
bgfx编译教程
How Facebook open source framework simplifies pytorch experiment
laravel8更新之维护模式改进
C语言Ⅰ博客作业03
GrowingIO 响应式编程探索和实践
MongoDB下,启动服务时,出现“服务没有响应控制功能”解决方法
Annual salary of 900000 programmers is not as good as 3800 civil servants a month? How to choose between stability and high income?
awk实现类sql的join操作
Exception calling 'downloadstring' with '1' arguments: 'operation timed out'
京淘项目day09
Why do we need software engineering -- looking at a simple project
Git code submission operation, and git push prompt failed to push some refs'xxx '
websocket+probuf.原理篇