diff options
author | Steve Coffman <gears@apache.org> | 2000-04-21 19:35:53 +0000 |
---|---|---|
committer | Steve Coffman <gears@apache.org> | 2000-04-21 19:35:53 +0000 |
commit | 7d9431f9ed2814a6543fcc94f9deaa26210c6979 (patch) | |
tree | e6f45ad5c592800dc0c856ce479989eea76e22fd /src/org/apache/fop/image/GifJpegImage.java | |
parent | 43a550c35509a8618086cf56909fffb02827f107 (diff) | |
download | xmlgraphics-fop-7d9431f9ed2814a6543fcc94f9deaa26210c6979.tar.gz xmlgraphics-fop-7d9431f9ed2814a6543fcc94f9deaa26210c6979.zip |
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
Diffstat (limited to 'src/org/apache/fop/image/GifJpegImage.java')
-rw-r--r-- | src/org/apache/fop/image/GifJpegImage.java | 30 |
1 files changed, 17 insertions, 13 deletions
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; } |