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 je...@apache.org on 2007/02/03 23:22:27 UTC

svn commit: r503323 - in /xmlgraphics/fop/trunk: src/java-1.4/org/apache/fop/image/ImageIOImage.java status.xml

Author: jeremias
Date: Sat Feb  3 14:22:26 2007
New Revision: 503323

URL: http://svn.apache.org/viewvc?view=rev&rev=503323
Log:
Support for soft masks (transparency) with ImageIO image adapter. Should help with transparent PNGs.

Modified:
    xmlgraphics/fop/trunk/src/java-1.4/org/apache/fop/image/ImageIOImage.java
    xmlgraphics/fop/trunk/status.xml

Modified: xmlgraphics/fop/trunk/src/java-1.4/org/apache/fop/image/ImageIOImage.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java-1.4/org/apache/fop/image/ImageIOImage.java?view=diff&rev=503323&r1=503322&r2=503323
==============================================================================
--- xmlgraphics/fop/trunk/src/java-1.4/org/apache/fop/image/ImageIOImage.java (original)
+++ xmlgraphics/fop/trunk/src/java-1.4/org/apache/fop/image/ImageIOImage.java Sat Feb  3 14:22:26 2007
@@ -46,6 +46,8 @@
  */
 public class ImageIOImage extends AbstractFopImage {
 
+    private byte[] softMask = null;
+
     /**
      * Creates a new ImageIOImage.
      * @param info the image info from the ImageReader
@@ -163,22 +165,14 @@
                             }
                         }
                     } else {
-                        // TRANSLUCENT
-                        /*
-                         * this.isTransparent = false;
-                         * for (int i = 0; i < this.width * this.height; i++) {
-                         * if (cm.getAlpha(tmpMap[i]) == 0) {
-                         * this.isTransparent = true;
-                         * this.transparentColor = new PDFColor(cm.getRed(tmpMap[i]), 
-                         * cm.getGreen(tmpMap[i]), cm.getBlue(tmpMap[i]));
-                         * break;
-                         * }
-                         * }
-                         * // or use special API...
-                         */
+                        //TODO Is there another case?
                         this.isTransparent = false;
                     }
                 } else {
+                    // TRANSLUCENT
+                    this.softMask = new byte[width * height];
+                    imageData.getAlphaRaster().getDataElements(
+                            0, 0, width, height, this.softMask);
                     this.isTransparent = false;
                 }
             } else {
@@ -217,5 +211,23 @@
         return loadDefaultOriginalData();
     }
     
+    /** @see org.apache.fop.image.FopImage#hasSoftMask() */
+    public boolean hasSoftMask() {
+        if (this.bitmaps == null && this.raw == null) {
+            loadBitmap();
+        }
+
+        return (this.softMask != null);
+    }
+
+    /** @see org.apache.fop.image.FopImage#getSoftMask() */
+    public byte[] getSoftMask() {
+        if (this.bitmaps == null) {
+            loadBitmap();
+        }
+
+        return this.softMask;
+    }
+
 }
 

Modified: xmlgraphics/fop/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?view=diff&rev=503323&r1=503322&r2=503323
==============================================================================
--- xmlgraphics/fop/trunk/status.xml (original)
+++ xmlgraphics/fop/trunk/status.xml Sat Feb  3 14:22:26 2007
@@ -28,6 +28,9 @@
 
   <changes>
     <release version="FOP Trunk">
+      <action context="Code" dev="JM" type="add">
+        Support for soft masks (transparency) with ImageIO image adapter.
+      </action>
       <action context="Code" dev="LF" type="fix" fixes-bug="41019">
         Fix incorrect behaviour of the BreakingAlgorithm when some inline content is wider than
         the available ipd, causing a restart.



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