better quality of animated gifs

This commit is contained in:
hneemann 2017-05-17 22:10:16 +02:00
parent 29b9909118
commit 977f3d889d
2 changed files with 24 additions and 18 deletions

View File

@ -81,7 +81,7 @@
</visualElements> </visualElements>
<wires> <wires>
<wire> <wire>
<p1 x="480" y="80"/> <p1 x="460" y="80"/>
<p2 x="580" y="80"/> <p2 x="580" y="80"/>
</wire> </wire>
<wire> <wire>
@ -89,7 +89,7 @@
<p2 x="580" y="160"/> <p2 x="580" y="160"/>
</wire> </wire>
<wire> <wire>
<p1 x="460" y="340"/> <p1 x="480" y="340"/>
<p2 x="540" y="340"/> <p2 x="540" y="340"/>
</wire> </wire>
<wire> <wire>
@ -102,7 +102,7 @@
</wire> </wire>
<wire> <wire>
<p1 x="420" y="260"/> <p1 x="420" y="260"/>
<p2 x="460" y="260"/> <p2 x="480" y="260"/>
</wire> </wire>
<wire> <wire>
<p1 x="520" y="260"/> <p1 x="520" y="260"/>
@ -130,7 +130,7 @@
</wire> </wire>
<wire> <wire>
<p1 x="420" y="420"/> <p1 x="420" y="420"/>
<p2 x="480" y="420"/> <p2 x="460" y="420"/>
</wire> </wire>
<wire> <wire>
<p1 x="520" y="420"/> <p1 x="520" y="420"/>
@ -141,7 +141,7 @@
<p2 x="680" y="420"/> <p2 x="680" y="420"/>
</wire> </wire>
<wire> <wire>
<p1 x="460" y="120"/> <p1 x="480" y="120"/>
<p2 x="580" y="120"/> <p2 x="580" y="120"/>
</wire> </wire>
<wire> <wire>
@ -158,7 +158,7 @@
</wire> </wire>
<wire> <wire>
<p1 x="440" y="220"/> <p1 x="440" y="220"/>
<p2 x="460" y="220"/> <p2 x="480" y="220"/>
</wire> </wire>
<wire> <wire>
<p1 x="420" y="380"/> <p1 x="420" y="380"/>
@ -193,8 +193,12 @@
<p2 x="440" y="460"/> <p2 x="440" y="460"/>
</wire> </wire>
<wire> <wire>
<p1 x="480" y="80"/> <p1 x="480" y="260"/>
<p2 x="480" y="420"/> <p2 x="480" y="340"/>
</wire>
<wire>
<p1 x="480" y="120"/>
<p2 x="480" y="220"/>
</wire> </wire>
<wire> <wire>
<p1 x="500" y="160"/> <p1 x="500" y="160"/>
@ -261,12 +265,8 @@
<p2 x="680" y="440"/> <p2 x="680" y="440"/>
</wire> </wire>
<wire> <wire>
<p1 x="460" y="260"/> <p1 x="460" y="80"/>
<p2 x="460" y="340"/> <p2 x="460" y="420"/>
</wire>
<wire>
<p1 x="460" y="120"/>
<p2 x="460" y="220"/>
</wire> </wire>
</wires> </wires>
</circuit> </circuit>

View File

@ -12,6 +12,7 @@ import de.neemann.digital.draw.graphics.linemerger.GraphicSkipLines;
import javax.imageio.stream.FileImageOutputStream; import javax.imageio.stream.FileImageOutputStream;
import javax.imageio.stream.ImageOutputStream; import javax.imageio.stream.ImageOutputStream;
import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -69,14 +70,19 @@ public class GifExporter {
private BufferedImage createBufferedImage() throws IOException { private BufferedImage createBufferedImage() throws IOException {
GraphicsImage gr = GraphicsImage.create(null, minMax.getMin(), minMax.getMax(), "gif", 2); GraphicsImage gri = GraphicsImage.create(null, minMax.getMin(), minMax.getMax(), "gif", 1);
BufferedImage bi = gri.getBufferedImage();
Graphics gr = bi.getGraphics();
gr.setColor(Color.WHITE);
gr.fillRect(0, 0, bi.getWidth(), bi.getHeight());
GraphicLineCollector glc = new GraphicLineCollector(); GraphicLineCollector glc = new GraphicLineCollector();
circuit.drawTo(glc); circuit.drawTo(glc);
glc.drawTo(gr); glc.drawTo(gri);
circuit.drawTo(new GraphicSkipLines(gr)); circuit.drawTo(new GraphicSkipLines(gri));
return gr.getBufferedImage(); return gri.getBufferedImage();
} }
} }