如何从Graphics2D捕获图形基元到SVG [英] how to capture graphics primitives from Graphics2D into SVG

查看:408
本文介绍了如何从Graphics2D捕获图形基元到SVG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从调用java.awt.Graphics2D中捕获图形基元。调用是通过开源工具包(Apache的PDFBox)进行的,通常在JPanel中呈现。我想拦截这些调用并将它们转换为SVG,这样我就可以构建一个非图形数据模型(例如表格,图形等)。我会很高兴在这个阶段的任何类型的黑客,其中可能包括:

I need to capture the graphics primitives from calls to java.awt.Graphics2D. The calls are made through an Open Source toolkit (Apache's PDFBox) and normally rendered in a JPanel. I would like to intercept these calls and translate them to SVG so I can build a non-graphics data model (e.g. tables, graphs, etc.). I'll be happy for any type of hack at this stage, which might include:


  • 用MyGraphics2D替换Graphics2D库

  • 查找支持SVG输出并捕获

  • 的Graphics2D拦截对Graphics2D的调用(我不喜欢因为我必须管理仿射变换)

辅助问题:Graphics2D是否使用图形库?在这种情况下,如果我在此级别捕获应该已应用转换。

Subsidiary question: Does Graphics2D use the Graphics library? In which case if I capture at this level the transformations should have been applied.

推荐答案

我会看看 Batik 项目,提供Graphics2D的扩展以输出SVG文件。

I would have a look at the Batik project which provides an extension of Graphics2D to output SVG files.

这篇关于如何从Graphics2D捕获图形基元到SVG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆