You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ac...@apache.org on 2007/12/12 13:24:16 UTC

svn commit: r603590 [4/5] - in /xmlgraphics/fop/trunk: lib/ src/java/org/apache/fop/render/afp/ src/java/org/apache/fop/render/afp/modca/ src/java/org/apache/fop/render/afp/modca/goca/ src/java/org/apache/fop/render/ps/

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ImageObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ImageObject.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ImageObject.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ImageObject.java Wed Dec 12 04:24:10 2007
@@ -27,12 +27,7 @@
 /**
  * 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 @@
      * @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 @@
     }
 
     /**
-     * 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 @@
             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 @@
                 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 @@
         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 @@
         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);
-
     }
-
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ImageSegment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ImageSegment.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ImageSegment.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ImageSegment.java Wed Dec 12 04:24:10 2007
@@ -18,6 +18,7 @@
 /* $Id$ */
 
 package org.apache.fop.render.afp.modca;
+
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
@@ -67,15 +68,12 @@
      * @param name The name of the image.
      */
     public ImageSegment(String name) {
-
         if (name.length() != 4) {
             String msg = "Image segment name must be 4 characters long " + name;
             log.error("Constructor:: " + msg);
             throw new IllegalArgumentException(msg);
         }
-
         this.name = name;
-
         try {
             this.nameBytes = name.getBytes(AFPConstants.EBCIDIC_ENCODING);
         } catch (UnsupportedEncodingException usee) {
@@ -162,24 +160,18 @@
      * @throws java.io.IOException if an I/O exception occurred
      */
     public void writeDataStream(OutputStream os) throws IOException {
-
         writeStart(os);
-
         if (imageContent != null) {
             imageContent.writeDataStream(os);
         }
-
         writeEnd(os);
-
     }
 
     /**
      * Helper method to write the start of the Image Segment.
      * @param os The stream to write to
      */
-    private void writeStart(OutputStream os)
-        throws IOException {
-
+    private void writeStart(OutputStream os) throws IOException {
         byte[] data = new byte[] {
             0x70, // ID
             0x04, // Length
@@ -188,13 +180,9 @@
             0x00, // Name byte 3
             0x00, // Name byte 4
         };
-
         for (int i = 0; i < nameBytes.length; i++) {
-
             data[2 + i] = nameBytes[i];
-
         }
-
         os.write(data);
 
     }
@@ -204,7 +192,6 @@
      * @param os The stream to write to
      */
     private void writeEnd(OutputStream os) throws IOException {
-
         byte[] data = new byte[] {
             0x71, // ID
             0x00, // Length

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectAreaDescriptor.java Wed Dec 12 04:24:10 2007
@@ -35,11 +35,11 @@
      * and object height.
      * @param width The page width.
      * @param height The page height.
-     * @param widthResolution The page width resolution.
-     * @param heightResolution The page height resolution.
+     * @param widthRes The page width resolution.
+     * @param heightRes The page height resolution.
      */
-    public ObjectAreaDescriptor(int width, int height, int widthResolution, int heightResolution) {
-        super(width, height, widthResolution, heightResolution);
+    public ObjectAreaDescriptor(int width, int height, int widthRes, int heightRes) {
+        super(width, height, widthRes, heightRes);
     }
 
     /**
@@ -47,8 +47,7 @@
      * @param os The stream to write to
      * @throws java.io.IOException thrown if an I/O exception of some sort has occurred
      */
-    public void writeDataStream(OutputStream os)
-        throws IOException {
+    public void writeDataStream(OutputStream os) throws IOException {
 
         byte[] data = new byte[29];
         data[0] = 0x5A; 
@@ -72,12 +71,12 @@
         data[15] = 0x00; // YaoBase = 10 inches
         
         // XaoUnits
-        byte[] xdpi = BinaryUtils.convert(widthResolution * 10, 2);
+        byte[] xdpi = BinaryUtils.convert(this.widthRes * 10, 2);
         data[16] = xdpi[0];
         data[17] = xdpi[1];
 
         // YaoUnits
-        byte[] ydpi = BinaryUtils.convert(heightResolution * 10, 2);
+        byte[] ydpi = BinaryUtils.convert(this.heightRes * 10, 2);
         data[18] = ydpi[0];
         data[19] = ydpi[1];
         
@@ -85,18 +84,16 @@
         data[21] = 0x4C; // tid = Object Area Size
         data[22] = 0x02; // Size Type
 
-        byte[] x = BinaryUtils.convert(width, 3);
+        byte[] x = BinaryUtils.convert(this.width, 3);
         data[23] = x[0];
         data[24] = x[1];
         data[25] = x[2];
 
-        byte[] y = BinaryUtils.convert(height, 3);
+        byte[] y = BinaryUtils.convert(this.height, 3);
         data[26] = y[0];
         data[27] = y[1];
         data[28] = y[2];
 
         os.write(data);
-
     }
-
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectAreaPosition.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectAreaPosition.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectAreaPosition.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectAreaPosition.java Wed Dec 12 04:24:10 2007
@@ -30,9 +30,9 @@
  */
 public class ObjectAreaPosition extends AbstractAFPObject {
 
-    private int _x = 0;
-    private int _y = 0;
-    private int _rot = 0;
+    private int x;
+    private int y;
+    private int rotation;
 
     /**
      * Construct an object area position for the specified object y, y position.
@@ -41,24 +41,25 @@
      * @param rotation The coordinate system rotation (must be 0, 90, 180, 270).
      */
     public ObjectAreaPosition(int x, int y, int rotation) {
-
-        _x = x;
-        _y = y;
-        _rot = rotation;
+        this.x = x;
+        this.y = y;
+        this.rotation = rotation;
     }
 
     /**
      * Accessor method to write the AFP datastream for the Object Area Position
      * @param os The stream to write to
-     * @throws java.io.IOException
+     * @throws java.io.IOException in the event that an I/O exception of some sort has occurred.
      */
-    public void writeDataStream(OutputStream os)
-        throws IOException {
+    public void writeDataStream(OutputStream os) throws IOException {
+        byte[] len = BinaryUtils.convert(32, 2);
+        byte[] xcoord = BinaryUtils.convert(x, 3);
+        byte[] ycoord = BinaryUtils.convert(y, 3);
 
         byte[] data = new byte[] {
             0x5A,
-            0x00, // Length
-            0x20, // Length
+            len[0], // Length
+            len[1], // Length
             (byte) 0xD3,
             (byte) 0xAC,
             (byte) 0x6B,
@@ -67,15 +68,15 @@
             0x00, // Reserved
             0x01, // OAPosID = 1
             0x17, // RGLength = 23
-            0x00, // XoaOSet
-            0x00,
-            0x00,
-            0x00, // YoaOSet
-            0x00,
-            0x00,
-            (byte)(_rot / 2), // XoaOrent
+            xcoord[0], // XoaOSet
+            xcoord[1],
+            xcoord[2],
+            ycoord[0], // YoaOSet
+            ycoord[1],
+            ycoord[2],
+            (byte)(rotation / 2), // XoaOrent
             0x00,
-            (byte)(_rot / 2 + 45), // YoaOrent
+            (byte)(rotation / 2 + 45), // YoaOrent
             0x00,
             0x00, // Reserved
             0x00, // XocaOSet
@@ -88,23 +89,9 @@
             0x00,
             0x2D, // YocaOrent
             0x00,
-            0x01, // RefCSys
+            0x00, // RefCSys
         };
-
-        byte[] l = BinaryUtils.convert(data.length - 1, 2);
-        data[1] = l[0];
-        data[2] = l[1];
-
-        byte[] x = BinaryUtils.convert(_x, 3);
-        data[11] = x[0];
-        data[12] = x[1];
-        data[13] = x[2];
-
-        byte[] y = BinaryUtils.convert(_y, 3);
-        data[14] = y[0];
-        data[15] = y[1];
-        data[16] = y[2];
-
+        
         os.write(data);
 
     }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java Wed Dec 12 04:24:10 2007
@@ -18,6 +18,7 @@
 /* $Id$ */
 
 package org.apache.fop.render.afp.modca;
+
 import java.io.IOException;
 import java.io.OutputStream;
 
@@ -33,7 +34,7 @@
  * normally contained in the object environment group, or it may specify that one or
  * more default values are to be used.
  */
-public final class ObjectEnvironmentGroup extends AbstractNamedAFPObject {
+public final class ObjectEnvironmentGroup extends AbstractStructuredAFPObject {
 
     /**
      * Default name for the object environment group
@@ -56,12 +57,15 @@
     private ImageDataDescriptor imageDataDescriptor = null;
 
     /**
+     * The GraphicsDataDescriptor for the object environment group
+     */
+    private GraphicsDataDescriptor graphicsDataDescriptor = null;
+
+    /**
      * Default constructor for the ObjectEnvironmentGroup.
      */
     public ObjectEnvironmentGroup() {
-
         this(DEFAULT_NAME);
-
     }
 
     /**
@@ -70,9 +74,7 @@
      * @param name the object environment group name
      */
     public ObjectEnvironmentGroup(String name) {
-
         super(name);
-
     }
 
     /**
@@ -82,15 +84,14 @@
      * @param width the object width
      * @param height the object height
      * @param rotation the object orientation
-     * @param widthResolution the object resolution width
-     * @param heightResolution the object resolution height
+     * @param widthRes the object resolution width
+     * @param heightRes the object resolution height
      */
-    public void setObjectArea(int x, int y, int width, int height, int rotation,
-            int widthResolution, int heightResolution) {
-
-        objectAreaDescriptor = new ObjectAreaDescriptor(width, height,
-                widthResolution, heightResolution);
-        objectAreaPosition = new ObjectAreaPosition(x, y, rotation);
+    public void setObjectArea(int x, int y, int width, int height,
+            int widthRes, int heightRes, int rotation) {
+        this.objectAreaDescriptor = new ObjectAreaDescriptor(width, height,
+                widthRes, heightRes);
+        this.objectAreaPosition = new ObjectAreaPosition(x, y, rotation);
 
     }
 
@@ -102,40 +103,28 @@
      * @param height the image height
      */
     public void setImageData(int xresol, int yresol, int width, int height) {
-        imageDataDescriptor = new ImageDataDescriptor(xresol, yresol,  width, height);
+        this.imageDataDescriptor = new ImageDataDescriptor(xresol, yresol,  width, height);
     }
 
     /**
-     * Accessor method to obtain write the AFP datastream for
-     * the object environment group.
-     * @param os The stream to write to
-     * @throws java.io.IOException throw if an I/O exception of some sort has occurred
+     * Set the graphics data descriptor.
+     * @param xresol the x resolution of the graphics window
+     * @param yresol the y resolution of the graphics window
+     * @param xlwind the left edge of the graphics window 
+     * @param xrwind the right edge of the graphics window
+     * @param ybwind the top edge of the graphics window
+     * @param ytwind the bottom edge of the graphics window
      */
-    public void writeDataStream(OutputStream os)
-        throws IOException {
-
-
-        writeStart(os);
-
-        objectAreaDescriptor.writeDataStream(os);
-
-        objectAreaPosition.writeDataStream(os);
-
-        if (imageDataDescriptor != null) {
-            imageDataDescriptor.writeDataStream(os);
-        }
-
-        writeEnd(os);
-
+    public void setGraphicsData(int xresol, int yresol,
+            int xlwind, int xrwind, int ybwind, int ytwind) {
+        this.graphicsDataDescriptor = new GraphicsDataDescriptor(xresol, yresol,
+                xlwind, xrwind, ybwind, ytwind);
     }
 
     /**
-     * Helper method to write the start of the object environment group.
-     * @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[] {
             0x5A, // Structured field identifier
             0x00, // Length byte 1
@@ -146,53 +135,57 @@
             0x00, // Flags
             0x00, // Reserved
             0x00, // Reserved
-            0x00, // Name
-            0x00, //
-            0x00, //
-            0x00, //
-            0x00, //
-            0x00, //
-            0x00, //
-            0x00, //
+            nameBytes[0], // Name
+            nameBytes[1], //
+            nameBytes[2], //
+            nameBytes[3], //
+            nameBytes[4], //
+            nameBytes[5], //
+            nameBytes[6], //
+            nameBytes[7] //
         };
-
-        for (int i = 0; i < nameBytes.length; i++) {
-
-            data[9 + i] = nameBytes[i];
-
-        }
-
         os.write(data);
-
     }
 
     /**
-     * Helper method to write the end of the object environment group.
-     * @param os The stream to write to
+     * {@inheritDoc}
      */
-    private 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
-        data[3] = (byte) 0xD3; // Structured field id byte 1
-        data[4] = (byte) 0xA9; // Structured field id byte 2
-        data[5] = (byte) 0xC7; // Structured field id byte 3
-        data[6] = 0x00; // Flags
-        data[7] = 0x00; // Reserved
-        data[8] = 0x00; // Reserved
-
-        for (int i = 0; i < nameBytes.length; i++) {
+    public void writeContent(OutputStream os) throws IOException {
+        objectAreaDescriptor.writeDataStream(os);
+        objectAreaPosition.writeDataStream(os);
 
-            data[9 + i] = nameBytes[i];
+        if (imageDataDescriptor != null) {
+            imageDataDescriptor.writeDataStream(os);
+        }
 
+        if (graphicsDataDescriptor != null) {
+            graphicsDataDescriptor.writeDataStream(os);
         }
+    }
 
+    /**
+     * {@inheritDoc}
+     */
+    protected void writeEnd(OutputStream os) throws IOException {
+        byte[] data = new byte[] {
+            0x5A, // Structured field identifier
+            0x00, // Length byte 1
+            0x10, // Length byte 2
+            (byte) 0xD3, // Structured field id byte 1
+            (byte) 0xA9, // Structured field id byte 2
+            (byte) 0xC7, // Structured field id byte 3
+            0x00, // Flags
+            0x00, // Reserved
+            0x00, // Reserved                
+            nameBytes[0], // Name
+            nameBytes[1], //
+            nameBytes[2], //
+            nameBytes[3], //
+            nameBytes[4], //
+            nameBytes[5], //
+            nameBytes[6], //
+            nameBytes[7], //
+        };
         os.write(data);
-
     }
-
-}
\ No newline at end of file
+}

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PageDescriptor.java Wed Dec 12 04:24:10 2007
@@ -35,11 +35,11 @@
      * and page height.
      * @param width The page width.
      * @param height The page height.
-     * @param widthResolution The page width resolution
-     * @param heightResolution The page height resolution
+     * @param widthRes The page width resolution
+     * @param heightRes The page height resolution
      */
-    public PageDescriptor(int width, int height, int widthResolution, int heightResolution) {
-        super(width, height, widthResolution, heightResolution);
+    public PageDescriptor(int width, int height, int widthRes, int heightRes) {
+        super(width, height, widthRes, heightRes);
     }
 
     /**
@@ -68,12 +68,12 @@
         data[10] = 0x00; // YpgBase = 10 inches 
         
         // XpgUnits
-        byte[] xdpi = BinaryUtils.convert(widthResolution * 10, 2);
+        byte[] xdpi = BinaryUtils.convert(widthRes * 10, 2);
         data[11] = xdpi[0];
         data[12] = xdpi[1];
 
         // YpgUnits
-        byte[] ydpi = BinaryUtils.convert(heightResolution * 10, 2);
+        byte[] ydpi = BinaryUtils.convert(heightRes * 10, 2);
         data[13] = ydpi[0];
         data[14] = ydpi[1];
             

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PageObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PageObject.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PageObject.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PageObject.java Wed Dec 12 04:24:10 2007
@@ -62,15 +62,15 @@
      *            the height of the page.
      * @param rotation
      *            the rotation of the page.
-     * @param widthResolution
+     * @param widthRes
      *            the width resolution of the page.
-     * @param heightResolution
+     * @param heightRes
      *            the height resolution of the page.
      */
     public PageObject(String name, int width, int height, int rotation,
-            int widthResolution, int heightResolution) {
+            int widthRes, int heightRes) {
 
-        super(name, width, height, rotation, widthResolution, heightResolution);
+        super(name, width, height, rotation, widthRes, heightRes);
 
     }
 

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PreparedAFPObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PreparedAFPObject.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PreparedAFPObject.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PreparedAFPObject.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca;
+
+/**
+ * An AFP object which is able to know its own data length before write()
+ */
+public interface PreparedAFPObject {
+    /**
+     * @return the current data length of this container including
+     * all enclosed GOCA drawing objects 
+     */
+    int getDataLength();
+}
\ No newline at end of file

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextData.java Wed Dec 12 04:24:10 2007
@@ -56,42 +56,42 @@
     /**
      * The afp data relating to this presentaion text data.
      */
-    private ByteArrayOutputStream _baos = new ByteArrayOutputStream(1024);
+    private ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
 
     /**
      * The current x coordinate.
      */
-    private int _currentXCoordinate = -1;
+    private int currentXCoordinate = -1;
 
     /**
      * The current y cooridnate
      */
-    private int _currentYCoordinate = -1;
+    private int currentYCoordinate = -1;
 
     /**
      * The current font
      */
-    private String _currentFont = "";
+    private String currentFont = "";
 
     /**
      * The current orientation
      */
-    private int _currentOrientation = 0;
+    private int currentOrientation = 0;
 
     /**
      * The current color
      */
-    private Color _currentColor = new Color(0, 0, 0);
+    private Color currentColor = new Color(0, 0, 0);
 
     /**
      * The current variable space increment
      */
-    private int _currentVariableSpaceCharacterIncrement = 0;
+    private int currentVariableSpaceCharacterIncrement = 0;
 
     /**
      * The current inter character adjustment
      */
-    private int _currentInterCharacterAdjustment = 0;
+    private int currentInterCharacterAdjustment = 0;
 
     /**
      * Default constructor for the PresentationTextData.
@@ -112,7 +112,7 @@
      */
     public PresentationTextData(boolean controlInd) {
 
-        _baos.write(new byte[] { 0x5A, // Structured field identifier
+        baos.write(new byte[] {0x5A, // Structured field identifier
             0x00, // Record length byte 1
             0x00, // Record length byte 2
             (byte) 0xD3, // PresentationTextData identifier byte 1
@@ -124,7 +124,7 @@
         }, 0, 9);
 
         if (controlInd) {
-            _baos.write(new byte[] { 0x2B, (byte) 0xD3 }, 0, 2);
+            baos.write(new byte[] {0x2B, (byte) 0xD3}, 0, 2);
         }
 
     }
@@ -142,13 +142,13 @@
     private void setCodedFont(byte font, ByteArrayOutputStream afpdata) {
 
         // Avoid unnecessary specification of the font
-        if (String.valueOf(font).equals(_currentFont)) {
+        if (String.valueOf(font).equals(currentFont)) {
             return;
         } else {
-            _currentFont = String.valueOf(font);
+            currentFont = String.valueOf(font);
         }
 
-        afpdata.write(new byte[] { 0x03, (byte) 0xF1, font, }, 0, 3);
+        afpdata.write(new byte[] {0x03, (byte) 0xF1, font}, 0, 3);
 
     }
 
@@ -167,9 +167,9 @@
 
         byte[] b = BinaryUtils.convert(coordinate, 2);
 
-        afpdata.write(new byte[] { 0x04, (byte) 0xC7, b[0], b[1], }, 0, 4);
+        afpdata.write(new byte[] {0x04, (byte) 0xC7, b[0], b[1]}, 0, 4);
 
-        _currentXCoordinate = coordinate;
+        currentXCoordinate = coordinate;
 
     }
 
@@ -188,9 +188,9 @@
 
         byte[] b = BinaryUtils.convert(coordinate, 2);
 
-        afpdata.write(new byte[] { 0x04, (byte) 0xD3, b[0], b[1], }, 0, 4);
+        afpdata.write(new byte[] {0x04, (byte) 0xD3, b[0], b[1]}, 0, 4);
 
-        _currentYCoordinate = coordinate;
+        currentYCoordinate = coordinate;
 
     }
 
@@ -214,7 +214,7 @@
                 "Transparent data is longer than 253 bytes: " + data);
         }
 
-        afpdata.write(new byte[] { BinaryUtils.convert(l)[0], (byte) 0xDB, },
+        afpdata.write(new byte[] {BinaryUtils.convert(l)[0], (byte) 0xDB},
             0, 2);
 
         afpdata.write(data, 0, data.length);
@@ -236,7 +236,7 @@
     private void drawBaxisRule(int length, int width,
         ByteArrayOutputStream afpdata) {
 
-        afpdata.write(new byte[] { 0x07, // Length
+        afpdata.write(new byte[] {0x07, // Length
             (byte) 0xE7, // Type
         }, 0, 2);
 
@@ -266,7 +266,7 @@
     private void drawIaxisRule(int length, int width,
         ByteArrayOutputStream afpdata) {
 
-        afpdata.write(new byte[] { 0x07, // Length
+        afpdata.write(new byte[] {0x07, // Length
             (byte) 0xE5, // Type
         }, 0, 2);
 
@@ -284,7 +284,7 @@
     /**
      * Create the presentation text data for the byte array of data.
      *
-     * @param fontNumber
+     * @param fontReference
      *            The font resource identifier.
      * @param x
      *            The x coordinate for the text data.
@@ -300,64 +300,64 @@
      *            The inter character adjustment.
      * @param data
      *            The text data to be created.
-     * @throws MaximumSizeExceededException
+     * @throws MaximumSizeExceededException if the maximum size is exceeded
      */
-    public void createTextData(int fontNumber, int x, int y, int orientation,
+    public void createTextData(int fontReference, int x, int y, int orientation,
         Color col, int vsci, int ica, byte[] data)
         throws MaximumSizeExceededException {
 
         ByteArrayOutputStream afpdata = new ByteArrayOutputStream();
 
-        if (_currentOrientation != orientation) {
+        if (currentOrientation != orientation) {
             setTextOrientation(orientation, afpdata);
-            _currentOrientation = orientation;
-            _currentXCoordinate = -1;
-            _currentYCoordinate = -1;
+            currentOrientation = orientation;
+            currentXCoordinate = -1;
+            currentYCoordinate = -1;
         }
 
         // Avoid unnecessary specification of the Y co-ordinate
-        if (y != _currentYCoordinate) {
+        if (y != currentYCoordinate) {
             absoluteMoveBaseline(y, afpdata);
-            _currentXCoordinate = -1;
+            currentXCoordinate = -1;
         }
 
         // Avoid unnecessary specification of the X co-ordinate
-        if (x != _currentXCoordinate) {
+        if (x != currentXCoordinate) {
             absoluteMoveInline(x, afpdata);
         }
 
         // Avoid unnecessary specification of the variable space increment
-        if (vsci != _currentVariableSpaceCharacterIncrement) {
+        if (vsci != currentVariableSpaceCharacterIncrement) {
             setVariableSpaceCharacterIncrement(vsci, afpdata);
-            _currentVariableSpaceCharacterIncrement = vsci;
+            currentVariableSpaceCharacterIncrement = vsci;
         }
 
         // Avoid unnecessary specification of the inter character adjustment
-        if (ica != _currentInterCharacterAdjustment) {
+        if (ica != currentInterCharacterAdjustment) {
             setInterCharacterAdjustment(ica, afpdata);
-            _currentInterCharacterAdjustment = ica;
+            currentInterCharacterAdjustment = ica;
         }
 
         // Avoid unnecessary specification of the text color
-        if (!col.equals(_currentColor)) {
+        if (!col.equals(currentColor)) {
             setExtendedTextColor(col, afpdata);
-            _currentColor = col;
+            currentColor = col;
         }
 
-        setCodedFont(BinaryUtils.convert(fontNumber)[0], afpdata);
+        setCodedFont(BinaryUtils.convert(fontReference)[0], afpdata);
         addTransparentData(data, afpdata);
-        _currentXCoordinate = -1;
+        currentXCoordinate = -1;
 
         int s = afpdata.size();
 
-        if (_baos.size() + s > MAX_SIZE) {
-            _currentXCoordinate = -1;
-            _currentYCoordinate = -1;
+        if (baos.size() + s > MAX_SIZE) {
+            currentXCoordinate = -1;
+            currentYCoordinate = -1;
             throw new MaximumSizeExceededException();
         }
 
         byte[] outputdata = afpdata.toByteArray();
-        _baos.write(outputdata, 0, outputdata.length);
+        baos.write(outputdata, 0, outputdata.length);
 
     }
 
@@ -379,30 +379,31 @@
      *            The orientation of the text data.
      * @param col
      *            The text color.
+     * @throws MaximumSizeExceededException if the maximum size is exceeded
      */
     public void createLineData(int x1, int y1, int x2, int y2, int thickness,
         int orientation, Color col) throws MaximumSizeExceededException {
 
         ByteArrayOutputStream afpdata = new ByteArrayOutputStream();
 
-        if (_currentOrientation != orientation) {
+        if (currentOrientation != orientation) {
             setTextOrientation(orientation, afpdata);
-            _currentOrientation = orientation;
+            currentOrientation = orientation;
         }
 
         // Avoid unnecessary specification of the Y coordinate
-        if (y1 != _currentYCoordinate) {
+        if (y1 != currentYCoordinate) {
             absoluteMoveBaseline(y1, afpdata);
         }
 
         // Avoid unnecessary specification of the X coordinate
-        if (x1 != _currentXCoordinate) {
+        if (x1 != currentXCoordinate) {
             absoluteMoveInline(x1, afpdata);
         }
 
-        if (!col.equals(_currentColor)) {
+        if (!col.equals(currentColor)) {
             setExtendedTextColor(col, afpdata);
-            _currentColor = col;
+            currentColor = col;
         }
 
         if (y1 == y2) {
@@ -415,14 +416,14 @@
 
         int s = afpdata.size();
 
-        if (_baos.size() + s > MAX_SIZE) {
-            _currentXCoordinate = -1;
-            _currentYCoordinate = -1;
+        if (baos.size() + s > MAX_SIZE) {
+            currentXCoordinate = -1;
+            currentYCoordinate = -1;
             throw new MaximumSizeExceededException();
         }
 
         byte[] outputdata = afpdata.toByteArray();
-        _baos.write(outputdata, 0, outputdata.length);
+        baos.write(outputdata, 0, outputdata.length);
 
     }
 
@@ -443,7 +444,7 @@
     private void setTextOrientation(int orientation,
         ByteArrayOutputStream afpdata) {
 
-        afpdata.write(new byte[] { 0x06, (byte) 0xF7, }, 0, 2);
+        afpdata.write(new byte[] {0x06, (byte) 0xF7}, 0, 2);
 
         switch (orientation) {
             case 90:
@@ -559,12 +560,11 @@
      * Accessor method to write the AFP datastream for
      * the text data.
      * @param os The stream to write to
-     * @throws java.io.IOException
+     * @throws java.io.IOException if an I/O exception occurred
      */
-    public void writeDataStream(OutputStream os)
-        throws IOException {
+    public void writeDataStream(OutputStream os) throws IOException {
 
-        byte[] data = _baos.toByteArray();
+        byte[] data = baos.toByteArray();
         byte[] size = BinaryUtils.convert(data.length - 1, 2);
         data[1] = size[0];
         data[2] = size[1];
@@ -580,7 +580,7 @@
      * presentation text data objects, but must eventually be terminated. This
      * method terminates the control sequence.
      *
-     * @throws MaximumSizeExceededException
+     * @throws MaximumSizeExceededException if the maximum size is exceeded
      */
     public void endControlSequence() throws MaximumSizeExceededException {
 
@@ -588,12 +588,10 @@
         data[0] = 0x02;
         data[1] = (byte) 0xF8;
 
-        if (data.length + _baos.size() > MAX_SIZE) {
+        if (data.length + baos.size() > MAX_SIZE) {
             throw new MaximumSizeExceededException();
         }
-
-        _baos.write(data, 0, data.length);
-
+        baos.write(data, 0, data.length);
     }
 
 }

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextDescriptor.java Wed Dec 12 04:24:10 2007
@@ -52,12 +52,11 @@
      * width and height.
      * @param width The width of the page.
      * @param height The height of the page.
-     * @param widthResolution The width resolution of the page.
-     * @param heightResolution The height resolution of the page.
+     * @param widthRes The width resolution of the page.
+     * @param heightRes The height resolution of the page.
      */
-    public PresentationTextDescriptor(int width, int height,
-            int widthResolution, int heightResolution) {
-        super(width, height, widthResolution, heightResolution);
+    public PresentationTextDescriptor(int width, int height, int widthRes, int heightRes) {
+        super(width, height, widthRes, heightRes);
     }
 
     /**
@@ -81,11 +80,11 @@
         data[9] = 0x00;
         data[10] = 0x00;
 
-        byte[] xdpi = BinaryUtils.convert(widthResolution * 10, 2);
+        byte[] xdpi = BinaryUtils.convert(widthRes * 10, 2);
         data[11] = xdpi[0]; // xdpi
         data[12] = xdpi[1];
 
-        byte[] ydpi = BinaryUtils.convert(heightResolution * 10, 2);
+        byte[] ydpi = BinaryUtils.convert(heightRes * 10, 2);
         data[13] = ydpi[0]; // ydpi
         data[14] = ydpi[1];
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/PresentationTextObject.java Wed Dec 12 04:24:10 2007
@@ -100,7 +100,7 @@
     /**
      * Create the presentation text data for the byte array of data.
      *
-     * @param fontNumber
+     * @param fontReference
      *            The font resource identifier.
      * @param x
      *            The x coordinate for the text data.
@@ -117,7 +117,7 @@
      * @param data
      *            The text data to be created.
      */
-    public void createTextData(int fontNumber, int x, int y, int orientation,
+    public void createTextData(int fontReference, int x, int y, int orientation,
         Color col, int vsci, int ica, byte[] data) {
 
         if (currentPresentationTextData == null) {
@@ -126,13 +126,13 @@
 
         try {
 
-            currentPresentationTextData.createTextData(fontNumber, x, y,
+            currentPresentationTextData.createTextData(fontReference, x, y,
                 orientation, col, vsci, ica, data);
 
         } catch (MaximumSizeExceededException msee) {
 
             endPresentationTextData();
-            createTextData(fontNumber, x, y, orientation, col, vsci, ica, data);
+            createTextData(fontReference, x, y, orientation, col, vsci, ica, data);
 
         }
 

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java?rev=603590&r1=603589&r2=603590&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/TagLogicalElementBean.java Wed Dec 12 04:24:10 2007
@@ -47,7 +47,7 @@
      * @return the key
      */
     public String getKey() {
-        return key;
+        return this.key;
     }
 
     /**
@@ -55,7 +55,7 @@
      * @return the value
      */
     public String getValue() {
-        return value;
+        return this.value;
     }
 
 }

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractGraphicsContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractGraphicsContainer.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractGraphicsContainer.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractGraphicsContainer.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.fop.render.afp.modca.AbstractStructuredAFPObject;
+import org.apache.fop.render.afp.modca.PreparedAFPObject;
+
+/**
+ * A base class container of GOCA structured objects
+ */
+public abstract class AbstractGraphicsContainer extends AbstractStructuredAFPObject
+implements PreparedAFPObject {
+    
+    /**
+     * list of objects contained within this container  
+     */
+    protected List list = null;
+    
+    /**
+     * Default constructor
+     */
+    public AbstractGraphicsContainer() {
+    }
+    
+    /**
+     * Named constructor
+     * @param name the name of the container
+     */
+    public AbstractGraphicsContainer(String name) {
+        super(name);
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    protected void writeContent(OutputStream os) throws IOException {
+        if (list != null) {
+            super.writeObjectList(list, os);
+        }
+    }
+    
+    /**
+     * Adds a given graphics drawing order to this container
+     * @param drawingOrder the graphics drawing order
+     * @return the drawingOrder if it was added, null otherwise
+     */
+    protected PreparedAFPObject addDrawingOrder(PreparedAFPObject drawingOrder) {
+        log.debug(this + " adding " + drawingOrder);
+        if (list == null) {
+            this.list = new java.util.ArrayList();
+        }
+        list.add(drawingOrder);
+        return drawingOrder;
+    }
+    
+    /**
+     * @return the current data length of this container including
+     * all enclosed GOCA drawing objects (and their containers)
+     */
+    public int getDataLength() {
+        int dataLen = 0;
+        if (list != null) {
+            Iterator it = list.iterator();
+            while (it.hasNext()) {
+                Object obj = it.next();
+                if (obj instanceof PreparedAFPObject) {
+                    dataLen += ((PreparedAFPObject)obj).getDataLength();
+                }
+            }
+        }
+        return dataLen;
+    } 
+}

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractGraphicsCoord.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractGraphicsCoord.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractGraphicsCoord.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractGraphicsCoord.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import org.apache.fop.render.afp.tools.BinaryUtils;
+
+/**
+ * A base class encapsulating the structure of coordinate based GOCA objects
+ */
+public abstract class AbstractGraphicsCoord extends AbstractPreparedAFPObject {
+
+    /** array of x/y coordinates */
+    protected int[] coords = null;
+
+    /**
+     * @param coords the x/y coordinates for this object
+     */
+    public AbstractGraphicsCoord(int[] coords) {
+        this.coords = coords;
+        prepareData();
+    }
+               
+    /**
+     * @param x the x coordinate for this object
+     * @param y the y coordinate for this object
+     */
+    public AbstractGraphicsCoord(int x, int y) {
+        this(new int[] {x, y});
+    }
+
+    /**
+     * @param x1 the x1 coordinate for this object
+     * @param y1 the y1 coordinate for this object
+     * @param x2 the x2 coordinate for this object
+     * @param y2 the y2 coordinate for this object
+     */
+    public AbstractGraphicsCoord(int x1, int y1, int x2, int y2) {
+        this(new int[] {x1, y1, x2, y2});
+    }
+
+    /**
+     * @return the order code to use
+     */
+    protected abstract byte getOrderCode();
+
+    /**
+     * @return the length of this order code
+     * (typically this is the same as the coordinate length)
+     */
+    protected int getLength() {
+        return this.coords.length * 2;
+    }
+
+    /**
+     * Creates a newly created and initialized byte data
+     * @return a newly created and initialized byte data
+     */
+    protected byte[] createData() {
+        int len = getLength();
+        byte[] data = new byte[len + 2];
+        data[0] = getOrderCode(); // ORDER CODE
+        data[1] = (byte)len; // LENGTH
+        return data;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void prepareData() {
+        super.data = createData();
+        int fromIndex = data.length - getLength();
+        addCoords(data, fromIndex);
+    }
+
+    /**
+     * Adds the coordinates to the structured field data
+     * @param data the structured field data
+     * @param fromIndex the start index
+     */
+    protected void addCoords(byte[] data, int fromIndex) {
+        // X/Y POS
+        for (int i = 0; i < coords.length; i++, fromIndex += 2) {
+            byte[] coord = BinaryUtils.convert(coords[i], 2);
+            data[fromIndex] = coord[0];
+            data[fromIndex + 1] = coord[1];            
+        }
+    }
+    
+    /**
+     * @return the short name of this GOCA object
+     */
+    protected String getName() {
+        String className = getClass().getName();
+        return className.substring(className.lastIndexOf(".") + 1);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        String coordsStr = "";
+        for (int i = 0; i < coords.length; i++) {
+            coordsStr += (i % 2 == 0) ? "x" : "y";
+            coordsStr += (i / 2) + "=" + coords[i] + ",";                   
+        }
+        coordsStr = coordsStr.substring(0, coordsStr.length() - 1);
+        return getName() + "(" + coordsStr + ")";
+    }        
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractPreparedAFPObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractPreparedAFPObject.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractPreparedAFPObject.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/AbstractPreparedAFPObject.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.fop.render.afp.modca.AbstractAFPObject;
+import org.apache.fop.render.afp.modca.PreparedAFPObject;
+
+/**
+ * A base class that carries out early preparation of structured field data
+ * for the AFP object (so the data length can be pre-calculated)
+ */
+public abstract class AbstractPreparedAFPObject extends AbstractAFPObject
+implements PreparedAFPObject {
+
+    /** structured field data to be written */
+    protected byte[] data = null;
+        
+    /**
+     * {@inheritDoc}
+     */
+    public void writeDataStream(OutputStream os) throws IOException {
+        if (this.data != null) {
+            os.write(this.data);
+        }
+    }
+
+    /**
+     * @return the data length of this prepared AFP object
+     */
+    public int getDataLength() {
+        if (this.data != null) {
+            return this.data.length;
+        }
+        return 0;
+    }    
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsArea.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsArea.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsArea.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsArea.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * A GOCA graphics area (container for filled shapes/objects)
+ */
+public final class GraphicsArea extends AbstractGraphicsContainer {
+
+    /** draw boundary lines around this area */
+    private boolean drawBoundary = false;
+    
+    /**
+     * Sets whether boundary lines are drawn
+     * @param drawBoundaryLines whether boundary lines are drawn
+     */
+    public void setDrawBoundaryLines(boolean drawBoundaryLines) {
+        this.drawBoundary = drawBoundaryLines;
+    }
+    
+    private static final int RES1 = 1;
+    private static final int BOUNDARY = 2;        
+    private static final int NO_BOUNDARY = 0;
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int getDataLength() {
+        // start len + end len + data len
+        return 4 + super.getDataLength();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void writeStart(OutputStream os) throws IOException {
+        super.writeStart(os);
+        byte[] data = new byte[] {
+            (byte)0x68, // GBAR order code
+            (byte)(RES1 + (drawBoundary ? BOUNDARY : NO_BOUNDARY)) 
+        };
+        os.write(data);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void writeEnd(OutputStream os) throws IOException {
+        byte[] endData = new byte[] {
+            (byte)0x60, // GEAR order code
+            0x00, // LENGTH
+        };
+        os.write(endData);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return "GraphicsArea";
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsBox.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsBox.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsBox.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsBox.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+/**
+ * A GOCA graphics rectangular box
+ */
+public final class GraphicsBox extends AbstractGraphicsCoord {
+
+    /**
+     * @param coords the x/y coordinates for this object
+     */
+    public GraphicsBox(int[] coords) {
+        super(coords);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected byte getOrderCode() {
+        return (byte)0xC0;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    protected int getLength() {
+        return 10;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void prepareData() {
+        super.data = createData();
+        final int fromIndex = 4;
+        addCoords(data, fromIndex);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected byte[] createData() {
+        byte[] data = super.createData();
+        data[2] = (byte)0x20; // CONTROL draw control flags
+        data[3] = 0x00; // reserved
+        return data;
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsChainedSegment.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsChainedSegment.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsChainedSegment.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsChainedSegment.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.fop.render.afp.modca.PreparedAFPObject;
+import org.apache.fop.render.afp.tools.BinaryUtils;
+
+/**
+ * A GOCA graphics segment
+ */
+public final class GraphicsChainedSegment extends AbstractGraphicsContainer {
+
+    /**
+     * The maximum segment data length
+     */
+    protected static final int MAX_DATA_LEN = 8192;
+
+    /** the current area */
+    private GraphicsArea currentArea = null;
+
+    /** the previous segment in the chain */
+    private GraphicsChainedSegment previous = null;
+
+    /** the next segment in the chain */
+    private GraphicsChainedSegment next = null;
+
+    /**
+     * Main constructor
+     * 
+     * @param name
+     *            the name of this graphics segment
+     */
+    public GraphicsChainedSegment(String name) {
+        super(name);
+    }
+
+    /**
+     * Constructor
+     * 
+     * @param name
+     *            the name of this graphics segment
+     * @param previous
+     *            the previous graphics segment in this chain
+     */
+    public GraphicsChainedSegment(String name, GraphicsChainedSegment previous) {
+        super(name);
+        previous.next = this;
+        this.previous = previous;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getDataLength() {
+        int dataLen = 14 + super.getDataLength();
+        if (previous == null) {
+            GraphicsChainedSegment current = this.next;
+            while (current != null) {
+                dataLen += current.getDataLength();
+                current = current.next;
+            }
+        }
+        return dataLen;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected int getNameLength() {
+        return 4;
+    }
+
+    private static final byte APPEND_NEW_SEGMENT = 0;
+
+    private static final byte PROLOG = 4;
+
+    private static final byte APPEND_TO_EXISING = 48;
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void writeStart(OutputStream os) throws IOException {
+        super.writeStart(os);
+        int len = super.getDataLength();
+        byte[] segLen = BinaryUtils.convert(len, 2);
+        byte[] data = new byte[] {
+            0x70, // BEGIN_SEGMENT
+            0x0C, // Length of following parameters
+            this.nameBytes[0],
+            this.nameBytes[1],
+            this.nameBytes[2],
+            this.nameBytes[3],
+            0x00, // FLAG1 (ignored)
+            APPEND_NEW_SEGMENT,
+            segLen[0], // SEGL
+            segLen[1],
+            0x00,
+            0x00,
+            0x00,
+            0x00
+        };
+        // P/S NAME (predecessor name)
+        if (previous != null) {
+            data[10] = previous.nameBytes[0];
+            data[11] = previous.nameBytes[1];
+            data[12] = previous.nameBytes[2];
+            data[13] = previous.nameBytes[3];
+        }
+        os.write(data);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void writeEnd(OutputStream os) throws IOException {
+        // I am the first segment in the chain so write out the rest
+        if (previous == null) {
+            GraphicsChainedSegment current = this.next;
+            while (current != null) {
+                current.writeDataStream(os);
+                current = current.next;
+            }
+        }
+    }
+
+    /**
+     * Begins a graphics area (start of fill)
+     */
+    protected void beginArea() {
+        this.currentArea = new GraphicsArea();
+        super.addDrawingOrder(currentArea);
+    }
+
+    /**
+     * Ends a graphics area (end of fill)
+     */
+    protected void endArea() {
+        this.currentArea = null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected PreparedAFPObject addDrawingOrder(PreparedAFPObject drawingOrder) {
+        if (currentArea != null) {
+            currentArea.addDrawingOrder(drawingOrder);
+        } else {
+            super.addDrawingOrder(drawingOrder);
+        }
+        return drawingOrder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return "GraphicsChainedSegment(name=" + super.name + ")";
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsData.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsData.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsData.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import org.apache.fop.render.afp.modca.PreparedAFPObject;
+import org.apache.fop.render.afp.tools.BinaryUtils;
+import org.apache.fop.render.afp.tools.StringUtils;
+
+/**
+ * A GOCA graphics data
+ */
+public final class GraphicsData extends AbstractGraphicsContainer {   
+    
+    /**
+     * The maximum graphics data length
+     */ 
+    public static final int MAX_DATA_LEN = 32767;
+
+    /**
+     * Default constructor
+     */
+    public GraphicsData() {
+    }
+
+    /**
+     * The graphics segment
+     */
+    private GraphicsChainedSegment currentSegment = null;
+    
+    /**
+     * {@inheritDoc}
+     */
+    public int getDataLength() {
+        return 8 + super.getDataLength();
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    protected void writeStart(OutputStream os) throws IOException {
+        super.writeStart(os);
+        int l = getDataLength();
+        byte[] len = BinaryUtils.convert(l, 2);
+        byte[] data = new byte[] {
+            0x5A, // Structured field identifier
+            len[0], // Length byte 1
+            len[1], // Length byte 2
+            (byte) 0xD3, // Structured field id byte 1
+            (byte) 0xEE, // Structured field id byte 2
+            (byte) 0xBB, // Structured field id byte 3
+            0x00, // Flags
+            0x00, // Reserved
+            0x00  // Reserved
+        };
+        os.write(data);
+    }
+
+    /**
+     * Begins a graphics area (start of fill)
+     */
+    public void beginArea() {
+        getSegment().beginArea();
+    }
+    
+    /**
+     * Ends a graphics area (end of fill)
+     */
+    public void endArea() {
+        getSegment().endArea();
+    }
+
+    /**
+     * Returns a new segment name
+     * @return a new segment name
+     */
+    private String createSegmentName() {
+        return StringUtils.lpad(String.valueOf(
+                (super.list != null ? super.list.size() : 0) + 1),
+            '0', 4);        
+    }
+    
+    /**
+     * Returns the current graphics segment, creating one if one does not exist
+     * @return the current graphics chained segment
+     */
+     GraphicsChainedSegment getSegment() {
+        if (currentSegment == null) {
+            newSegment();
+        }
+        return this.currentSegment;
+    }
+
+    /**
+     * Creates a new graphics segment
+     * @return a newly created graphics segment
+     */
+    public GraphicsChainedSegment newSegment() {
+        String name = createSegmentName();
+        if (currentSegment == null) {
+            this.currentSegment = new GraphicsChainedSegment(name);            
+        } else {
+            this.currentSegment = new GraphicsChainedSegment(name, currentSegment);            
+        }
+        super.addDrawingOrder(currentSegment);
+        return currentSegment;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public PreparedAFPObject addDrawingOrder(PreparedAFPObject drawingOrder) {
+        if (currentSegment == null 
+            || (currentSegment.getDataLength() + drawingOrder.getDataLength())
+            >= GraphicsChainedSegment.MAX_DATA_LEN) {
+            newSegment();
+        }
+        currentSegment.addDrawingOrder(drawingOrder);
+        return drawingOrder;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return "GraphicsData";
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsFillet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsFillet.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsFillet.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsFillet.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+/**
+ * A GOCA graphics curved tangential line to a specified set of
+ * straight lines drawn from the given position or current position
+ */
+public final class GraphicsFillet extends AbstractGraphicsCoord {
+    
+    /**
+     * @param coords the x/y coordinates for this object
+     */
+    public GraphicsFillet(int[] coords) {
+        super(coords);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected byte getOrderCode() {
+        return (byte)0xC5;
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsFullArc.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsFullArc.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsFullArc.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsFullArc.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import org.apache.fop.render.afp.tools.BinaryUtils;
+
+/**
+ * A GOCA graphics arc (circle/ellipse)
+ */
+public class GraphicsFullArc extends AbstractGraphicsCoord {
+    /** the integer portion of the multiplier */
+    private int mh;
+    
+    /** the fractional portion of the multiplier */
+    private int mhr;
+    
+    /**
+     * @param x the x coordinate of the center of the circle/ellipse
+     * @param y the y coordinate of the center of the circle/ellipse
+     * @param mh the integer portion of the multiplier
+     * @param mhr the fractional portion of the multiplier
+     */
+    public GraphicsFullArc(int x, int y, int mh, int mhr) {
+        super(x, y);
+        this.mh = mh;
+        this.mhr = mhr;
+        // integer portion of multiplier
+        data[data.length - 2] = BinaryUtils.convert(mh, 1)[0];
+        // fractional portion of multiplier
+        data[data.length - 1] = BinaryUtils.convert(mhr, 1)[0]; 
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected byte getOrderCode() {
+        return (byte)0xC7;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected int getLength() {
+        return super.getLength() + 2;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void prepareData() {
+        super.data = super.createData();
+        final int fromIndex = 2;
+        super.addCoords(data, fromIndex);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return super.getName()
+        + "(centerx=" + coords[0] + ",centery=" + coords[1]
+        + ",mh=" + mh + ",mhr=" + mhr + ")";
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageBegin.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageBegin.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageBegin.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageBegin.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import org.apache.fop.render.afp.tools.BinaryUtils;
+
+/**
+ * A GOCA graphics begin image object
+ */
+public final class GraphicsImageBegin extends AbstractPreparedAFPObject {
+    /** x coordinate */
+    private int x;
+
+    /** y coordinate */
+    private int y;
+
+    /** width */
+    private int width;
+
+    /** height */
+    private int height;
+
+    /**
+     * @param x the x coordinate of the image
+     * @param y the y coordinate of the image
+     * @param width the image width
+     * @param height the image height
+     */
+    public GraphicsImageBegin(int x, int y, int width, int height) {
+        this.x = x;
+        this.y = y;
+        this.width = width;
+        this.height = height;
+        prepareData();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void prepareData() {
+        byte[] xcoord = BinaryUtils.convert(x, 2);
+        byte[] ycoord = BinaryUtils.convert(y, 2);
+        byte[] w = BinaryUtils.convert(width, 2);
+        byte[] h = BinaryUtils.convert(height, 2);
+        super.data = new byte[] {
+            (byte) 0xD1, // GBIMG order code
+            (byte) 0x0A, // LENGTH
+            xcoord[0],
+            xcoord[1],
+            ycoord[0],
+            ycoord[1],
+            0x00, // FORMAT
+            0x00, // RES
+            w[0], // WIDTH
+            w[1], //
+            h[0], // HEIGHT
+            h[1] //
+        };
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return "GraphicsImageBegin(x=" + x + ",y=" + y
+            + ",width=" + width + ",height=" + height + ")";
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageData.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageData.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageData.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import org.apache.fop.render.afp.tools.BinaryUtils;
+
+/**
+ * A GOCA graphics image data
+ */
+public final class GraphicsImageData extends AbstractPreparedAFPObject {    
+    
+    /** the maximum image data length */
+    public static final short MAX_DATA_LEN = 255;
+
+    /**
+     * Main constructor
+     * 
+     * @param imageData the image data
+     * @param startIndex the start index to read the image data from 
+     */
+    public GraphicsImageData(byte[] imageData, int startIndex) {
+        int dataLen = MAX_DATA_LEN;
+        if (startIndex + MAX_DATA_LEN >= imageData.length) {
+            dataLen = imageData.length - startIndex - 1;
+        }
+        super.data = new byte[dataLen + 2];
+        data[0] = (byte) 0x92; // GIMD
+        data[1] = BinaryUtils.convert(dataLen, 1)[0]; // LENGTH
+        System.arraycopy(imageData, startIndex, data, 2, dataLen);
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return "GraphicsImageData("
+            + (data != null ? "" + (data.length - 2) : "null")
+            + ")";
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageEnd.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageEnd.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageEnd.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsImageEnd.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+/**
+ * A GOCA graphics image data
+ */
+public class GraphicsImageEnd extends AbstractPreparedAFPObject {
+    
+    /**
+     * Default constructor
+     */
+    public GraphicsImageEnd() {
+        prepareData();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void prepareData() {
+        super.data = new byte[] {
+            (byte) 0x93, // GEIMG order code
+            0x00 // LENGTH
+        };
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return "GraphicsImageEnd";
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsLine.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsLine.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsLine.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsLine.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+
+/**
+ * A GOCA graphics straight line drawn from the
+ * given position or current position.
+ */
+public class GraphicsLine extends AbstractGraphicsCoord {
+
+    /**
+     * @param coords the x/y coordinates for this object
+     */
+    public GraphicsLine(int[] coords) {
+        super(coords);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected byte getOrderCode() {
+        return (byte)0xC1;                
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetArcParameters.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetArcParameters.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetArcParameters.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetArcParameters.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+/**
+ * Sets the arc parameters for a GOCA graphics arc (circle/ellipse)
+ */
+public class GraphicsSetArcParameters extends AbstractGraphicsCoord {
+
+    /**
+     * @param xmaj x coordinate of the major axis point
+     * @param ymin y coordinate of the minor axis point
+     * @param xmin x coordinate of the minor axis point
+     * @param ymaj y coordinate of the major axis point
+     */
+    public GraphicsSetArcParameters(int xmaj, int ymin, int xmin, int ymaj) {
+        super(xmaj, ymin, xmin, ymaj);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected byte getOrderCode() {
+        return 0x22;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return getName() + "(xmaj=" + coords[0]
+            + ",ymin=" + coords[1]
+            + ",xmin=" + coords[2]
+            + ",ymaj=" + coords[3] + ")";
+    }
+}
\ No newline at end of file

Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetCharacterSet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetCharacterSet.java?rev=603590&view=auto
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetCharacterSet.java (added)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/modca/goca/GraphicsSetCharacterSet.java Wed Dec 12 04:24:10 2007
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id: $ */
+
+package org.apache.fop.render.afp.modca.goca;
+
+import org.apache.fop.render.afp.tools.BinaryUtils;
+
+/**
+ * Sets the current character set (font) to be used for following graphics strings 
+ */
+public class GraphicsSetCharacterSet extends AbstractPreparedAFPObject {
+    /** font character set reference */
+    private int fontReference;
+
+    /**
+     * @param fontReference character set font reference
+     */
+    public GraphicsSetCharacterSet(int fontReference) {
+        this.fontReference = fontReference;
+        prepareData();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected void prepareData() {
+        super.data = new byte[] {
+            0x38, // GSCS order code
+            BinaryUtils.convert(fontReference)[0]
+        };
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return "GraphicsSetCharacterSet(" + fontReference + ")";
+    }
+}
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org