编写路径数据的c++ SVG库
C++ SVG library to write path data
有人知道一个好的c++库,可以为我生成SVG路径数据吗?这个想法是,我应该使用简单的MoveTo, LineTo, CurveTo命令等,应该得到一个最终的路径字符串。虽然这并不难,我也可以自己写,但为了节省时间,最好有这样的东西存在。
可能太晚了,不过Cairo是用C写的,libboard是c++写的。和简单的svg在c++。
我和这些机构都没有关系。
Qt提供了一个很好的SVG导出器和一个很好的简单的绘图界面:
QSvgGenerator generator;
generator.setFileName(path);
generator.setSize(QSize(200, 200));
generator.setViewBox(QRect(0, 0, 200, 200));
generator.setTitle(tr("SVG Generator Example Drawing"));
generator.setDescription(tr("An SVG drawing created by the SVG Generator "
"Example provided with Qt."));
QPainter painter;
painter.begin(&generator);
painter.fillRect(QRect(0, 0, 200, 200), Qt::darkGreen);
painter.setBrush(Qt::green);
painter.setPen(Qt::black);
for (int y = -55, row = 0; y < 200; y += 50, ++row) {
int xs;
if (row == 2 || row == 3)
xs = 150;
else
xs = 50;
for (int x = 0; x < 200; x += xs) {
painter.save();
painter.translate(x, y);
painter.drawPath(tree);
painter.restore();
}
}
painter.fillRect(QRect(0, 0, 200, 200), Qt::gray);
painter.setPen(QPen(Qt::white, 4, Qt::DashLine));
painter.drawLine(QLine(0, 35, 200, 35));
painter.drawLine(QLine(0, 165, 200, 165));
painter.end();
相关文章:
- 如何使用painter类绘制svg图形
- 在C++中生成 SVG
- 使用 Direct2D 绘制 SVG 路径:无法绘制椭圆弧
- 如何将 2d 数组转换为 svg 或 png 格式的数独图像?
- Qt在"debug"模式下正确渲染此SVG,但在"release"
- 从内存中的 SVG 内容创建 QIcon
- 如何在 Qt/hook QPainter 中渲染没有抗锯齿的 SVG 以避免抗锯齿?
- 如何使用 QT c++ 打开 SVG
- UWP中的直接2D SVG绘制
- SVG 格式的输出
- 在 Win32 (C++) 中打开、操作和呈现 SVG 文件
- 使用 Boost 属性树解析 SVG (XML)
- 用开罗加载 svg
- 创建.svg条形图
- SVG图标不会显示在Qt5中
- ImageMagick使用我的真字体(Magick++)转换SVG
- 使用一个 QPainter 一次绘制多个输出:SVG 和 QImage
- 用于将 SVG 转换为栅格的 C/C 库
- 有没有办法使用任何Qt库类从SVG数据中获取正确的边界矩形
- QSvgRenderer语言 - 尽管有 defaultSize(),但正确呈现 svg-items