C++ 图形绘图库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1610210/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-27 20:36:44  来源:igfitidea点击:

C++ Graphic Drawing Library

c++drawing

提问by Andrei

Does anyone know what's the best graphic drawing library for C++, I want a lib that can draw basic shapes and can make image editing, gradients and vector or 3D would be great to.

有谁知道什么是 C++ 最好的图形绘图库,我想要一个可以绘制基本形状并可以进行图像编辑、渐变和矢量或 3D 的库。

The windows drawing functions are complicated and are not very advanced.

windows绘图功能比较复杂,也不是很高级。

回答by LiraNuna

May I suggest using Cairo?

我可以建议使用开罗吗?

This vector library is very fast, verbose and powerful! Just look at those pretty examples!

这个矢量库非常快速、详细和强大!看看那些漂亮的例子

There's even integration with OpenGLif you need vectorized 3D textures!

如果您需要矢量化 3D 纹理,甚至可以与 OpenGL 集成

回答by Fabio Ceconello

I tested AGG, Cairo, GDI+ and Quartz (for Mac).

我测试了 AGG、Cairo、GDI+ 和 Quartz(适用于 Mac)。

I think Quartz is the best, but is available (as long as I know) for Mac only.

我认为 Quartz 是最好的,但仅适用于 Mac(据我所知)。

AGG is poweful, but is not well documented. The developer decided to reinvent the wheel, and made his own doc system, instead of using something standard like doxygen. There are good tutorials for basic understanding, but when you dig deeper you find API documentation lacking, imprecise or incomplete.

AGG 功能强大,但没有很好的文档记录。开发人员决定重新发明轮子,并制作自己的文档系统,而不是使用像 doxygen 这样的标准。有一些很好的基本理解教程,但是当您深入挖掘时,您会发现 API 文档缺乏、不精确或不完整。

GDI+ is pretty basic compared to the others, and is available for Windows only.

与其他 GDI+ 相比,GDI+ 非常基础,并且仅适用于 Windows。

As a result, I think the best choice is probably Cairo (unless you can choose to develop for Mac only). It's well documented, the code is clean, and is fast and powerful.

因此,我认为最好的选择可能是开罗(除非您可以选择仅针对 Mac 进行开发)。它有据可查,代码干净,快速且功能强大。

回答by Nick Dandoulakis

Check out CImg Library.

查看CImg 库。

CImg stands for "Cool Image" : It is easy to use and efficient. It's a very pleasant toolbox to code image processing stuffs in C++, and potentially covers a wide range of image processing applications.

CImg 代表“Cool Image”:它易于使用且高效。它是一个非常令人愉快的工具箱,可以用 C++ 编写图像处理程序,并且可能涵盖广泛的图像处理应用程序。

回答by NewbiZ

Graphics libraries OpenGL, DirectX and game engines such as Ogre3D may be too low level for tasks like drawing shapes and gradients.

图形库 OpenGL、DirectX 和游戏引擎(如 Ogre3D)对于绘制形状和渐变等任务来说可能太低级了。

Maybe you should take a look at Cairo as mentioned above (http://cairographics.org/), or simply at Qt which has a pretty complete and efficient drawing module (http://qt.nokia.com/doc/4.5/examples.html#graphics-view) and allows high level (GraphicsScene & GraphicsView) and low level (OpenGL) drawing.

也许你应该看看上面提到的开罗(http://cairographics.org/),或者只是在 Qt 有一个非常完整和高效的绘图模块(http://qt.nokia.com/doc/4.5/ examples.html#graphics-view) 并允许高级 (GraphicsScene & GraphicsView) 和低级 (OpenGL) 绘图。

回答by Drew Noakes

For 2D drawing, SFMLprovides a nice API.

对于 2D 绘图,SFML提供了一个很好的 API。

See some of the quality tutorialsto learn more.

查看一些高质量的教程以了解更多信息。

回答by CookieOfFortune

DirectX and OpenGL are two options here. They're both complicated though.

DirectX 和 OpenGL 是这里的两个选项。不过两者都很复杂。

回答by Steve Obbayi

Though meant for 3D you can get to do 2D stuff with Ogre3D

虽然是为 3D 设计的,但你可以用Ogre3D做 2D 的东西