jgraph / mxgraph

mxGraph is a fully client side JavaScript diagramming library
Other
6.79k stars 2.06k forks source link

Image created by Java mxCellRenderer.createBufferedImage is very poor. What am i missing #480

Closed kvanapal closed 3 years ago

kvanapal commented 4 years ago

I am using the Java version of the code to create an Image from the mxGraph XML

    String strXML = mxUtils.readFile("Component.xml");
        mxGraph graph = new mxGraph();
    Document xmlGraphDoc = mxXmlUtils.parseXml(strXML);
    mxCodec codec = new mxCodec(xmlGraphDoc);

    Object o;
    o = codec.decode(xmlGraphDoc.getDocumentElement());
    graph.setModel((mxGraphModel)o);        
    mxGraphModel model = (mxGraphModel)graph.getModel();        
    BufferedImage image = mxCellRenderer.createBufferedImage(graph, null, 1, Color.WHITE, true, null);
    ImageIO.write(image, "PNG", new File("Component.png"));`

My XML is here Generated image is here

Why is the generated Image so poorly rendered? Am i missing anything?