From: Steve Coffman Date: Fri, 21 Apr 2000 19:35:53 +0000 (+0000) Subject: Andreas Rueckert's patch to fix inline gif image support. Does not add X-Git-Tag: pre-columns~527 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7d9431f9ed2814a6543fcc94f9deaa26210c6979;p=xmlgraphics-fop.git Andreas Rueckert's patch to fix inline gif image support. Does not add 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 --- diff --git a/src/org/apache/fop/fo/StandardElementMapping.java b/src/org/apache/fop/fo/StandardElementMapping.java index 63dbf592a..b81a7165f 100644 --- a/src/org/apache/fop/fo/StandardElementMapping.java +++ b/src/org/apache/fop/fo/StandardElementMapping.java @@ -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()); diff --git a/src/org/apache/fop/image/GifJpegImage.java b/src/org/apache/fop/image/GifJpegImage.java index d04b6b915..fcb3ef98c 100644 --- a/src/org/apache/fop/image/GifJpegImage.java +++ b/src/org/apache/fop/image/GifJpegImage.java @@ -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; } diff --git a/src/org/apache/fop/pdf/PDFResources.java b/src/org/apache/fop/pdf/PDFResources.java index 8d5281349..30ee840dd 100644 --- a/src/org/apache/fop/pdf/PDFResources.java +++ b/src/org/apache/fop/pdf/PDFResources.java @@ -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");