Skip to content
Commits on Source (6)
libjloda-java (0.0+20180317-1) experimental; urgency=medium
* New upstream commit
Closes: #893454
* Standards-Version: 4.1.3
* debhelper 11
-- Andreas Tille <tille@debian.org> Tue, 20 Mar 2018 12:43:52 +0100
libjloda-java (0.0+20170502-1) experimental; urgency=medium
* New upstream commit
......
......@@ -3,14 +3,14 @@ Maintainer: Debian Med Packaging Team <debian-med-packaging@lists.alioth.debian.
Uploaders: Andreas Tille <tille@debian.org>
Section: science
Priority: optional
Build-Depends: debhelper (>= 9),
Build-Depends: debhelper (>= 11~),
javahelper,
default-jdk,
ant,
libbatik-java,
libjama-java,
libopenjfx-java
Standards-Version: 3.9.8
Standards-Version: 4.1.3
Vcs-Browser: https://anonscm.debian.org/cgit/debian-med/libjloda-java.git
Vcs-Git: https://anonscm.debian.org/git/debian-med/libjloda-java.git
Homepage: https://github.com/danielhuson/jloda
......
......@@ -44,7 +44,7 @@ Description: We are not building for Apple
@@ -1,109 +0,0 @@
-/**
- * AppleStuff.java
- * Copyright (C) 2017 Daniel H. Huson
- * Copyright (C) 2018 Daniel H. Huson
- *
- * (Some files contain contributions from other authors, who are then mentioned separately.)
- *
......
/**
* EPSExportType.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......@@ -107,9 +107,9 @@ public class EPSExportType extends FileFilter implements ExportGraphicType {
* @throws IOException
*/
public void writeToFile(File file, final JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage) throws IOException {
FileOutputStream fos = new FileOutputStream(file);
try (FileOutputStream fos = new FileOutputStream(file)) {
stream(imagePanel, imageScrollPane, showWholeImage, fos);
fos.close();
}
}
/**
......
/**
* EPSGraphics.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......
/**
* ExportGraphicType.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......
/**
* ExportImageDialog.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......
/**
* ExportManager.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......
/**
* GIFExportType.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......@@ -90,29 +90,29 @@ public class GIFExportType extends FileFilter implements ExportGraphicType {
BufferedImage img = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
panel.paint(img.getGraphics());
BufferedOutputStream bos = new BufferedOutputStream(out);
Gif89Encoder enc = new Gif89Encoder(img);
try (BufferedOutputStream bos = new BufferedOutputStream(out)) {
final Gif89Encoder enc = new Gif89Encoder(img);
enc.setTransparentIndex(-1);
enc.encode(bos);
bos.close();
}
}
public void writeToFile(File file, final JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage) throws IOException {
JPanel panel;
final JPanel panel;
if (showWholeImage || imageScrollPane == null)
panel = imagePanel;
else
panel = ExportManager.makePanelFromScrollPane(imagePanel, imageScrollPane);
Image img = imagePanel.getGraphicsConfiguration().createCompatibleImage(panel.getWidth(), panel.getHeight());
Graphics2D g = (Graphics2D) img.getGraphics();
final Image img = imagePanel.getGraphicsConfiguration().createCompatibleImage(panel.getWidth(), panel.getHeight());
final Graphics2D g = (Graphics2D) img.getGraphics();
panel.paint(g);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));
try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))) {
Gif89Encoder enc = new Gif89Encoder(img);
enc.setTransparentIndex(-1);
enc.encode(bos);
bos.close();
}
}
/**
......
/**
* GraphicsFileFilters.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......
/**
* JPGExportType.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......@@ -82,12 +82,12 @@ public class JPGExportType extends FileFilter implements ExportGraphicType {
* @throws IOException
*/
public void stream(JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage, OutputStream out) throws IOException {
JPanel panel;
final JPanel panel;
if (showWholeImage || imageScrollPane == null)
panel = imagePanel;
else
panel = ExportManager.makePanelFromScrollPane(imagePanel, imageScrollPane);
BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
final BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
panel.paint(img.getGraphics());
ImageIO.write(img, "jpg", out);
}
......@@ -103,21 +103,20 @@ public class JPGExportType extends FileFilter implements ExportGraphicType {
* @throws IOException
*/
public void writeToFile(File file, final JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage) throws IOException {
JPanel panel;
final JPanel panel;
if (showWholeImage || imageScrollPane == null)
panel = imagePanel;
else
panel = ExportManager.makePanelFromScrollPane(imagePanel, imageScrollPane);
ByteArrayOutputStream out = new ByteArrayOutputStream();
BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
final BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
panel.paint(img.getGraphics());
ImageIO.write(img, "jpg", out);
FileOutputStream fos = new FileOutputStream(file);
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(out.toByteArray());
fos.close();
}
}
}
/**
......
/**
* PDFExportType.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......@@ -77,16 +77,15 @@ public class PDFExportType extends SVGExportType implements ExportGraphicType {
* @param out the ByteArrayOutputStream.
*/
public static void stream(JPanel panel, OutputStream out) throws IOException {
int width = panel.getWidth();
int height = panel.getHeight();
// Get the Graphics object for pdf writing
VectorGraphics2D pdfGraphics = new VectorGraphics2D();
final VectorGraphics2D pdfGraphics = new VectorGraphics2D();
panel.paint(pdfGraphics);
PDFProcessor processor = new PDFProcessor(false);
Document document = processor.getDocument(pdfGraphics.getCommands(), new PageSize(width, height));
final PDFProcessor processor = new PDFProcessor(false);
final Document document = processor.getDocument(pdfGraphics.getCommands(), new PageSize(width, height));
document.writeTo(out);
out.flush();
}
......@@ -103,14 +102,13 @@ public class PDFExportType extends SVGExportType implements ExportGraphicType {
* @throws java.io.IOException
*/
public void stream(JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage, OutputStream out) throws IOException {
JPanel panel;
final JPanel panel;
if (showWholeImage || imageScrollPane == null)
panel = imagePanel;
else {
// panel=(JPanel)((JViewport)imageScrollPane.getComponent(0)).getComponent(0) ;
panel = ExportManager.makePanelFromScrollPane(imagePanel, imageScrollPane);
}
stream(panel, out);
}
......@@ -125,10 +123,9 @@ public class PDFExportType extends SVGExportType implements ExportGraphicType {
* @throws java.io.IOException
*/
public void writeToFile(File file, final JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage) throws IOException {
OutputStream fos = new FileOutputStream(file);
try (OutputStream fos = new FileOutputStream(file)) {
stream(imagePanel, imageScrollPane, showWholeImage, fos);
fos.close();
}
}
/**
......
/**
* PNGExportType.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......@@ -20,6 +20,7 @@
package jloda.export;
import jloda.util.Basic;
import jloda.util.ProgramProperties;
import javax.imageio.ImageIO;
import javax.swing.*;
......@@ -107,15 +108,26 @@ public class PNGExportType extends FileFilter implements ExportGraphicType {
else
panel = ExportManager.makePanelFromScrollPane(imagePanel, imageScrollPane);
ByteArrayOutputStream out = new ByteArrayOutputStream();
BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
panel.paint(img.getGraphics());
try (final ByteArrayOutputStream out = new ByteArrayOutputStream()) {
System.err.println("(Export panel size: " + panel.getWidth() + " x " + panel.getHeight() + ")"); // todo: debugging for weird giant panel bug
int width = panel.getWidth();
int height = panel.getHeight();
if (width <= 0 || width >= 100000) {
System.err.println("Invalid width=" + width + ", setting to: " + ProgramProperties.get("PNGExportFixWidth", 1000) + " (setprop PNGExportFixWidth to change)");
width = ProgramProperties.get("PNGExportFixWidth", 1000);
}
if (height <= 0 || height >= 100000) {
System.err.println("Invalid height=" + height + ", setting to: " + ProgramProperties.get("PNGExportFixHeight", 1000) + " (setprop PNGExportFixHeight to change)");
height = ProgramProperties.get("PNGExportFixHeight", 1000);
}
final BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
panel.paint(img.getGraphics());
ImageIO.write(img, "png", out);
FileOutputStream fos = new FileOutputStream(file);
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(out.toByteArray());
fos.close();
}
}
}
/**
......
/**
* RenderedExportType.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......@@ -88,32 +88,33 @@ public class RenderedExportType extends FileFilter implements ExportGraphicType
* @throws IOException
*/
public void stream(JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage, OutputStream out) throws IOException {
JPanel panel;
final JPanel panel;
if (showWholeImage || imageScrollPane == null)
panel = imagePanel;
else
panel = ExportManager.makePanelFromScrollPane(imagePanel, imageScrollPane);
BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
final BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
panel.paint(img.getGraphics());
ImageIO.write(img, "bmp", out);
}
public void writeToFile(File file, final JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage) throws IOException {
JPanel panel;
final JPanel panel;
if (showWholeImage || imageScrollPane == null)
panel = imagePanel;
else
panel = ExportManager.makePanelFromScrollPane(imagePanel, imageScrollPane);
ByteArrayOutputStream out = new ByteArrayOutputStream();
BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
final BufferedImage img = new BufferedImage(panel.getWidth(), panel.getHeight(), BufferedImage.TYPE_INT_RGB);
panel.paint(img.getGraphics());
ImageIO.write(img, "bmp", out);
FileOutputStream fos = new FileOutputStream(file);
try (FileOutputStream fos = new FileOutputStream(file)) {
fos.write(out.toByteArray());
fos.close();
}
}
}
/**
......
/**
* SVGExportType.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......@@ -60,13 +60,12 @@ public class SVGExportType extends FileFilter implements ExportGraphicType {
}
public Object getData(JPanel panel) {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
stream(panel, out);
return new ByteArrayInputStream(out.toByteArray());
} catch (IOException ex) {
Basic.caught(ex);
return null;
}
return new ByteArrayInputStream(out.toByteArray());
}
/**
......@@ -90,20 +89,19 @@ public class SVGExportType extends FileFilter implements ExportGraphicType {
* @throws IOException
*/
public void stream(JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage, OutputStream out) throws IOException {
JPanel panel;
final JPanel panel;
if (showWholeImage || imageScrollPane == null)
panel = imagePanel;
else
panel = ExportManager.makePanelFromScrollPane(imagePanel, imageScrollPane);
DOMImplementation dom = GenericDOMImplementation.getDOMImplementation();
Document doc = dom.createDocument(null, "svg", null);
SVGGraphics2D svgGenerator = new SVGGraphics2D(doc);
final DOMImplementation dom = GenericDOMImplementation.getDOMImplementation();
final Document doc = dom.createDocument(null, "svg", null);
final SVGGraphics2D svgGenerator = new SVGGraphics2D(doc);
panel.paint(svgGenerator);
svgGenerator.stream(new OutputStreamWriter(out, "UTF-8"));
out.flush();
out.close();
}
/**
......@@ -117,20 +115,20 @@ public class SVGExportType extends FileFilter implements ExportGraphicType {
* @throws IOException
*/
public void writeToFile(File file, final JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage) throws IOException {
JPanel panel;
final JPanel panel;
if (showWholeImage || imageScrollPane == null)
panel = imagePanel;
else
panel = ExportManager.makePanelFromScrollPane(imagePanel, imageScrollPane);
DOMImplementation dom = GenericDOMImplementation.getDOMImplementation();
Document doc = dom.createDocument(null, "svg", null);
SVGGraphics2D svgGenerator = new SVGGraphics2D(doc);
final DOMImplementation dom = GenericDOMImplementation.getDOMImplementation();
final Document doc = dom.createDocument(null, "svg", null);
final SVGGraphics2D svgGenerator = new SVGGraphics2D(doc);
svgGenerator.setSVGCanvasSize(panel.getSize());
panel.paint(svgGenerator);
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)));
try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file)))) {
svgGenerator.stream(bw);
bw.close();
}
}
/**
......
/**
* SVGStringExportType.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......@@ -60,7 +60,6 @@ public class SVGStringExportType implements ExportGraphicType {
}
public void stream(JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage, OutputStream out) throws IOException {
}
public void writeToFile(File file, JPanel imagePanel, JScrollPane imageScrollPane, boolean showWholeImage) throws IOException {
......
/**
* SaveImageDialog.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......@@ -217,6 +217,7 @@ public class SaveImageDialog extends JDialog {
eps.setDrawTextAsOutlines(textAsOutlines);
}
boolean visibleOnly = wholeImageButton == null || !wholeImageButton.isSelected();
graphicsType.writeToFile(file, imagePanel, imageScrollPane, !visibleOnly);
System.err.println("Written to file: " + file);
......
/**
* TransferableGraphic.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......
/**
* DirectGif89Frame.java
* Copyright (C) 2017 Daniel H. Huson
* Copyright (C) 2018 Daniel H. Huson
*
* (Some files contain contributions from other authors, who are then mentioned separately.)
*
......