简体   繁体   English

C ++ / C#路径/矢量绘图库(2D)

[英]C++/C# path/vector drawing library (2D)

I'm looking for a toolkit / library which can help me drawing polygons, vectors and paths. 我正在寻找可以帮助我绘制多边形,向量和路径的工具箱/库。 Beside actually drawing the 2D elements, the library should also be able to draw handles to the base points of those elements, so I am able to move them by drag & drop. 除了实际绘制2D元素外,库还应该能够绘制到这些元素基点的手柄,因此我可以通过拖放来移动它们。 This means the lib also handles the picking routines (or at least allows me to define callbacks). 这意味着lib还可以处理选择例程(或至少允许我定义回调)。

Please see the image below of a path containing single lines as well as cubic Bezier curves (including some handles and an enclosing rectangle of the full path): 请查看下图,该图包含一条直线和三次贝塞尔曲线(包括一些手柄和完整路径的封闭矩形),该路径包括:

example image of path including handles and enclosing rectangle 包含手柄和封闭矩形的路径的示例图像

I'm not sure if there's such a library (in C++/C#). 我不确定是否有这样的库(在C ++ / C#中)。 Haven't been able to find one yet. 尚未找到一个。 Am I stuck with drawing all the elements in this example graph by myself? 我是否愿意自己绘制此示例图中的所有元素?

Thank you for reading! 感谢您的阅读!

Paule 保尔

You have too many demands. 您有太多要求。 I used to use Qt, it's convenient. 我曾经用过Qt,很方便。 Using signal and slot to implement callback is very easy. 使用信号和插槽来实现回调非常容易。 Qpainter can draw many shapes, but i'am not sure it can meet your requirement. Qpainter可以绘制许多形状,但是我不确定它是否可以满足您的要求。 You can learn more about Qt, it has many demos to learn. 您可以了解有关Qt的更多信息,它有许多示例需要学习。

OpenGL satisfies all your requests, and implementing what you want seems not quite difficult. OpenGL可以满足您的所有要求,并且实现所需的功能似乎并不困难。

To get started, you can refer to 要开始使用,您可以参考

http://www.lighthouse3d.com/tutorials/glut-tutorial/setup-basics/ http://www.lighthouse3d.com/tutorials/glut-tutorial/setup-basics/

Using GLUT, you can easily created OpenGL windows, create and draw figures. 使用GLUT,您可以轻松创建OpenGL窗口,创建和绘制图形。 Mouse and keyboard events also have callbacks, in which you can add your handler. 鼠标和键盘事件还具有回调,您可以在其中添加处理程序。 Even if you don't want to use GLUT, there are numerous tutorials telling you how to get started with OpenGL. 即使您不想使用GLUT,也有许多教程告诉您如何开始使用OpenGL。

Once you are familiar with basic OpenGL skills, there is also a tutorial on how to create something more complex, like Bezier curves, using OpenGL. 熟悉OpenGL基本技能后,还将提供有关如何使用OpenGL创建更复杂的东西(如Bezier曲线)的教程。 Although this tutorial doesn't works exactly as you want, you can still add control points, and drag & drop using glut functions. 尽管本教程无法完全按照您的要求运行,但是您仍然可以添加控制点,并使用glut函数进行拖放。

http://nehe.gamedev.net/tutorial/bezier_patches__fullscreen_fix/18003/ http://nehe.gamedev.net/tutorial/bezier_patches__fullscreen_fix/18003/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM