Return-Path: Delivered-To: apmail-xmlgraphics-fop-commits-archive@www.apache.org Received: (qmail 65813 invoked from network); 21 May 2007 07:59:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 May 2007 07:59:32 -0000 Received: (qmail 20312 invoked by uid 500); 21 May 2007 07:59:38 -0000 Delivered-To: apmail-xmlgraphics-fop-commits-archive@xmlgraphics.apache.org Received: (qmail 20281 invoked by uid 500); 21 May 2007 07:59:38 -0000 Mailing-List: contact fop-commits-help@xmlgraphics.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: fop-dev@xmlgraphics.apache.org Delivered-To: mailing list fop-commits@xmlgraphics.apache.org Received: (qmail 20270 invoked by uid 99); 21 May 2007 07:59:37 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2007 00:59:37 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2007 00:59:31 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 25DD91A981A; Mon, 21 May 2007 00:59:11 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r540052 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/image/analyser/ Date: Mon, 21 May 2007 07:59:10 -0000 To: fop-commits@xmlgraphics.apache.org From: jeremias@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070521075911.25DD91A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jeremias Date: Mon May 21 00:59:05 2007 New Revision: 540052 URL: http://svn.apache.org/viewvc?view=rev&rev=540052 Log: Bugzilla #42406: Use source resolution setting for bitmap images which don't provide their own resolution. Submitted by: Hussein Shafie Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/BMPReader.java xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/GIFReader.java xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/JPEGReader.java xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/PNGReader.java xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/TIFFReader.java xmlgraphics/fop/trunk/status.xml Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/BMPReader.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/BMPReader.java?view=diff&rev=540052&r1=540051&r2=540052 ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/BMPReader.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/BMPReader.java Mon May 21 00:59:05 2007 @@ -54,7 +54,11 @@ boolean supported = ((header[0] == (byte) 0x42) && (header[1] == (byte) 0x4d)); if (supported) { - FopImage.ImageInfo info = getDimension(header); + FopImage.ImageInfo info = new FopImage.ImageInfo(); + info.dpiHorizontal = ua.getFactory().getSourceResolution(); + info.dpiVertical = info.dpiHorizontal; + + getDimension(header, info); info.originalURI = uri; info.mimeType = getMimeType(); info.inputStream = bis; @@ -73,9 +77,7 @@ return "image/bmp"; } - private FopImage.ImageInfo getDimension(byte[] header) { - FopImage.ImageInfo info = new FopImage.ImageInfo(); - + private void getDimension(byte[] header, FopImage.ImageInfo info) { // little endian notation int byte1 = header[WIDTH_OFFSET] & 0xff; int byte2 = header[WIDTH_OFFSET + 1] & 0xff; @@ -109,8 +111,6 @@ if (l > 0) { info.dpiVertical = l / 39.37d; } - - return info; } private byte[] getDefaultHeader(InputStream imageStream) Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/GIFReader.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/GIFReader.java?view=diff&rev=540052&r1=540051&r2=540052 ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/GIFReader.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/GIFReader.java Mon May 21 00:59:05 2007 @@ -48,7 +48,11 @@ && (header[4] == '7' || header[4] == '9') && (header[5] == 'a')); if (supported) { - FopImage.ImageInfo info = getDimension(header); + FopImage.ImageInfo info = new FopImage.ImageInfo(); + info.dpiHorizontal = ua.getFactory().getSourceResolution(); + info.dpiVertical = info.dpiHorizontal; + + getDimension(header, info); info.originalURI = uri; info.mimeType = getMimeType(); info.inputStream = bis; @@ -67,8 +71,7 @@ return "image/gif"; } - private FopImage.ImageInfo getDimension(byte[] header) { - FopImage.ImageInfo info = new FopImage.ImageInfo(); + private void getDimension(byte[] header, FopImage.ImageInfo info) { // little endian notation int byte1 = header[6] & 0xff; int byte2 = header[7] & 0xff; @@ -77,7 +80,6 @@ byte1 = header[8] & 0xff; byte2 = header[9] & 0xff; info.height = ((byte2 << 8) | byte1) & 0xffff; - return info; } private byte[] getDefaultHeader(InputStream imageStream) Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/JPEGReader.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/JPEGReader.java?view=diff&rev=540052&r1=540051&r2=540052 ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/JPEGReader.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/JPEGReader.java Mon May 21 00:59:05 2007 @@ -61,7 +61,11 @@ boolean supported = ((header[0] == (byte) 0xff) && (header[1] == (byte) 0xd8)); if (supported) { - FopImage.ImageInfo info = getDimension(fis); + FopImage.ImageInfo info = new FopImage.ImageInfo(); + info.dpiHorizontal = ua.getFactory().getSourceResolution(); + info.dpiVertical = info.dpiHorizontal; + + getDimension(fis, info); info.originalURI = uri; info.mimeType = getMimeType(); info.inputStream = fis; @@ -97,8 +101,9 @@ return header; } - private FopImage.ImageInfo getDimension(InputStream imageStream) throws IOException { - FopImage.ImageInfo info = new FopImage.ImageInfo(); + private void getDimension(InputStream imageStream, + FopImage.ImageInfo info) + throws IOException { try { int pos=0, avail = imageStream.available(); imageStream.mark(avail); @@ -163,7 +168,8 @@ info.dpiHorizontal = xdensity; info.dpiVertical = ydensity; } else { - //nop, nyi --> 72dpi + // Use resolution specified in + // FOUserAgent.getFactory() (default 72dpi). } int restlen = reclen - 12; @@ -237,7 +243,6 @@ } throw ioe; } - return info; } private int read2bytes(InputStream imageStream) throws IOException { Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/PNGReader.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/PNGReader.java?view=diff&rev=540052&r1=540051&r2=540052 ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/PNGReader.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/PNGReader.java Mon May 21 00:59:05 2007 @@ -51,7 +51,11 @@ && (header[7] == (byte) 0x0a)); if (supported) { - FopImage.ImageInfo info = getDimension(header); + FopImage.ImageInfo info = new FopImage.ImageInfo(); + info.dpiHorizontal = ua.getFactory().getSourceResolution(); + info.dpiVertical = info.dpiHorizontal; + + getDimension(header, info); info.originalURI = uri; info.mimeType = getMimeType(); info.inputStream = bis; @@ -70,9 +74,7 @@ return "image/png"; } - private FopImage.ImageInfo getDimension(byte[] header) { - FopImage.ImageInfo info = new FopImage.ImageInfo(); - + private void getDimension(byte[] header, FopImage.ImageInfo info) { // png is always big endian int byte1 = header[16] & 0xff; int byte2 = header[17] & 0xff; @@ -90,7 +92,6 @@ byte4 = header[23] & 0xff; l = (long) ((byte1 << 24) | (byte2 << 16) | (byte3 << 8) | byte4); info.height = (int) l; - return info; } private byte[] getDefaultHeader(InputStream imageStream) Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/TIFFReader.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/TIFFReader.java?view=diff&rev=540052&r1=540051&r2=540052 ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/TIFFReader.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/image/analyser/TIFFReader.java Mon May 21 00:59:05 2007 @@ -62,7 +62,11 @@ } if (supported) { - FopImage.ImageInfo info = getDimension(header); + FopImage.ImageInfo info = new FopImage.ImageInfo(); + info.dpiHorizontal = ua.getFactory().getSourceResolution(); + info.dpiVertical = info.dpiHorizontal; + + getDimension(header, info); info.originalURI = uri; info.mimeType = getMimeType(); info.inputStream = bis; @@ -81,33 +85,14 @@ return "image/tiff"; } - private FopImage.ImageInfo getDimension(byte[] header) { + private void getDimension(byte[] header, FopImage.ImageInfo info) { // currently not setting the width and height // these are set again by the Jimi image reader. // I suppose I'll do it one day to be complete. Or // someone else will. // Note: bytes 4,5,6,7 contain the byte offset in the stream of the first IFD block - /* - * //png is always big endian - * int byte1 = header[ 16 ] & 0xff; - * int byte2 = header[ 17 ] & 0xff; - * int byte3 = header[ 18 ] & 0xff; - * int byte4 = header[ 19 ] & 0xff; - * long l = ( long ) ( ( byte1 << 24 ) | ( byte2 << 16 ) | - * ( byte3 << 8 ) | byte4 ); - * this.width = ( int ) ( l ); - * byte1 = header[ 20 ] & 0xff; - * byte2 = header[ 21 ] & 0xff; - * byte3 = header[ 22 ] & 0xff; - * byte4 = header[ 23 ] & 0xff; - * l = ( long ) ( ( byte1 << 24 ) | ( byte2 << 16 ) | ( byte3 << 8 ) | - * byte4 ); - * this.height = ( int ) ( l ); - */ - FopImage.ImageInfo info = new FopImage.ImageInfo(); info.width = -1; info.height = -1; - return info; } private byte[] getDefaultHeader(InputStream imageStream) Modified: xmlgraphics/fop/trunk/status.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?view=diff&rev=540052&r1=540051&r2=540052 ============================================================================== --- xmlgraphics/fop/trunk/status.xml (original) +++ xmlgraphics/fop/trunk/status.xml Mon May 21 00:59:05 2007 @@ -28,6 +28,10 @@ + + Use source resolution setting for bitmap images which don't provide their own + resolution. + Fixed the rendering of zero-width spaces for certain fonts by not generating them into the area tree. --------------------------------------------------------------------- To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org