首页 > 解决方案 > 在 GTK3 中在屏幕上绘制自定义内容的替代方法?

问题描述

我只知道一种在屏幕上绘制自定义内容的方法 - GTKDrawArea using Cairo

这就是我所做的: 在此处输入图像描述 除了每秒完全重绘屏幕 60 次之外,还有其他方法可以归档这样的东西吗?如果没有,是否存在优化选项(例如使用图层,因此不会在每帧重绘网格或一次渲染整个方案然后将其移动)?

编辑:我忘了提到 GtkGlArea,但在这个应用程序中使用起来非常困难,所以我认为它不合适。

标签: cgtk3

解决方案


That's a very wide question, I'll have a go.

You can use GtkGLArea, that allows you to render using OpenGL which can be more low-level and thus faster than going through Cairo. It does of course make you do a lot more work.

You can also create an off-screen image and render the entire schematic to that, then just copy a suitable rectangle to match the current scroll location, that can probably be faster than doing lots of drawing.


推荐阅读