graph.draw();
XJUtils.writeStringToFile(engine.getPSText(), file);
}
public void renderRuleToBitmapFile(String ruleName, String imageFormat, String file) throws Exception {
GGraph graph = createGraph(ruleName);
int width = (int)(graph.getWidth()+1);
int height = (int)(graph.getHeight()+1);
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
Graphics2D g2d = (Graphics2D)image.getGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
context.setEngine(new GEngineGraphics());
context.setGraphics2D(g2d);
g2d.setColor(Color.white);
g2d.fillRect(0, 0, width, height);
graph.draw();
g2d.dispose();
ImageIO.write(image, imageFormat, new File(file));
}