当前位置:网站首页>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
边栏推荐
- When tidb and Flink are combined: efficient and easy to use real-time data warehouse
- PHP安全:变量的前世今生
- What magic things can a line of Python code do?
- 栈-括号的匹配
- go wire 依赖注入入门
- Recommend suicide, openai warns: gpt-3 is too risky for medical purposes
- Don't treat exceptions as business logic, which you can't afford
- 聊一聊数据库中的锁
- What do you think of the most controversial programming ideas?
- use Xunit.DependencyInjection Transformation test project
猜你喜欢
Business Facade 与 Business Rule
Application and principle of handlermethodargumentresolver
Didi's distributed ID generator (tinyid), easy to use
laravel8更新之维护模式改进
DOM node operation
awk实现类sql的join操作
Code Review最佳实践
Insight -- the application of sanet in arbitrary style transfer
The JS solution cannot be executed after Ajax loads HTML
一文详解微服务架构
随机推荐
年薪90万程序员不如月入3800公务员?安稳与高收入,到底如何选择?
阿里terway源码分析
PHP security: the past and present of variables
洞察——风格注意力网络(SANet)在任意风格迁移中的应用
The most hard core of the whole network explains the computer startup process
How to choose a good company
The prediction accuracy of the model is as high as 94%! Using machine learning to solve the 200 billion dollar inventory problem perfectly
Huawei HCIA notes
Recommend suicide, openai warns: gpt-3 is too risky for medical purposes
In the age of screen reading, we suffer from attention deficit syndrome
The JS solution cannot be executed after Ajax loads HTML
bgfx编译教程
Win10官方1909版本无法打开windows安全中心中病毒和威胁防护的实时保护解决方案。
Didi's distributed ID generator (tinyid), easy to use
Git code submission operation, and git push prompt failed to push some refs'xxx '
Reflection on a case of bus card being stolen and swiped
sed之查找替换
如何高效的学习技术
graph generation model
CPU瞒着内存竟干出这种事