Git Product home page Git Product logo

vectorgraphics2d's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vectorgraphics2d's Issues

SVG rendering correctly but not PDF and EPS

Hi fellow charting lib developer!

I'm the main dev of XChart, and someone requested that I implement a vector graphics export function like Gral. (BTW, nice project!)

I was able to change a lot of my underlying code to get things compatible with vectorgraphics2d and the SVG export works great. The PDF and ESP are not so great though. I've attached some screenshots. Can you perhaps guess why the rendering isn't working properly?

Thanks, Tim

Imported from trac ticket #16, created by timmolter on 04-26-2014 at 17:16, last modified: 04-26-2014 at 17:16

Generating empty pdf on Windows 10 and opening it in Adobe Acrobat Reader DC results in a warning about bad /BBox in font 'Dialog.plain'

Opening empty generated .pdf on Windows 10 with Adobe Acrobat Reader DC (15.016.20045) results in a warning "The font 'Dialog.plain' contains bad /BBox."

Repro:

// Gradle dependency: testCompile 'de.erichseifert.vectorgraphics2d:VectorGraphics2D:0.10'
@Test
public void BBoxError() throws IOException
{
  PDFGraphics2D pdf = new PDFGraphics2D(0.0, 0.0, 100.0, 100.0);
  System.out.println(pdf.getFont());
  // Prints out: java.awt.Font[family=Dialog,name=Dialog,style=plain,size=12]

  try (FileOutputStream file = new FileOutputStream("test1.pdf"))
  {
    file.write(pdf.getBytes());
  }

  // Open test1.pdf with Adobe Acrobat Reader DC (15.016.20045) on Windows 10
  // See a dialog box: "The font 'Dialog.plain' contains bad /BBox."

  pdf.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 14));
  System.out.println(pdf.getFont());
  // Prints out: java.awt.Font[family=SansSerif,name=SansSerif,style=bold,size=14]
  try (FileOutputStream file = new FileOutputStream("test2.pdf"))
  {
    file.write(pdf.getBytes());
  }

  // Open test2.pdf with Adobe Acrobat Reader DC (15.016.20045) on Windows 10
  // See a dialog box: "The font 'Dialog.plain' contains bad /BBox."
  // I.e. the message is the same, even though the font was changed.

  // Both test1.pdf and test2.pdf in "Document Propeties -> Fonts" show:
  //   Dialog.plain
  //     Type: TrueType
  //     Encoding: Ansi
  //     Actual font: Adobe Sans MM
  //     Actual Font Type: Type 1
}

Add clipping support

Support for clipping should be implemented in all format classes.

Possible implementations:

  • clip instruction in EPS

  • W or W* instruction in PDF

  • <clipPath> tag and corresponding references in SVG

    Imported from trac ticket #1, created by eseifert on 10-22-2010 at 14:43, last modified: 10-23-2010 at 00:03

Missing readme file

Add a README file that includes a short project description and usage instructions.

Add support for dpi

It should be possible to define the dots per inch (dpi) for EPS, PDF, and SVG files.

Imported from trac ticket #10, created by eseifert on 11-30-2010 at 16:08, last modified: 11-30-2010 at 16:08

HeadlessException

Hello vectorgraphics2d developers, thanks a lot for the great tool!
Recently I've tried to use version 0.10 to produce SVG graphics in headless enviroment and faced this exception:

Caused by: java.awt.HeadlessException: 
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:77)
        at de.erichseifert.vectorgraphics2d.VectorGraphics2D.<init>(SourceFile:113)
        at de.erichseifert.vectorgraphics2d.ProcessingPipeline.<init>(SourceFile:43)
        at de.erichseifert.vectorgraphics2d.SVGGraphics2D.<init>(SourceFile:46)
...

As far as I can see, the issue is already fixed in master, when can we expect the fix version published?

Thanks in advance,
Oleg

Multipage pdfs?

Hi!

Is it possible to create multipage pdfs with vectorgraphics2d?

Deprecate VectorGraphics2D.getBytes()

This method has two problems:

  • It catches an IOException that should better be forwarded to the user of the API
  • It is obsolete, because VectorGraphics2D.writeTo(OutputStream) exists. If the user wants to obtain a byte array, he can still write to a ByteArrayOutputStream and obtain the byte representation

Using writeTo(OutputStream) instead of getBytes() also makes writing to files (i. e. the common case) easier.

Add image support

Currently writing image data isn't supported. Writing bitmap image data should be implemented by all VectorGraphics2D implementations.

Imported from trac ticket #2, created by eseifert on 10-23-2010 at 00:12, last modified: 12-03-2010 at 17:09

Create builder for VectorGraphics2D

Instead of creating file-format specific objects directly, such as new SVGGraphics2D(...), a builder should be used.
Example:

VectorGraphics2D vg2d = new VectorGraphics2D.Builder("svg", PageSize.A4)
    .compressed(true).build();

Add support for compressed files

There should be an option to save vector data of text based vector formats (like EPS, PDF, and SVG) to more compact versions. This will produce much smaller files.

Several levels of compression could be implemented. Lossy compression of image data (e.g. as JPEG) could save even more space.

Possible compression formats:

  • EPS: gzip compression (.eps.gz)
  • PDF: deflate compression for streams and images (.pdf)
  • SVG: gzip compression (.svgz)

EPS rendering issues

SVG and PDF are working perfectly. Hower for EPS, all the text is just off the image to the upper left. Any ideas what I could do to fix this?

See: knowm/XChart#105

NPE from SVGGraphics2D#getBytes

Happened with 0.11 version released recently.

java.lang.NullPointerException
    at java.util.LinkedList$ListItr.next(LinkedList.java:893)
    at de.erichseifert.vectorgraphics2d.intermediate.filters.Filter.a(SourceFile:51)
    at de.erichseifert.vectorgraphics2d.intermediate.filters.Filter.hasNext(SourceFile:45)
    at de.erichseifert.vectorgraphics2d.intermediate.filters.Filter.a(SourceFile:50)
    at de.erichseifert.vectorgraphics2d.intermediate.filters.Filter.hasNext(SourceFile:45)
    at de.erichseifert.vectorgraphics2d.intermediate.filters.GroupingFilter.hasNext(SourceFile:40)
    at de.erichseifert.vectorgraphics2d.svg.SVGProcessor.process(SourceFile:36)
    at de.erichseifert.vectorgraphics2d.ProcessingPipeline.writeTo(SourceFile:54)
    at de.erichseifert.vectorgraphics2d.ProcessingPipeline.getBytes(SourceFile:61)

Add rounded rectangle support to EPS

EPS doesn't support rounded rectangle at the moment. Add support for rounded rectangles directly or by converting them to vector shapes.

Imported from trac ticket #6, created by eseifert on 11-07-2010 at 16:41, last modified: 11-09-2010 at 10:07

Build on Mac OS X

The current build fails on Mac OS X because it assumes that a Sun/Oracle JDK is in use.

The attached patch alters the build in the following ways:

  • add a macosx profile which targets the Apple JDK (use classes.jar instead of rt.jar);
  • move the proguard phase into a profile; and
  • attach sources and apidocs by default.

so to get a compressed/obfuscated build you would need to do

$ mvn -Pproguard package

and to get the same on a Mac OS X system

$ mvn -Pmacosx,proguard package

Imported from trac ticket #13, created by ianp on 05-30-2011 at 22:28, last modified: 05-31-2011 at 17:38

library forces coordinates to be millimeters

(By way of background, I recently found this library when I was looking for alternatives to FreeHEP. I'm impressed so far!)

I've noticed some odd (to me) behavior regarding sizes and scaling, particularly when creating EPS graphics. Both the size of the page I created and the size of my graphics weren't what I thought they should be. After browsing the code, I discovered that this is because VectorGraphics2D treats all dimensions as millimeters, while I expected it to be pixels or maybe points — basically, the native unit of the format in question.

For SVG this is only a minor annoyance that I can easily correct if I care enough. It's more of a concern for EPS and PDF though — even if I convert the size canvas I want from points to millimeters (just to have VectorGraphics2D convert it back) I'm still forced to do all my drawing in millimeters. This leads to output with unintuitive arguments to the scale command and all of the drawing commands. What could be a simple "newpath 0 0 612 792 rect Z fill" becomes "2.834645669291339 -2.834645669291339 scale" followed by "newpath 0 0 215.9 279.4 rect Z fill".

Bottom line, could there be a way to create a Graphics object with a different base unit? Or at least to skip the built-in scaling and work in the format's native units? Thanks!

Overfull lines in EPS files

VectorGraphics2D occasionally produces EPS files with a line length of more than 255 characters.

As stated in the EPS file format specification v3.0, EPS files must not contain lines that exceed 255 ASCII characters, excluding line termination characters.

Text encoding

What does "Some features are still missing, like [..] text encoding" really mean? I'm trying to print some non-ascii characters (swedish åäö) that comes out invalid. Can I somehow output these characters by changing encoding of the text myself before using drawString()? Thanks for your time!

Multithreading support

VectorGrahpics2D currently does not support multi-threaded drawing. Two causes have been identified so far (see issue #42):

  • Commands are not order-independent. Due to missing information about the graphics state, they depend on preceding commands.
  • VectorGraphics2D and objects created by VectorGraphics2D.create() share a common command list. This makes it impossible to draw into instances of VG2D in parallel.

Support for Paint objects

After rewriting VectorGraphics2D to use objects Paint objects aren't exported correctly anymore. This should be (re-)implemented.

Default graphics state for EPS missing

Currently, VectorGraphics2D does not specify a default stroke and uses white as a default color.

The EPS file format specification v3.0 specifies the default graphics state in section 2.6, which is different from the current state.

Maven repository

VectorGraphics2D should be available on a Maven repository to make integration easier for projects using a Maven build system.

Imported from trac ticket #15, created by eseifert on 05-31-2013 at 16:45, last modified: 05-31-2013 at 16:57

NullPointerException when using Alloy as a Swing Look And Feel

I am getting the following exception when I run: comp.paint(g).
And "g" is an SVGGraphics2D. Can something be done to fix this?

ERROR [ActionAdapter-AWT-EventQueue-2] <HTML>Error executing script for event:&nbsp;<code><b>actionPerformed</b></code><BR>on component:&nbsp;<code><b>Button 1</b></code>.
Traceback (most recent call last):
File "<event:actionPerformed>", line 4, in <module>
    at com.incors.plaf.m.a(Unknown Source)
    at com.incors.plaf.m.b(Unknown Source)
    at com.incors.plaf.c.b(Unknown Source)
    at com.incors.plaf.alloy.AlloyButtonUI.update(Unknown Source)
    at javax.swing.JComponent.paintComponent(Unknown Source)
    at com.inductiveautomation.vision.api.client.components.model.AbstractVisionButton.paintComponent(AbstractVisionButton.java:366)
    at javax.swing.JComponent.paint(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)


java.lang.NullPointerException: java.lang.NullPointerException
    at org.python.core.Py.JavaError(Py.java:495)
    at org.python.core.Py.JavaError(Py.java:488)
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:188)
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)
    at org.python.core.PyObject.__call__(PyObject.java:404)
    at org.python.core.PyObject.__call__(PyObject.java:408)
    at org.python.core.PyMethod.__call__(PyMethod.java:124)
    at org.python.pycode._pyx10.f$0(<event:actionPerformed>:5)
    at org.python.pycode._pyx10.call_function(<event:actionPerformed>)
    at org.python.core.PyTableCode.call(PyTableCode.java:165)
    at org.python.core.PyCode.call(PyCode.java:18)
    at org.python.core.Py.runCode(Py.java:1275)
    at com.inductiveautomation.ignition.common.script.ScriptManager.runCode(ScriptManager.java:624)
    at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.runActions(ActionAdapter.java:168)
    at com.inductiveautomation.factorypmi.application.binding.action.ActionAdapter.invoke(ActionAdapter.java:265)
    at com.inductiveautomation.factorypmi.application.binding.action.RelayInvocationHandler.invoke(RelayInvocationHandler.java:55)
    at com.sun.proxy.$Proxy29.actionPerformed(Unknown Source)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.awt.EventQueue$4.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.NullPointerException
    at com.incors.plaf.m.a(Unknown Source)
    at com.incors.plaf.m.b(Unknown Source)
    at com.incors.plaf.c.b(Unknown Source)
    at com.incors.plaf.alloy.AlloyButtonUI.update(Unknown Source)
    at javax.swing.JComponent.paintComponent(Unknown Source)
    at com.inductiveautomation.vision.api.client.components.model.AbstractVisionButton.paintComponent(AbstractVisionButton.java:366)
    at javax.swing.JComponent.paint(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)
    ... 50 more

Wrong painting of arcs in EPS

At the moment arcs in EPS aren't rendered correctly. The arc angles are wrong and the type of arc isn't taken into account.

Imported from trac ticket #7, created by eseifert on 11-07-2010 at 17:33, last modified: 11-07-2010 at 17:45

Use objects for creating file format

Use objects to make construction of file formats like SVG and PDF less error prone, more object-oriented, and more testable.

Imported from trac ticket #12, created by eseifert on 12-03-2010 at 17:27, last modified: 12-22-2013 at 17:32

Fix workaround for standalone XML in SVG

Sadly, the version Apache Batik 1.8 in Maven Central is unusable. The older Batik 1.6-1 comes with its own XML parser which doesn't support the setXmlStandalone() method. As of commit a607d3b this is handled in SVGDocument by simply catching the exception:

try {
    doc.setXmlStandalone(false);
} catch (AbstractMethodError e) {
    System.err.println("Your XML parser does not support standalone XML documents.");
}

We should find a better solution for this problem, e.g. to find a working version of Apache Batik 1.8+.

Base 14 fonts

As currently font embedding does not work, it is difficult to create PDFs that work across various devices.

Therefore I suggest adding support for the base 14 fonts that are specified by PDF.

The change would be small, but the benefit large.

Missing EOF comment in EPS documents

EPS documents generated by VectorGraphics2D simply end without any indication at the moment.

However, the PostScript Language Structuring Conventions Specification v3.0 suggests that a document should end with a %%EOF comment.

Wrong size for EPS documents

EPS appears to be fixed to a certain document size rather than using the measurements requested.

The result is cropping or huge whitespace.

Attached is an EPS and SVG, both generated with identical settings. Only difference being class used.

Imported from trac ticket #9, created by Detritus on 11-26-2010 at 18:49, last modified: 11-30-2010 at 17:33

Wrong painting of ellipses in EPS

Ellipses in EPS output are painted at the wrong position. This is because ellipses are specified using top-left position and size but should be defined using center and size.

Imported from trac ticket #5, created by eseifert on 11-07-2010 at 16:11, last modified: 11-07-2010 at 16:14

Improve javadoc

Quite a few public and protected members, methods or classes are missing javadoc comments and should be documented before the next release.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.