Search in sources :

Example 1 with GraphicLineCollector

use of de.neemann.digital.draw.graphics.linemerger.GraphicLineCollector in project Digital by hneemann.

the class Export method export.

/**
 * Export the file
 *
 * @param out stream to write the file to
 * @throws IOException IOException
 */
public void export(OutputStream out) throws IOException {
    try (Graphic gr = factory.create(out)) {
        GraphicMinMax minMax = new GraphicMinMax(gr);
        circuit.drawTo(minMax);
        gr.setBoundingBox(minMax.getMin(), minMax.getMax());
        GraphicLineCollector glc = new GraphicLineCollector();
        circuit.drawTo(glc);
        glc.drawTo(gr);
        circuit.drawTo(new GraphicSkipLines(gr));
    }
}
Also used : GraphicLineCollector(de.neemann.digital.draw.graphics.linemerger.GraphicLineCollector) GraphicSkipLines(de.neemann.digital.draw.graphics.linemerger.GraphicSkipLines)

Example 2 with GraphicLineCollector

use of de.neemann.digital.draw.graphics.linemerger.GraphicLineCollector in project Digital by hneemann.

the class GifExporter method createBufferedImage.

private BufferedImage createBufferedImage() throws IOException {
    GraphicsImage gri = new GraphicsImage(null, "gif", 1);
    gri.setBoundingBox(minMax.getMin(), minMax.getMax());
    BufferedImage bi = gri.getBufferedImage();
    Graphics gr = bi.getGraphics();
    gr.setColor(Color.WHITE);
    gr.fillRect(0, 0, bi.getWidth(), bi.getHeight());
    GraphicLineCollector glc = new GraphicLineCollector();
    circuit.drawTo(glc);
    glc.drawTo(gri);
    circuit.drawTo(new GraphicSkipLines(gri));
    return gri.getBufferedImage();
}
Also used : GraphicsImage(de.neemann.digital.draw.graphics.GraphicsImage) GraphicLineCollector(de.neemann.digital.draw.graphics.linemerger.GraphicLineCollector) GraphicSkipLines(de.neemann.digital.draw.graphics.linemerger.GraphicSkipLines) BufferedImage(java.awt.image.BufferedImage)

Aggregations

GraphicLineCollector (de.neemann.digital.draw.graphics.linemerger.GraphicLineCollector)2 GraphicSkipLines (de.neemann.digital.draw.graphics.linemerger.GraphicSkipLines)2 GraphicsImage (de.neemann.digital.draw.graphics.GraphicsImage)1 BufferedImage (java.awt.image.BufferedImage)1