git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2b9c6a8
)
Created by jalview
author
amwaterhouse
<Andrew Waterhouse>
Mon, 21 Mar 2005 09:55:42 +0000
(09:55 +0000)
committer
amwaterhouse
<Andrew Waterhouse>
Mon, 21 Mar 2005 09:55:42 +0000
(09:55 +0000)
src/org/jibble/epsgraphics/EpsDocument.java
patch
|
blob
|
history
diff --git
a/src/org/jibble/epsgraphics/EpsDocument.java
b/src/org/jibble/epsgraphics/EpsDocument.java
index
cae9835
..
56ad32f
100755
(executable)
--- a/
src/org/jibble/epsgraphics/EpsDocument.java
+++ b/
src/org/jibble/epsgraphics/EpsDocument.java
@@
-1,4
+1,4
@@
-/*
\r
+/*
\r
Copyright Paul James Mutton, 2001-2004, http://www.jibble.org/
\r
\r
This file is part of EpsGraphics2D.
\r
Copyright Paul James Mutton, 2001-2004, http://www.jibble.org/
\r
\r
This file is part of EpsGraphics2D.
\r
@@
-26,11
+26,11
@@
import java.io.*;
* <p>
\r
* Copyright Paul Mutton,
\r
* <a href="http://www.jibble.org/">http://www.jibble.org/</a>
\r
* <p>
\r
* Copyright Paul Mutton,
\r
* <a href="http://www.jibble.org/">http://www.jibble.org/</a>
\r
- *
\r
+ *
\r
*/
\r
public class EpsDocument {
\r
*/
\r
public class EpsDocument {
\r
-
\r
-
\r
+
\r
+
\r
/**
\r
* Constructs an empty EpsDevice.
\r
*/
\r
/**
\r
* Constructs an empty EpsDevice.
\r
*/
\r
@@
-43,7
+43,7
@@
public class EpsDocument {
_stringWriter = new StringWriter();
\r
_bufferedWriter = new BufferedWriter(_stringWriter);
\r
}
\r
_stringWriter = new StringWriter();
\r
_bufferedWriter = new BufferedWriter(_stringWriter);
\r
}
\r
-
\r
+
\r
/**
\r
* Constructs an empty EpsDevice that writes directly to a file.
\r
* Bounds must be set before use.
\r
/**
\r
* Constructs an empty EpsDevice that writes directly to a file.
\r
* Bounds must be set before use.
\r
@@
-57,16
+57,16
@@
public class EpsDocument {
_bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream));
\r
write(_bufferedWriter);
\r
}
\r
_bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream));
\r
write(_bufferedWriter);
\r
}
\r
-
\r
-
\r
+
\r
+
\r
/**
\r
* Returns the title of the EPS document.
\r
*/
\r
public synchronized String getTitle() {
\r
return _title;
\r
}
\r
/**
\r
* Returns the title of the EPS document.
\r
*/
\r
public synchronized String getTitle() {
\r
return _title;
\r
}
\r
-
\r
-
\r
+
\r
+
\r
/**
\r
* Updates the bounds of the current EPS document.
\r
*/
\r
/**
\r
* Updates the bounds of the current EPS document.
\r
*/
\r
@@
-84,8
+84,8
@@
public class EpsDocument {
minY = (float) y;
\r
}
\r
}
\r
minY = (float) y;
\r
}
\r
}
\r
-
\r
-
\r
+
\r
+
\r
/**
\r
* Appends a line to the EpsDocument. A new line character is added
\r
* to the end of the line when it is added.
\r
/**
\r
* Appends a line to the EpsDocument. A new line character is added
\r
* to the end of the line when it is added.
\r
@@
-130,7
+130,7
@@
public class EpsDocument {
}
\r
}
\r
_lastG = g;
\r
}
\r
}
\r
_lastG = g;
\r
-
\r
+
\r
try {
\r
_bufferedWriter.write(line + "\n");
\r
}
\r
try {
\r
_bufferedWriter.write(line + "\n");
\r
}
\r
@@
-138,8
+138,8
@@
public class EpsDocument {
throw new EpsException("Could not write to the output file: " + e);
\r
}
\r
}
\r
throw new EpsException("Could not write to the output file: " + e);
\r
}
\r
}
\r
-
\r
-
\r
+
\r
+
\r
/**
\r
* Outputs the contents of the EPS document to the specified
\r
* Writer, complete with headers and bounding box.
\r
/**
\r
* Outputs the contents of the EPS document to the specified
\r
* Writer, complete with headers and bounding box.
\r
@@
-147,9
+147,9
@@
public class EpsDocument {
public synchronized void write(Writer writer) throws IOException {
\r
float offsetX = -minX;
\r
float offsetY = -minY;
\r
public synchronized void write(Writer writer) throws IOException {
\r
float offsetX = -minX;
\r
float offsetY = -minY;
\r
-
\r
+
\r
writer.write("%!PS-Adobe-3.0 EPSF-3.0\n");
\r
writer.write("%!PS-Adobe-3.0 EPSF-3.0\n");
\r
- writer.write("%%Creator: EpsGraphics2D " + EpsGraphics2D.VERSION + " by Paul Mutton, http://www.jibble.org/\n");
\r
+ writer.write("%%Creator: Jalview " + jalview.bin.Cache.VERSION + " \n");
\r
writer.write("%%Title: " + _title + "\n");
\r
writer.write("%%CreationDate: " + new Date() + "\n");
\r
writer.write("%%BoundingBox: 0 0 " + ((int) Math.ceil(maxX + offsetX)) + " " + ((int) Math.ceil(maxY + offsetY)) + "\n");
\r
writer.write("%%Title: " + _title + "\n");
\r
writer.write("%%CreationDate: " + new Date() + "\n");
\r
writer.write("%%BoundingBox: 0 0 " + ((int) Math.ceil(maxX + offsetX)) + " " + ((int) Math.ceil(maxY + offsetY)) + "\n");
\r
@@
-160,28
+160,28
@@
public class EpsDocument {
writer.write("%%Pages: 1\n");
\r
writer.write("%%Page: 1 1\n");
\r
writer.write("%%EndComments\n\n");
\r
writer.write("%%Pages: 1\n");
\r
writer.write("%%Page: 1 1\n");
\r
writer.write("%%EndComments\n\n");
\r
-
\r
+
\r
writer.write("gsave\n");
\r
writer.write("gsave\n");
\r
-
\r
+
\r
if (_stringWriter != null) {
\r
writer.write(offsetX + " " + (offsetY) + " translate\n");
\r
if (_stringWriter != null) {
\r
writer.write(offsetX + " " + (offsetY) + " translate\n");
\r
-
\r
+
\r
_bufferedWriter.flush();
\r
StringBuffer buffer = _stringWriter.getBuffer();
\r
for (int i = 0; i < buffer.length(); i++) {
\r
writer.write(buffer.charAt(i));
\r
}
\r
_bufferedWriter.flush();
\r
StringBuffer buffer = _stringWriter.getBuffer();
\r
for (int i = 0; i < buffer.length(); i++) {
\r
writer.write(buffer.charAt(i));
\r
}
\r
-
\r
+
\r
writeFooter(writer);
\r
}
\r
else {
\r
writer.write(offsetX + " " + ((maxY - minY) - offsetY) + " translate\n");
\r
}
\r
writeFooter(writer);
\r
}
\r
else {
\r
writer.write(offsetX + " " + ((maxY - minY) - offsetY) + " translate\n");
\r
}
\r
-
\r
+
\r
writer.flush();
\r
}
\r
writer.flush();
\r
}
\r
-
\r
-
\r
+
\r
+
\r
private void writeFooter(Writer writer) throws IOException {
\r
writer.write("grestore\n");
\r
if (isClipSet()) {
\r
private void writeFooter(Writer writer) throws IOException {
\r
writer.write("grestore\n");
\r
if (isClipSet()) {
\r
@@
-192,12
+192,12
@@
public class EpsDocument {
writer.write("%%EOF");
\r
writer.flush();
\r
}
\r
writer.write("%%EOF");
\r
writer.flush();
\r
}
\r
-
\r
-
\r
+
\r
+
\r
public synchronized void flush() throws IOException {
\r
_bufferedWriter.flush();
\r
}
\r
public synchronized void flush() throws IOException {
\r
_bufferedWriter.flush();
\r
}
\r
-
\r
+
\r
public synchronized void close() throws IOException {
\r
if (_stringWriter == null) {
\r
writeFooter(_bufferedWriter);
\r
public synchronized void close() throws IOException {
\r
if (_stringWriter == null) {
\r
writeFooter(_bufferedWriter);
\r
@@
-205,31
+205,31
@@
public class EpsDocument {
_bufferedWriter.close();
\r
}
\r
}
\r
_bufferedWriter.close();
\r
}
\r
}
\r
-
\r
-
\r
+
\r
+
\r
public boolean isClipSet() {
\r
return _isClipSet;
\r
}
\r
public boolean isClipSet() {
\r
return _isClipSet;
\r
}
\r
-
\r
+
\r
public void setClipSet(boolean isClipSet) {
\r
_isClipSet = isClipSet;
\r
}
\r
public void setClipSet(boolean isClipSet) {
\r
_isClipSet = isClipSet;
\r
}
\r
-
\r
-
\r
+
\r
+
\r
private float minX;
\r
private float minY;
\r
private float maxX;
\r
private float maxY;
\r
private float minX;
\r
private float minY;
\r
private float maxX;
\r
private float maxY;
\r
-
\r
+
\r
private boolean _isClipSet = false;
\r
\r
private String _title;
\r
private StringWriter _stringWriter;
\r
private BufferedWriter _bufferedWriter = null;
\r
private boolean _isClipSet = false;
\r
\r
private String _title;
\r
private StringWriter _stringWriter;
\r
private BufferedWriter _bufferedWriter = null;
\r
-
\r
+
\r
// We need to remember which was the last EpsGraphics2D object to use
\r
// us, as we need to replace the clipping region if another EpsGraphics2D
\r
// object tries to use us.
\r
private EpsGraphics2D _lastG = null;
\r
// We need to remember which was the last EpsGraphics2D object to use
\r
// us, as we need to replace the clipping region if another EpsGraphics2D
\r
// object tries to use us.
\r
private EpsGraphics2D _lastG = null;
\r
-
\r
-}
\ No newline at end of file
+
\r
+}
\r