direct2d
windows direct3d的一个分支,效率比gdi款很多,而且支持硬件加速
参考:https://docs.microsoft.com/zh-cn/windows/win32/direct2d/direct2d-portal?redirectedfrom=MSDN
sdl
支持gpu和cpu,效率很高,cpu绘制百万级的点也很快
https://gitee.com/QiangGeGit/SDL2.git
skia
google的代码需要先下载depot_tool
git clone https://source.codeaurora.org/quic/lc/chromium/tools/depot_tools
google绘图引擎
https://gitee.com/mirrors/skia.git
gitee上的google镜像地址:
https://gitee.com/mirrors_chromium_googlesource
下载依赖库:
python tools/git-sync-deps
skia通过angle支持硬件加速
可以soui的框架中找到skia的模块,项目已经配置好了
piccaso
矢量绘图框架,android中使用较多
agg
功能和gdi相似,效率比gdi高
cairo
矢量图形处理,支持硬件加速,FireFox的绘图引擎
https://gitee.com/mirrors/ocaml-cairo.git
angle
webgl的硬件支持接口
https://gitee.com/de-user/angle.git
vulkan
支持硬件加速和cpu,imgui使用了vulkan的框架绘制2d
wpf
wpf支持硬件加速,使用inkcanvas绘图可以看到gpu使用率还是很高的
下面是使用drawvisual元素,gdi+绘图的代码,wpf使用gdi绘图,元素的渲染使用contentprsent
Random r = new Random();
for (int i = 0; i < 1000; i++)
{
DrawingVisual visual = new DrawingVisual();
using (DrawingContext dc = visual.RenderOpen())
dc.DrawRectangle(new SolidColorBrush(System.Windows.Media.Color.FromArgb(
(byte)(r.NextDouble() * 255), (byte)(r.NextDouble() * 255), (byte)(r.NextDouble() * 255), (byte)(r.NextDouble() * 255))),null,
new Rect(r.NextDouble()*800,r.NextDouble() * 800, r.NextDouble() * 800, r.NextDouble() * 800));
mVisual.Add(visual);
AddVisualChild(visual); //使用onrender的gdi+来加载是cpu,AddVisualChild才是gpu
}
visual的显示需要重载,否则无法显示
protected override int VisualChildrenCount
protected override Visual GetVisualChild(int index)
- wpf把点数据放在path里面gpu绘制(path比较消耗资源,但是效率比gdi高,path成员data一次给1万会很卡,增量加载却不会)
- 图像数据放在drawvisual使用gdi+绘制,绘制好以后gpu管理visual数据
参考:
http://blog.sina.com.cn/s/blog_6cd824cd0102vznh.html