diff options
author | Adrian Cumiskey <acumiskey@apache.org> | 2007-12-12 12:24:10 +0000 |
---|---|---|
committer | Adrian Cumiskey <acumiskey@apache.org> | 2007-12-12 12:24:10 +0000 |
commit | e30bf175fe7a4caddd9379b44599b31dada3895a (patch) | |
tree | 82e26cf01a492a1db3dd2dcc708ae07c1fc3d2a4 /src/java/org/apache/fop/render/afp/modca/ImageObject.java | |
parent | 3ad1cf6d677d963b63f89a01114a4f8de176bd2b (diff) | |
download | xmlgraphics-fop-e30bf175fe7a4caddd9379b44599b31dada3895a.tar.gz xmlgraphics-fop-e30bf175fe7a4caddd9379b44599b31dada3895a.zip |
* Added an SVG handler and Graphics2D implementation for AFP which injects AFP GOCA structured fields into the AFPDataStream.
* Fixed many checkstyle problems.
* Updated xmlgraphics-commons-1.3svn.jar to include changes to TextHandler
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@603590 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/afp/modca/ImageObject.java')
-rw-r--r-- | src/java/org/apache/fop/render/afp/modca/ImageObject.java | 99 |
1 files changed, 12 insertions, 87 deletions
diff --git a/src/java/org/apache/fop/render/afp/modca/ImageObject.java b/src/java/org/apache/fop/render/afp/modca/ImageObject.java index 66c46c872..c13fcbb59 100644 --- a/src/java/org/apache/fop/render/afp/modca/ImageObject.java +++ b/src/java/org/apache/fop/render/afp/modca/ImageObject.java @@ -27,12 +27,7 @@ import org.apache.fop.render.afp.tools.BinaryUtils; /** * An IOCA Image Data Object */ -public class ImageObject extends AbstractNamedAFPObject { - - /** - * The object environment group - */ - private ObjectEnvironmentGroup objectEnvironmentGroup = null; +public class ImageObject extends AbstractDataObject { /** * The image segment @@ -45,34 +40,7 @@ public class ImageObject extends AbstractNamedAFPObject { * @param name The name of the image. */ public ImageObject(String name) { - super(name); - - } - - /** - * Sets the image display area position and size. - * - * @param x - * the x position of the image - * @param y - * the y position of the image - * @param w - * the width of the image - * @param h - * the height of the image - * @param r - * the rotation of the image - * @param wr - * the width resolution of the image - * @param hr - * the height resolution of the image - */ - public void setImageViewport(int x, int y, int w, int h, int r, int wr, int hr) { - if (objectEnvironmentGroup == null) { - objectEnvironmentGroup = new ObjectEnvironmentGroup(); - } - objectEnvironmentGroup.setObjectArea(x, y, w, h, r, wr, hr); } /** @@ -149,24 +117,16 @@ public class ImageObject extends AbstractNamedAFPObject { } /** - * Sets the ObjectEnvironmentGroup. - * @param objectEnvironmentGroup The objectEnvironmentGroup to set - */ - public void setObjectEnvironmentGroup(ObjectEnvironmentGroup objectEnvironmentGroup) { - this.objectEnvironmentGroup = objectEnvironmentGroup; - } - - /** * Helper method to return the start of the image object. + * @param len the length of this ipd start * @return byte[] The data stream. */ private byte[] getIPDStart(int len) { - + byte[] l = BinaryUtils.convert(len + 8, 2); byte[] data = new byte[] { - 0x5A, // Structured field identifier - 0x00, // Length byte 1 - 0x10, // Length byte 2 + l[0], // Length byte 1 + l[1], // Length byte 2 (byte) 0xD3, // Structured field id byte 1 (byte) 0xEE, // Structured field id byte 2 (byte) 0xFB, // Structured field id byte 3 @@ -174,29 +134,14 @@ public class ImageObject extends AbstractNamedAFPObject { 0x00, // Reserved 0x00, // Reserved }; - - byte[] l = BinaryUtils.convert(len + 8, 2); - data[1] = l[0]; - data[2] = l[1]; - return data; - } /** - * Accessor method to write the AFP datastream for the Image Object - * @param os The stream to write to - * @throws java.io.IOException thrown if an I/O exception of some sort has occurred + * {@inheritDoc} */ - public void writeDataStream(OutputStream os) - throws IOException { - - writeStart(os); - - if (objectEnvironmentGroup != null) { - objectEnvironmentGroup.writeDataStream(os); - } - + protected void writeContent(OutputStream os) throws IOException { + super.writeContent(os); if (imageSegment != null) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); imageSegment.writeDataStream(baos); @@ -209,20 +154,13 @@ public class ImageObject extends AbstractNamedAFPObject { off += len; } } - - writeEnd(os); - } /** - * Helper method to write the start of the Image Object. - * @param os The stream to write to + * {@inheritDoc} */ - private void writeStart(OutputStream os) - throws IOException { - + protected void writeStart(OutputStream os) throws IOException { byte[] data = new byte[17]; - data[0] = 0x5A; // Structured field identifier data[1] = 0x00; // Length byte 1 data[2] = 0x10; // Length byte 2 @@ -232,26 +170,19 @@ public class ImageObject extends AbstractNamedAFPObject { data[6] = 0x00; // Flags data[7] = 0x00; // Reserved data[8] = 0x00; // Reserved - for (int i = 0; i < nameBytes.length; i++) { - data[9 + i] = nameBytes[i]; - } - os.write(data); - } /** * Helper method to write the end of the Image Object. * @param os The stream to write to + * @throws IOException in the event */ - private void writeEnd(OutputStream os) - throws IOException { - + protected void writeEnd(OutputStream os) throws IOException { byte[] data = new byte[17]; - data[0] = 0x5A; // Structured field identifier data[1] = 0x00; // Length byte 1 data[2] = 0x10; // Length byte 2 @@ -261,15 +192,9 @@ public class ImageObject extends AbstractNamedAFPObject { data[6] = 0x00; // Flags data[7] = 0x00; // Reserved data[8] = 0x00; // Reserved - for (int i = 0; i < nameBytes.length; i++) { - data[9 + i] = nameBytes[i]; - } - os.write(data); - } - } |