开始使用开罗的最快方法
我过去曾尝试过学习 Cairo,但总是转向其他一些图形库。我的问题是我找不到一个好的教程来为我的表面提供简单的显示。我总是最终在 GTK 或 QT 文档中挖掘与我想做的事情无关的东西。我想学习开罗,而不是一个庞大的面向对象架构。
什么是一个简单的包装器,可以为我提供一个可以在开罗画布上绘图的跨平台窗口?
I have taken passing shots at learning Cairo in the past, but always moved on in favor of some other graphics library. My problem is that I can't find a good tutorial that gives me a simple display for my surface. I have always ended up digging through GTK or QT documentation about things that have nothing to do with what I want to do. I want to learn Cairo, not a massive OO architecture.
What is a bare bones wrapper to give me a cross-platform window with a Cairo canvas to draw on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我几乎用开罗做任何涉及绘画的事情。我在一家医疗软件公司工作,所以我制作了科学数据可视化和其他东西的原型。
我通常有三种方式来显示我的绘图:
show()
方法直接在屏幕上显示 PNG 图像;一个源自 cairgraphics 示例的简单脚本(实际上我将其用作任何新项目的模板)是:
或者,如果您不想处理 GUI 工具包,您可以在屏幕上创建和显示图像,并可选择将其保存到文件中:
I have used cairo for virtually anything involving drawing. I work at a medical software company, so I prototype scientific data visualization and other things.
I have usually three ways to display my drawings:
show()
method;A simple script derived from cairographics examples, which actually I use as a template for any new project, is:
Or if you prefer not to deal with GUI toolkits, you can create and display an image on screen, and optionally save it to file:
相关问题的答案演示了 Gtk2HS 中非常简单的设置使用 Cairo 在绘图区域上绘图。
只需将您的 Cairo 动画例程传递给
renderScene
中的renderWithDrawable dw
即可。An answer to a related question demonstrates a very simple setup in Gtk2HS to draw on a drawingArea with Cairo.
Simply pass your Cairo animation routine to
renderWithDrawable dw
inrenderScene
.