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 2008/06/09 13:19:44 UTC

svn commit: r664679 - in /xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp: ./ modca/

Author: acumiskey
Date: Mon Jun  9 04:19:44 2008
New Revision: 664679

URL: http://svn.apache.org/viewvc?rev=664679&view=rev
Log:
* Created new AreaObjectInfo class POJO to cleanup all this long parameter passingthat seems to be going on.
* convertToGrayscale() method changed so that it is performing an atomic function, again simplified/cleaned up parameter passing.
* Fixed bug with handling TIFF images.

Added:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ObjectAreaInfo.java   (with props)
Modified:
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPSVGHandler.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/DataObjectInfo.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ImageObjectInfo.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/AbstractDataObject.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/DataObjectFactory.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/GraphicsObject.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/IncludeObject.java
    xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java?rev=664679&r1=664678&r2=664679&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRenderer.java Mon Jun  9 04:19:44 2008
@@ -923,8 +923,7 @@
             getAFPDataStream().createIncludePageSegment(name, mpts2units(x),
                     mpts2units(y));
         } else {
-            ImageManager manager = getUserAgent().getFactory()
-                    .getImageManager();
+            ImageManager manager = getUserAgent().getFactory().getImageManager();
             ImageInfo info = null;
             InputStream in = null;
             try {
@@ -967,12 +966,16 @@
                     ImageObjectInfo imageObjectInfo = new ImageObjectInfo();
                     imageObjectInfo.setUri(uri);
                     imageObjectInfo.setMimeType(mimeType);
-                    imageObjectInfo.setX(afpx);
-                    imageObjectInfo.setY(afpy);
-                    imageObjectInfo.setWidth(afpw);
-                    imageObjectInfo.setHeight(afph);
-                    imageObjectInfo.setWidthRes(afpres);
-                    imageObjectInfo.setHeightRes(afpres);
+                    
+                    ObjectAreaInfo objectAreaInfo = new ObjectAreaInfo();
+                    objectAreaInfo.setX(afpx);
+                    objectAreaInfo.setY(afpy);
+                    objectAreaInfo.setWidth(afpw);
+                    objectAreaInfo.setHeight(afph);
+                    objectAreaInfo.setWidthRes(afpres);
+                    objectAreaInfo.setHeightRes(afpres);
+                    imageObjectInfo.setObjectAreaInfo(objectAreaInfo);
+                    
                     imageObjectInfo.setData(buf);
                     imageObjectInfo.setDataHeight(ccitt.getSize().getHeightPx());
                     imageObjectInfo.setDataWidth(ccitt.getSize().getWidthPx());
@@ -1068,23 +1071,27 @@
 
         // create image object parameters
         ImageObjectInfo imageObjectInfo = new ImageObjectInfo();
+        imageObjectInfo.setBuffered(true);
         if (imageInfo != null) {
             imageObjectInfo.setUri(imageInfo.getOriginalURI());
             imageObjectInfo.setMimeType(imageInfo.getMimeType());
         }
-        imageObjectInfo.setX(mpts2units(x));
-        imageObjectInfo.setY(mpts2units(y));
-        imageObjectInfo.setWidth(mpts2units(w));
-        imageObjectInfo.setHeight(mpts2units(h));
-        imageObjectInfo.setWidthRes(imageRes);
-        imageObjectInfo.setHeightRes(imageRes);
+
+        ObjectAreaInfo objectAreaInfo = new ObjectAreaInfo();
+        objectAreaInfo.setX(mpts2units(x));
+        objectAreaInfo.setY(mpts2units(y));
+        objectAreaInfo.setWidth(mpts2units(w));
+        objectAreaInfo.setHeight(mpts2units(h));
+        objectAreaInfo.setWidthRes(imageRes);
+        objectAreaInfo.setHeightRes(imageRes);
+        imageObjectInfo.setObjectAreaInfo(objectAreaInfo);
+        
         imageObjectInfo.setData(baout.toByteArray());
         imageObjectInfo.setDataHeight(image.getHeight());
         imageObjectInfo.setDataWidth(image.getWidth());
         imageObjectInfo.setColor(colorImages);
         imageObjectInfo.setBitsPerPixel(bitsPerPixel);
         imageObjectInfo.setResourceInfoFromForeignAttributes(foreignAttributes);
-
         getAFPDataStream().createObject(imageObjectInfo);
     }
 

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java?rev=664679&r1=664678&r2=664679&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java Mon Jun  9 04:19:44 2008
@@ -274,7 +274,7 @@
                     afpRenderer.getAFPDataStream().setDefaultResourceGroupFile(resourceGroupFile);
                 } else {
                     log.warn("Unable to write to default external resource group file '"
-                                + resourceGroupDest);
+                                + resourceGroupDest + "'");
                 }
             }
         }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPSVGHandler.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPSVGHandler.java?rev=664679&r1=664678&r2=664679&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPSVGHandler.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/AFPSVGHandler.java Mon Jun  9 04:19:44 2008
@@ -153,23 +153,28 @@
         int height = (int)Math.round((afpInfo.getHeight() * res) / 72000f);
         
         // set the data object parameters
-        DataObjectInfo info = new DataObjectInfo();
+        DataObjectInfo dataObjectInfo = new DataObjectInfo();
         
         String docUri = ((AbstractDocument)doc).getDocumentURI();
-        info.setUri(docUri);
-        info.setX(x);
-        info.setY(y);
-        info.setWidth(width);
-        info.setHeight(height);
-        info.setWidthRes(res);
-        info.setHeightRes(res);
+        dataObjectInfo.setUri(docUri);
+
+        ObjectAreaInfo objectAreaInfo = new ObjectAreaInfo();
+        objectAreaInfo.setX(x);
+        objectAreaInfo.setY(y);
+        objectAreaInfo.setWidth(width);
+        objectAreaInfo.setHeight(height);
+        objectAreaInfo.setWidthRes(res);
+        objectAreaInfo.setHeightRes(res);
+        
+        dataObjectInfo.setObjectAreaInfo(objectAreaInfo);
+        
         Map/*<QName, String>*/ foreignAttributes
             = (Map/*<QName, String>*/)context.getProperty(
                 RendererContextConstants.FOREIGN_ATTRIBUTES);
-        info.setResourceInfoFromForeignAttributes(foreignAttributes);
+        dataObjectInfo.setResourceInfoFromForeignAttributes(foreignAttributes);
 
         AFPDataStream afpDataStream = afpInfo.getAFPDataStream();
-        GraphicsObject graphicsObj = (GraphicsObject)afpDataStream.createObject(info);
+        GraphicsObject graphicsObj = (GraphicsObject)afpDataStream.createObject(dataObjectInfo);
         graphics.setGraphicsObject(graphicsObj);
         
         try {

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/DataObjectInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/DataObjectInfo.java?rev=664679&r1=664678&r2=664679&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/DataObjectInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/DataObjectInfo.java Mon Jun  9 04:19:44 2008
@@ -42,13 +42,9 @@
     private static final ResourceInfo DEFAULT_RESOURCE_INFO = new ResourceInfo();
     
     private String uri;
-    private int x;
-    private int y;
-    private int width;
-    private int height;
-    private int widthRes;
-    private int heightRes;
-    private int rotation = 0;
+    
+    /** the object area info */
+    private ObjectAreaInfo objectAreaInfo;    
     
     /** object type entry */
     private ObjectType objectType;
@@ -70,53 +66,6 @@
         this.uri = uri;
     }
 
-    /**
-     * Sets the x position of the data object
-     * @param x the x position of the data object
-     */
-    protected void setX(int x) {
-        this.x = x;
-    }
-
-    /**
-     * Sets the y position of the data object
-     * @param y the y position of the data object
-     */
-    protected void setY(int y) {
-        this.y = y;
-    }
-
-    /**
-     * Sets the data object width
-     * @param width the width of the data object
-     */
-    protected void setWidth(int width) {
-        this.width = width;
-    }
-
-    /**
-     * Sets the data object height
-     * @param height the height of the data object
-     */
-    protected void setHeight(int height) {
-        this.height = height;
-    }
-
-    /**
-     * Sets the width resolution
-     * @param widthRes the width resolution
-     */
-    protected void setWidthRes(int widthRes) {
-        this.widthRes = widthRes;
-    }
-
-    /**
-     * Sets the height resolution
-     * @param heightRes the height resolution
-     */
-    protected void setHeightRes(int heightRes) {
-        this.heightRes = heightRes;
-    }
     
     /**
      * @return the uri of this data object
@@ -126,63 +75,6 @@
     }
 
     /**
-     * @return the x coordinate of this data object
-     */
-    public int getX() {
-        return x;
-    }
-
-    /**
-     * @return the y coordinate of this data object
-     */
-    public int getY() {
-        return y;
-    }
-
-    /**
-     * @return the width of this data object
-     */
-    public int getWidth() {
-        return width;
-    }
-
-    /**
-     * @return the height of this data object
-     */
-    public int getHeight() {
-        return height;
-    }
-
-    /**
-     * @return the width resolution of this data object
-     */
-    public int getWidthRes() {
-        return widthRes;
-    }
-
-    /**
-     * @return the height resolution of this data object
-     */
-    public int getHeightRes() {
-        return heightRes;
-    }
-    
-    /**
-     * @return the rotation of this data object
-     */
-    public int getRotation() {
-        return rotation;
-    }
-
-    /**
-     * Sets the data object rotation
-     * @param rotation the data object rotation
-     */
-    protected void setRotation(int rotation) {
-        this.rotation = rotation;
-    }
-
-    /**
      * Sets the object type
      * @param objectType the object type
      */    
@@ -213,6 +105,21 @@
     }
 
     /**
+     * Sets the object area info
+     * @param objectAreaInfo the object area info
+     */
+    public void setObjectAreaInfo(ObjectAreaInfo objectAreaInfo) {
+        this.objectAreaInfo = objectAreaInfo;
+    }
+
+    /**
+     * @return the object area info
+     */
+    public ObjectAreaInfo getObjectAreaInfo() {
+        return this.objectAreaInfo;
+    }
+
+    /**
      * Sets the resource group settings using the given foreign attributes
      * @param foreignAttributes a mapping of element attributes names to values
      */
@@ -278,14 +185,8 @@
      */
     public String toString() {
         return "uri=" + uri
-            + ", x=" + x
-            + ", y=" + y
-            + ", width=" + width
-            + ", height=" + height
-            + ", widthRes=" + widthRes
-            + ", heightRes=" + heightRes
-            + ", rotation=" + rotation
-            + (resourceInfo != null ? ", resourceInfo=" + resourceInfo : "")
-            + (objectType != null ? ", objectTypeEntry=" + objectType : "");
+            + (objectAreaInfo != null ? "objectAreaInfo=" + objectAreaInfo : "")
+            + (objectType != null ? ", objectType=" + objectType : "")
+            + (resourceInfo != null ? ", resourceInfo=" + resourceInfo : "");
     }
 }

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ImageObjectInfo.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ImageObjectInfo.java?rev=664679&r1=664678&r2=664679&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ImageObjectInfo.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ImageObjectInfo.java Mon Jun  9 04:19:44 2008
@@ -29,7 +29,8 @@
     private byte[] data;
     private int dataWidth;
     private int dataHeight;
-    private String mimeType;    
+    private String mimeType;
+    private boolean buffered;    
 
     /**
      * Default constructor
@@ -151,6 +152,21 @@
     }
 
     /**
+     * Sets whether or not this is info about a buffered image
+     * @param buffered true if this is info about a buffered image
+     */
+    public void setBuffered(boolean buffered) {
+        this.buffered = buffered;
+    }
+
+    /**
+     * @return true if this image info is about a buffered image
+     */
+    public boolean isBuffered() {
+        return this.buffered;
+    }
+    
+    /**
      * {@inheritDoc}
      */
     public String toString() {
@@ -161,4 +177,5 @@
             + ", color=" + color
             + ", bitPerPixel=" + bitsPerPixel;
     }
+
 }
\ No newline at end of file

Added: 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=664679&view=auto
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ObjectAreaInfo.java (added)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ObjectAreaInfo.java Mon Jun  9 04:19:44 2008
@@ -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;
+
+public class ObjectAreaInfo {
+    private int x;
+    private int y;
+    private int width;
+    private int height;
+    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) {
+        this.x = x;
+    }
+
+    /**
+     * Sets the y position of the data object
+     * @param y the y position of the data object
+     */
+    protected void setY(int y) {
+        this.y = y;
+    }
+
+    /**
+     * Sets the data object width
+     * @param width the width of the data object
+     */
+    protected void setWidth(int width) {
+        this.width = width;
+    }
+
+    /**
+     * Sets the data object height
+     * @param height the height of the data object
+     */
+    protected void setHeight(int height) {
+        this.height = height;
+    }
+
+    /**
+     * Sets the width resolution
+     * @param widthRes the width resolution
+     */
+    protected void setWidthRes(int widthRes) {
+        this.widthRes = widthRes;
+    }
+
+    /**
+     * Sets the height resolution
+     * @param heightRes the height resolution
+     */
+    protected void setHeightRes(int heightRes) {
+        this.heightRes = heightRes;
+    }
+    
+    /**
+     * @return the x coordinate of this data object
+     */
+    public int getX() {
+        return x;
+    }
+
+    /**
+     * @return the y coordinate of this data object
+     */
+    public int getY() {
+        return y;
+    }
+
+    /**
+     * @return the width of this data object
+     */
+    public int getWidth() {
+        return width;
+    }
+
+    /**
+     * @return the height of this data object
+     */
+    public int getHeight() {
+        return height;
+    }
+
+    /**
+     * @return the width resolution of this data object
+     */
+    public int getWidthRes() {
+        return widthRes;
+    }
+
+    /**
+     * @return the height resolution of this data object
+     */
+    public int getHeightRes() {
+        return heightRes;
+    }
+    
+    /**
+     * @return the rotation of this data object
+     */
+    public int getRotation() {
+        return rotation;
+    }
+
+    /**
+     * Sets the data object rotation
+     * @param rotation the data object rotation
+     */
+    protected void setRotation(int rotation) {
+        this.rotation = rotation;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public String toString() {
+        return "x=" + x
+        + ", y=" + y
+        + ", width=" + width
+        + ", height=" + height
+        + ", widthRes=" + widthRes
+        + ", heightRes=" + heightRes
+        + ", rotation=" + rotation;
+    }
+}
\ No newline at end of file

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ObjectAreaInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/ObjectAreaInfo.java
------------------------------------------------------------------------------
    svn:keywords = Revision Id

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=664679&r1=664678&r2=664679&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 Mon Jun  9 04:19:44 2008
@@ -492,7 +492,7 @@
                 }
             } else {
                 if (resourceLevel.isExternal()) {
-                    log.warn( interchangeSet
+                    log.warn(interchangeSet
                             + ": not available, object " + getName() + " will reside inline");
                 }                
             }
@@ -504,68 +504,68 @@
         return dataObj;
     }
 
-    /**
-     * Sets the object view port taking into account rotation.
-     * 
-     * @param x
-     *            the x position of the object
-     * @param y
-     *            the y position of the object
-     * @param w
-     *            the width of the object
-     * @param h
-     *            the height of the object
-     * @param wr
-     *            the resolution width of the object
-     * @param hr
-     *            the resolution height of the object
-     * @return a new graphics object
-     */
-    private void setObjectViewPort(AbstractDataObject dataObj, int x, int y,
-            int w, int h, int wr, int hr) {
-        int xOrigin;
-        int yOrigin;
-        int width;
-        int height;
-        int widthRes;
-        int heightRes;
-        switch (this.rotation) {
-        case 90:
-            xOrigin = getCurrentPage().getWidth() - y - yOffset;
-            yOrigin = x + xOffset;
-            width = h;
-            height = w;
-            widthRes = hr;
-            heightRes = wr;
-            break;
-        case 180:
-            xOrigin = getCurrentPage().getWidth() - x - xOffset;
-            yOrigin = getCurrentPage().getHeight() - y - yOffset;
-            width = w;
-            height = h;
-            widthRes = wr;
-            heightRes = hr;
-            break;
-        case 270:
-            xOrigin = y + yOffset;
-            yOrigin = getCurrentPage().getHeight() - x - xOffset;
-            width = h;
-            height = w;
-            widthRes = hr;
-            heightRes = wr;
-            break;
-        default:
-            xOrigin = x + xOffset;
-            yOrigin = y + yOffset;
-            width = w;
-            height = h;
-            widthRes = wr;
-            heightRes = hr;
-            break;
-        }
-        dataObj.setViewport(xOrigin, yOrigin, width, height, widthRes,
-                heightRes, rotation);
-    }
+//    /**
+//     * Sets the object view port taking into account rotation.
+//     * 
+//     * @param x
+//     *            the x position of the object
+//     * @param y
+//     *            the y position of the object
+//     * @param w
+//     *            the width of the object
+//     * @param h
+//     *            the height of the object
+//     * @param wr
+//     *            the resolution width of the object
+//     * @param hr
+//     *            the resolution height of the object
+//     * @return a new graphics object
+//     */
+//    private void setObjectViewPort(AbstractDataObject dataObj, int x, int y,
+//            int w, int h, int wr, int hr) {
+//        int xOrigin;
+//        int yOrigin;
+//        int width;
+//        int height;
+//        int widthRes;
+//        int heightRes;
+//        switch (this.rotation) {
+//        case 90:
+//            xOrigin = getCurrentPage().getWidth() - y - yOffset;
+//            yOrigin = x + xOffset;
+//            width = h;
+//            height = w;
+//            widthRes = hr;
+//            heightRes = wr;
+//            break;
+//        case 180:
+//            xOrigin = getCurrentPage().getWidth() - x - xOffset;
+//            yOrigin = getCurrentPage().getHeight() - y - yOffset;
+//            width = w;
+//            height = h;
+//            widthRes = wr;
+//            heightRes = hr;
+//            break;
+//        case 270:
+//            xOrigin = y + yOffset;
+//            yOrigin = getCurrentPage().getHeight() - x - xOffset;
+//            width = h;
+//            height = w;
+//            widthRes = hr;
+//            heightRes = wr;
+//            break;
+//        default:
+//            xOrigin = x + xOffset;
+//            yOrigin = y + yOffset;
+//            width = w;
+//            height = h;
+//            widthRes = wr;
+//            heightRes = hr;
+//            break;
+//        }
+//        dataObj.setViewport(xOrigin, yOrigin, width, height, widthRes,
+//                heightRes, rotation);
+//    }
 
     /**
      * Method to create a line on the current page.

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AbstractDataObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AbstractDataObject.java?rev=664679&r1=664678&r2=664679&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AbstractDataObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/AbstractDataObject.java Mon Jun  9 04:19:44 2008
@@ -22,6 +22,8 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
+import org.apache.fop.render.afp.ObjectAreaInfo;
+
 
 /**
  * Abstract base class used by the ImageObject and GraphicsObject which both
@@ -45,25 +47,11 @@
     /**
      * Sets the object display area position and size.
      *
-     * @param x
-     *            the x position of the object
-     * @param y
-     *            the y position of the object
-     * @param width
-     *            the width of the object
-     * @param height
-     *            the height of the object
-     * @param widthRes 
-     *            the resolution width 
-     * @param heightRes
-     *            the resolution height 
-     * @param rotation
-     *            the rotation of the object
-     */
-    public void setViewport(int x, int y, int width, int height,
-            int widthRes, int heightRes, int rotation) {
-        getObjectEnvironmentGroup().setObjectArea(x, y, width, height,
-                widthRes, heightRes, rotation);
+     * @param objectAreaInfo
+     *            the object area info
+     */
+    public void setViewport(ObjectAreaInfo objectAreaInfo) {
+        getObjectEnvironmentGroup().setObjectArea(objectAreaInfo);
     }
     
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/DataObjectFactory.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/DataObjectFactory.java?rev=664679&r1=664678&r2=664679&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/DataObjectFactory.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/DataObjectFactory.java Mon Jun  9 04:19:44 2008
@@ -21,6 +21,7 @@
 
 import org.apache.fop.render.afp.DataObjectInfo;
 import org.apache.fop.render.afp.ImageObjectInfo;
+import org.apache.fop.render.afp.ObjectAreaInfo;
 import org.apache.fop.render.afp.modca.triplets.FullyQualifiedNameTriplet;
 import org.apache.fop.render.afp.tools.StringUtils;
 import org.apache.xmlgraphics.image.codec.tiff.TIFFImage;
@@ -43,25 +44,23 @@
      * 
      * @param io
      *            the target image object
-     * @param raw
-     *            the buffer containing the RGB image data
-     * @param width
-     *            the width of the image in pixels
-     * @param height
-     *            the height of the image in pixels
-     * @param bitsPerPixel
-     *            the number of bits to use per pixel
-     *            
-     * TODO: move this method somewhere appropriate in commons
+     * @param info
+     *            the image object info
+     *
+     * @return the converted image data
      */
-    private static void convertToGrayScaleImage(ImageObject io, byte[] raw, int width,
-            int height, int bitsPerPixel) {
+    private static byte[] convertToGrayScaleImage(ImageObject io, ImageObjectInfo info) {
+        byte[] raw = info.getData();
+        int width = info.getDataWidth();
+        int height = info.getDataHeight();
+        int bitsPerPixel = info.getBitsPerPixel();
+        
         int pixelsPerByte = 8 / bitsPerPixel;
         int bytewidth = (width / pixelsPerByte);
         if ((width % pixelsPerByte) != 0) {
             bytewidth++;
         }
-        byte[] bw = new byte[height * bytewidth];
+        byte[] data = new byte[height * bytewidth];
         byte ib;
         for (int y = 0; y < height; y++) {
             ib = 0;
@@ -92,27 +91,26 @@
 
                 if ((x % pixelsPerByte) == (pixelsPerByte - 1)
                         || ((x + 1) == width)) {
-                    bw[(y * bytewidth) + (x / pixelsPerByte)] = ib;
+                    data[(y * bytewidth) + (x / pixelsPerByte)] = ib;
                     ib = 0;
                 }
             }
         }
-        io.setImageIDESize((byte) bitsPerPixel);
-        io.setImageData(bw);
+        return data;
     }
 
     /**
      * Helper method to create an image on the current container and to return
      * the object.
-     * @param info the image object info
+     * @param imageObjectInfo the image object info
      * @return a newly created image object
      */
-    protected ImageObject createImage(ImageObjectInfo info) {
+    protected ImageObject createImage(ImageObjectInfo imageObjectInfo) {
         String name = IMAGE_NAME_PREFIX
                 + StringUtils.lpad(String.valueOf(++imageCount), '0', 5);
         ImageObject imageObj = new ImageObject(name);
-        if (info.hasCompression()) {
-            int compression = info.getCompression();
+        if (imageObjectInfo.hasCompression()) {
+            int compression = imageObjectInfo.getCompression();
             switch (compression) {
             case TIFFImage.COMP_FAX_G3_1D:
                 imageObj.setImageEncoding(ImageContent.COMPID_G3_MH);
@@ -128,15 +126,19 @@
                             "Invalid compression scheme: " + compression);
             }
         }
-        imageObj.setImageParameters(info.getWidthRes(), info.getHeightRes(), 
-                info.getDataWidth(), info.getDataHeight());
-        if (info.isColor()) {
-            imageObj.setImageIDESize((byte)24);
-            imageObj.setImageData(info.getData());
-        } else {
-            convertToGrayScaleImage(imageObj, info.getData(),
-                    info.getDataWidth(), info.getDataHeight(),
-                    info.getBitsPerPixel());
+        ObjectAreaInfo objectAreaInfo = imageObjectInfo.getObjectAreaInfo();
+        imageObj.setImageParameters(objectAreaInfo.getWidthRes(), objectAreaInfo.getHeightRes(), 
+                imageObjectInfo.getDataWidth(), imageObjectInfo.getDataHeight());
+        if (imageObjectInfo.isBuffered()) {
+            if (imageObjectInfo.isColor()) {
+                imageObj.setImageIDESize((byte)24);
+                imageObj.setImageData(imageObjectInfo.getData());
+            } else {
+                int bitsPerPixel = imageObjectInfo.getBitsPerPixel();
+                imageObj.setImageIDESize((byte)bitsPerPixel);
+                byte[] data = convertToGrayScaleImage(imageObj, imageObjectInfo);
+                imageObj.setImageData(data);
+            }    
         }
         return imageObj;
     }
@@ -166,10 +168,7 @@
         } else {
             dataObject = createGraphic(dataObjectInfo);
         }
-        dataObject.setViewport(dataObjectInfo.getX(), dataObjectInfo.getY(),
-                dataObjectInfo.getWidth(), dataObjectInfo.getHeight(),
-                dataObjectInfo.getWidthRes(), dataObjectInfo.getHeightRes(),
-                dataObjectInfo.getRotation());
+        dataObject.setViewport(dataObjectInfo.getObjectAreaInfo());
 
         dataObject.setFullyQualifiedName(
             FullyQualifiedNameTriplet.TYPE_DATA_OBJECT_INTERNAL_RESOURCE_REF,

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/GraphicsObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/GraphicsObject.java?rev=664679&r1=664678&r2=664679&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/GraphicsObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/GraphicsObject.java Mon Jun  9 04:19:44 2008
@@ -23,6 +23,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
+import org.apache.fop.render.afp.ObjectAreaInfo;
 import org.apache.fop.render.afp.goca.GraphicsBox;
 import org.apache.fop.render.afp.goca.GraphicsData;
 import org.apache.fop.render.afp.goca.GraphicsFillet;
@@ -64,11 +65,15 @@
     /**
      * {@inheritDoc}
      */
-    public void setViewport(int x, int y, int width, int height,
-            int widthRes, int heightRes, int rotation) {
-        super.setViewport(x, y, width, height, widthRes, heightRes, rotation);
+    public void setViewport(ObjectAreaInfo objectAreaInfo) {
+        super.setViewport(objectAreaInfo);
         getObjectEnvironmentGroup().setGraphicsData(
-                widthRes, heightRes, 0, x + width, 0, y + height);        
+                objectAreaInfo.getWidthRes(),
+                objectAreaInfo.getHeightRes(),
+                0,
+                objectAreaInfo.getX() + objectAreaInfo.getWidth(),
+                0,
+                objectAreaInfo.getY() + objectAreaInfo.getHeight());        
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/IncludeObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/IncludeObject.java?rev=664679&r1=664678&r2=664679&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/IncludeObject.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/IncludeObject.java Mon Jun  9 04:19:44 2008
@@ -23,6 +23,7 @@
 import java.io.OutputStream;
 
 import org.apache.fop.render.afp.DataObjectInfo;
+import org.apache.fop.render.afp.ObjectAreaInfo;
 import org.apache.fop.render.afp.modca.triplets.FullyQualifiedNameTriplet;
 import org.apache.fop.render.afp.modca.triplets.MappingOptionTriplet;
 import org.apache.fop.render.afp.modca.triplets.ObjectClassificationTriplet;
@@ -133,8 +134,8 @@
         }
 
         DataObjectInfo dataObjectInfo = dataObjectAccessor.getDataObjectInfo();
-
-        setObjectArea(dataObjectInfo.getX(), dataObjectInfo.getY());
+        ObjectAreaInfo objectAreaInfo = dataObjectInfo.getObjectAreaInfo();
+        setObjectArea(objectAreaInfo.getX(), objectAreaInfo.getY());
         
         super.setFullyQualifiedName(
                 FullyQualifiedNameTriplet.TYPE_REPLACE_FIRST_GID_NAME,
@@ -147,11 +148,11 @@
              ObjectClassificationTriplet.CLASS_TIME_INVARIANT_PAGINATED_PRESENTATION_OBJECT,
              objectType);
         
-        super.setMeasurementUnits(dataObjectInfo.getWidthRes(), dataObjectInfo.getHeightRes());
+        super.setMeasurementUnits(objectAreaInfo.getWidthRes(), objectAreaInfo.getHeightRes());
         
         super.setMappingOption(MappingOptionTriplet.SCALE_TO_FIT);
         
-        super.setObjectAreaSize(dataObjectInfo.getWidth(), dataObjectInfo.getHeight());        
+        super.setObjectAreaSize(objectAreaInfo.getWidth(), objectAreaInfo.getHeight());        
     }
 
     /**

Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java?rev=664679&r1=664678&r2=664679&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/afp/modca/ObjectEnvironmentGroup.java Mon Jun  9 04:19:44 2008
@@ -22,6 +22,8 @@
 import java.io.IOException;
 import java.io.OutputStream;
 
+import org.apache.fop.render.afp.ObjectAreaInfo;
+
 
 /**
  * An Object Environment Group (OEG) may be associated with an object and is contained
@@ -79,20 +81,14 @@
 
     /**
      * Sets the object area parameters.
-     * @param x the x position of the object
-     * @param y the y position of the object
-     * @param width the object width
-     * @param height the object height
-     * @param rotation the object orientation
-     * @param widthRes the object resolution width
-     * @param heightRes the object resolution height
-     */
-    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);
-
+     * @param info the object area info
+     */
+    public void setObjectArea(ObjectAreaInfo info) {
+        this.objectAreaDescriptor = new ObjectAreaDescriptor(
+                info.getWidth(), info.getHeight(),
+                info.getWidthRes(), info.getHeightRes());
+        this.objectAreaPosition = new ObjectAreaPosition(
+                info.getX(), info.getY(), info.getRotation());
     }
 
     /**



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