xmlgraphics-fop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject svn commit: r675487 - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp: ObjectAreaInfo.java modca/AFPDataStream.java modca/ImageObject.java
Date Thu, 10 Jul 2008 09:30:49 GMT
Author: jeremias
Date: Thu Jul 10 02:30:48 2008
New Revision: 675487

URL: http://svn.apache.org/viewvc?rev=675487&view=rev
Log:
Fixed placement of bitmap images for AFP output.
Made setters public for ObjectAreaInfo.

Modified:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ObjectAreaInfo.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageObject.java

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ObjectAreaInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ObjectAreaInfo.java?rev=675487&r1=675486&r2=675487&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ObjectAreaInfo.java
(original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ObjectAreaInfo.java
Thu Jul 10 02:30:48 2008
@@ -5,9 +5,9 @@
  * 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.
@@ -26,12 +26,12 @@
     private int widthRes;
     private int heightRes;
     private int rotation = 0;
-    
+
     /**
      * Sets the x position of the data object
      * @param x the x position of the data object
      */
-    protected void setX(int x) {
+    public void setX(int x) {
         this.x = x;
     }
 
@@ -39,7 +39,7 @@
      * Sets the y position of the data object
      * @param y the y position of the data object
      */
-    protected void setY(int y) {
+    public void setY(int y) {
         this.y = y;
     }
 
@@ -47,7 +47,7 @@
      * Sets the data object width
      * @param width the width of the data object
      */
-    protected void setWidth(int width) {
+    public void setWidth(int width) {
         this.width = width;
     }
 
@@ -55,7 +55,7 @@
      * Sets the data object height
      * @param height the height of the data object
      */
-    protected void setHeight(int height) {
+    public void setHeight(int height) {
         this.height = height;
     }
 
@@ -63,7 +63,7 @@
      * Sets the width resolution
      * @param widthRes the width resolution
      */
-    protected void setWidthRes(int widthRes) {
+    public void setWidthRes(int widthRes) {
         this.widthRes = widthRes;
     }
 
@@ -71,10 +71,10 @@
      * Sets the height resolution
      * @param heightRes the height resolution
      */
-    protected void setHeightRes(int heightRes) {
+    public void setHeightRes(int heightRes) {
         this.heightRes = heightRes;
     }
-    
+
     /**
      * @return the x coordinate of this data object
      */
@@ -116,7 +116,7 @@
     public int getHeightRes() {
         return heightRes;
     }
-    
+
     /**
      * @return the rotation of this data object
      */
@@ -128,10 +128,10 @@
      * Sets the data object rotation
      * @param rotation the data object rotation
      */
-    protected void setRotation(int rotation) {
+    public void setRotation(int rotation) {
         this.rotation = rotation;
     }
-    
+
     /**
      * {@inheritDoc}
      */

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java?rev=675487&r1=675486&r2=675487&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
(original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AFPDataStream.java
Thu Jul 10 02:30:48 2008
@@ -28,8 +28,10 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+
 import org.apache.fop.render.afp.AFPFontAttributes;
 import org.apache.fop.render.afp.DataObjectInfo;
+import org.apache.fop.render.afp.ObjectAreaInfo;
 import org.apache.fop.render.afp.ResourceInfo;
 import org.apache.fop.render.afp.ResourceLevel;
 import org.apache.fop.render.afp.fonts.AFPFont;
@@ -42,7 +44,7 @@
  * destined for a presentation service, archive library, presentation device or
  * another application program. The strategic presentation data stream
  * architectures used is Mixed Object Document Content Architecture (MO:DCA).
- * 
+ *
  * The MO:DCA architecture defines the data stream used by applications to
  * describe documents and object envelopes for interchange with other
  * applications and application services. Documents defined in the MO:DCA format
@@ -177,7 +179,7 @@
     /**
      * The document is started by invoking this method which creates an instance
      * of the AFP Document object.
-     * 
+     *
      * @param name
      *            the name of this document.
      */
@@ -191,7 +193,7 @@
 
     /**
      * Sets the OutputStream
-     * 
+     *
      * @param outputStream
      *            the AFP OutputStream
      */
@@ -204,7 +206,7 @@
      * instance of the AFP Document object and registers the start with a
      * validation map which ensures that methods are not invoked out of the
      * correct sequence.
-     * 
+     *
      * @throws java.io.IOException
      *             throws an I/O exception of some sort has occurred
      */
@@ -228,13 +230,13 @@
         if (interchangeSet.supportsLevel2()) {
             // Write out any external resource groups
             getExternalResourceGroupManager().writeExternalResources();
-            
+
             // Write out any print-file level resources
             if (hasResources()) {
                 getResourceGroup().write(this.outputStream);
             }
         }
-        
+
         // Write out document
         if (document != null) {
             document.endDocument();
@@ -253,7 +255,7 @@
     /**
      * Start a new page. When processing has finished on the current page, the
      * {@link #endPage()}method must be invoked to mark the page ending.
-     * 
+     *
      * @param pageWidth
      *            the width of the page
      * @param pageHeight
@@ -281,7 +283,7 @@
      * Start a new overlay. When processing has finished on the current overlay,
      * the {@link #endOverlay()}method must be invoked to mark the overlay
      * ending.
-     * 
+     *
      * @param x
      *            the x position of the overlay on the page
      * @param y
@@ -329,7 +331,7 @@
 
     /**
      * Helper method to save the current page.
-     * 
+     *
      * @return current page object that was saved
      */
     public PageObject savePage() {
@@ -346,7 +348,7 @@
 
     /**
      * Helper method to restore the current page.
-     * 
+     *
      * @param pageObject
      *            page object
      */
@@ -373,7 +375,7 @@
 
     /**
      * Sets the offsets to be used for element positioning
-     * 
+     *
      * @param xOff
      *            the offset in the x direction
      * @param yOff
@@ -389,7 +391,7 @@
 
     /**
      * Creates the given page fonts in the current page
-     * 
+     *
      * @param pageFonts
      *            a collection of AFP font attributes
      */
@@ -407,7 +409,7 @@
      * Helper method to create a map coded font object on the current page, this
      * method delegates the construction of the map coded font object to the
      * active environment group on the current page.
-     * 
+     *
      * @param fontReference
      *            the font number used as the resource identifier
      * @param font
@@ -422,7 +424,7 @@
     /**
      * Helper method to create text on the current page, this method delegates
      * to the current presentation text object in order to construct the text.
-     * 
+     *
      * @param fontReference
      *            the font reference used as the resource identifier
      * @param x
@@ -447,7 +449,7 @@
     /**
      * Creates a data object in the datastream. The data object resides
      * according to its type, info and MO:DCA-L (resource) support.
-     * 
+     *
      * @param dataObjectInfo
      *            the data object info
      * @return a data object
@@ -465,6 +467,12 @@
             dataObjectInfo.setUri(uri);
         }
 
+        //Update placement with current state
+        ObjectAreaInfo areaInfo = dataObjectInfo.getObjectAreaInfo();
+        areaInfo.setX(areaInfo.getX() + this.xOffset);
+        areaInfo.setY(areaInfo.getY() + this.yOffset);
+        areaInfo.setRotation(this.rotation);
+
         Registry registry = Registry.getInstance();
         Registry.ObjectType objectType = registry.getObjectType(dataObjectInfo);
         // recognised object type
@@ -473,7 +481,7 @@
 
             ResourceInfo resourceInfo = dataObjectInfo.getResourceInfo();
             ResourceLevel resourceLevel = resourceInfo.getLevel();
-            
+
             // is MO:DCA-L available?
             if (interchangeSet.supportsLevel2()) {
                 // can this data object use the include object (IOB) referencing
@@ -494,7 +502,7 @@
                 if (resourceLevel.isExternal()) {
                     log.warn(interchangeSet
                             + ": not available, object " + getName() + " will reside inline");
-                }                
+                }
             }
         }
         // unrecognised/unsupported object type so create/embed data object
@@ -506,7 +514,7 @@
 
 //    /**
 //     * Sets the object view port taking into account rotation.
-//     * 
+//     *
 //     * @param x
 //     *            the x position of the object
 //     * @param y
@@ -569,7 +577,7 @@
 
     /**
      * Method to create a line on the current page.
-     * 
+     *
      * @param x1
      *            the first x coordinate of the line
      * @param y1
@@ -593,7 +601,7 @@
      * This method will create shading on the page using the specified
      * coordinates (the shading contrast is controlled via the red, green, blue
      * parameters, by converting this to grey scale).
-     * 
+     *
      * @param x
      *            the x coordinate of the shading
      * @param y
@@ -613,7 +621,7 @@
     /**
      * Helper method which allows creation of the MPO object, via the AEG. And
      * the IPO via the Page. (See actual object for descriptions.)
-     * 
+     *
      * @param name
      *            the name of the static overlay
      */
@@ -624,7 +632,7 @@
 
     /**
      * Helper method which allows creation of the IMM object.
-     * 
+     *
      * @param name
      *            the name of the medium map
      */
@@ -634,7 +642,7 @@
 
     /**
      * Creates an IncludePageSegment on the current page.
-     * 
+     *
      * @param name
      *            the name of the include page segment
      * @param x
@@ -668,7 +676,7 @@
 
     /**
      * Creates a TagLogicalElement on the current page.
-     * 
+     *
      * @param attributes
      *            the array of key value pairs.
      */
@@ -682,7 +690,7 @@
 
     /**
      * Creates a TagLogicalElement on the current page group.
-     * 
+     *
      * @param attributes
      *            the array of key value pairs.
      */
@@ -696,7 +704,7 @@
 
     /**
      * Creates a TagLogicalElement on the current page or page group
-     * 
+     *
      * @param name
      *            The tag name
      * @param value
@@ -712,7 +720,7 @@
 
     /**
      * Creates a NoOperation item
-     * 
+     *
      * @param content
      *            byte data
      */
@@ -753,7 +761,7 @@
     /**
      * Sets the rotation to be used for portrait pages, valid values are 0
      * (default), 90, 180, 270.
-     * 
+     *
      * @param pageRotation
      *            The rotation in degrees.
      */
@@ -770,7 +778,7 @@
     /**
      * Sets the rotation to be used for landscape pages, valid values are 0, 90,
      * 180, 270 (default).
-     * 
+     *
      * @param pageRotation
      *            The rotation in degrees.
      */
@@ -786,7 +794,7 @@
 
     /**
      * Returns the resource group for a given resource into
-     * 
+     *
      * @param level
      *            resource info
      * @return a resource group container for the given resource info
@@ -810,7 +818,7 @@
 
     /**
      * Sets the default resource group file
-     * 
+     *
      * @param resourceGroupFile
      *            the default resource group file
      */
@@ -846,7 +854,7 @@
 
         /**
          * Main constructor
-         * 
+         *
          * @param container
          *            the container of this manager
          */
@@ -857,7 +865,7 @@
 
         /**
          * Sets the default resource group file
-         * 
+         *
          * @param resourceGroupFile
          *            the default resource group file
          */
@@ -901,7 +909,7 @@
 
         /**
          * Returns the corresponding resource group for the given resource level
-         * 
+         *
          * @param level
          *            the resource level
          * @return the corresponding resource group for the given resource level
@@ -950,7 +958,7 @@
     }
 
     /**
-     * @return the MO:DCA interchange set in use 
+     * @return the MO:DCA interchange set in use
      */
     public InterchangeSet getInterchangeSet() {
         return this.interchangeSet;

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageObject.java?rev=675487&r1=675486&r2=675487&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageObject.java
(original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ImageObject.java
Thu Jul 10 02:30:48 2008
@@ -22,6 +22,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
+
 import org.apache.fop.render.afp.tools.BinaryUtils;
 
 /**
@@ -51,10 +52,7 @@
      * @param height the image height
      */
     public void setImageParameters(int xresol, int yresol, int width, int height) {
-        if (objectEnvironmentGroup == null) {
-            objectEnvironmentGroup = new ObjectEnvironmentGroup();
-        }
-        objectEnvironmentGroup.setImageData(xresol, yresol, width, height);
+        getObjectEnvironmentGroup().setImageData(xresol, yresol, width, height);
         if (imageSegment == null) {
             imageSegment = new ImageSegment();
         }



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


Mime
View raw message