]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Andreas Rueckert's patch to fix inline gif image support. Does not add
authorSteve Coffman <gears@apache.org>
Fri, 21 Apr 2000 19:35:53 +0000 (19:35 +0000)
committerSteve Coffman <gears@apache.org>
Fri, 21 Apr 2000 19:35:53 +0000 (19:35 +0000)
compression. I verified that this does not alter the output pdf of the
example fo files, and it compiles cleanly.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@193337 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/StandardElementMapping.java
src/org/apache/fop/image/GifJpegImage.java
src/org/apache/fop/pdf/PDFResources.java

index 63dbf592a2de516fb06ac6fada67e8783eb62474..b81a7165f13fd58d3dcc44e0f858058794f06a66 100644 (file)
@@ -95,6 +95,8 @@ public class StandardElementMapping implements ElementMapping {
        builder.addMapping(uri, "display-rule", DisplayRule.maker()); 
        builder.addMapping(uri, "display-graphic",
                           DisplayGraphic.maker());  
+        builder.addMapping(uri, "inline-graphic",
+                           InlineGraphic.maker());
        builder.addMapping(uri, "table", Table.maker());
        builder.addMapping(uri, "table-column", TableColumn.maker());
        builder.addMapping(uri, "table-body", TableBody.maker());
index d04b6b915f0a52a8c3d24a887f0ab9fb8a21a424..fcb3ef98c04c147e5cb3d1de5ecab50267c67d32 100644 (file)
@@ -95,16 +95,16 @@ public class GifJpegImage implements FopImage {
            synchronized (imageWait) {
                imageWait.wait();
            }
-           /* this only works on windows, not on linux
-              while ((this.pixelheight = consumer.getHeight())==-1) {}
-              while ((this.pixelwidth = consumer.getWidth())==-1) {}
-           */
+
+           while ((this.pixelheight = consumer.getHeight())==-1) {}
+           while ((this.pixelwidth = consumer.getWidth())==-1) {}
+
            this.tempmap = new int[this.pixelwidth * this.pixelheight];
 
            PixelGrabber pg = new
                PixelGrabber(ip, 0, 0,
                             this.pixelwidth, this.pixelheight,
-                            this.tempmap, 0, w);
+                            this.tempmap, 0, this.pixelwidth);
            try {
                pg.grabPixels();
            } catch (InterruptedException e) {
@@ -204,14 +204,18 @@ public class GifJpegImage implements FopImage {
     public int[] getimagemap() {
        this.imagemap=new int[this.pixelheight * this.pixelwidth * 3];
        int count = 0;
-       int i;
-       for(i = 0; i < (this.pixelheight * this.pixelwidth); i++) {
-           int red   = ((this.tempmap[i]>>16) & 0xff);
-           int green = ((this.tempmap[i]>> 8) & 0xff);
-           int blue  = ((this.tempmap[i]    ) & 0xff);
-           this.imagemap[count++]=red;
-           this.imagemap[count++]=green;
-           this.imagemap[count++]=blue;
+        int x = 0;
+        int y = 0;
+
+        for ( y = (this.pixelheight - 1) * this.pixelwidth; y >= 0; y -= this.pixelwidth) {
+            for ( x = 0; x < this.pixelwidth; x++) {
+
+                int p = this.tempmap[y + x];
+
+                this.imagemap[count++] = ((p >>16) & 0xff);
+                this.imagemap[count++] = ((p >> 8) & 0xff);
+                this.imagemap[count++] = (p & 0xff);
+            }    
        }
        return imagemap;
     }
index 8d5281349c911f9e2f6541b780ca63a89283f17d..30ee840ddfd66e15ab98b85f6a145d169cdd0fdd 100644 (file)
@@ -174,7 +174,7 @@ public class PDFResources extends PDFObject {
                if (!this.xObjects.isEmpty())
                {
                p = p.append("/XObject <<");
-               for (int i = 1; i < this.xObjects.size(); i++) {
+               for (int i = 1; i <= this.xObjects.size(); i++) {
                        p = p.append("/Im" + i + " " +
                                ((PDFXObject)
                                this.xObjects.elementAt(i -
@@ -182,7 +182,8 @@ public class PDFResources extends PDFObject {
                                +
                                " \n");
                }
-               }
+               p = p.append(" >>\n");
+               }  
 
                p = p.append(">> \nendobj\n");