From fop-commits-return-11461aaron59@example.net Wed Jun 02 10:56:20 2010 Return-Path: <fop-commits-return-11461aaron59@example.net> Delivered-To: aaron59@example.net Received: (qmail 93596 invoked from network); 2 Jun 2010 10:56:20 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 2 Jun 2010 10:56:20 -0000 Received: (qmail 2879 invoked by uid 500); 2 Jun 2010 10:56:19 -0000 Delivered-To: aaron59@example.net Received: (qmail 2837 invoked by uid 500); 2 Jun 2010 10:56:18 -0000 Mailing-List: contact aaron59@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:aaron59@example.net> List-Unsubscribe: <mailto:aaron59@example.net> List-Post: <mailto:aaron59@example.net> List-Id: <fop-commits.xmlgraphics.apache.org> Reply-To: aaron59@example.net Delivered-To: mailing list aaron59@example.net Received: (qmail 2830 invoked by uid 99); 2 Jun 2010 10:56:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jun 2010 10:56:18 +0000 X-ASF-Spam-Status: No, hits=-1120.1 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Jun 2010 10:56:17 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 352A523888E4; Wed, 2 Jun 2010 10:55:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r950488 - in /xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop: fonts/SingleByteFont.java fonts/truetype/TTFFontLoader.java render/ps/PSFontUtils.java Date: Wed, 02 Jun 2010 10:55:57 -0000 To: aaron59@example.net From: aaron59@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <aaron59@example.net> Author: vhennebert Date: Wed Jun 2 10:55:56 2010 New Revision: 950488 URL: http://svn.apache.org/viewvc?rev=950488&view=rev Log: Added support for full embedding of TrueType font in PostScript, with encoding forced to WinAnsi. Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/SingleByteFont.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSFontUtils.java Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/SingleByteFont.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/SingleByteFont.java?rev=950488&r1=950487&r2=950488&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/SingleByteFont.java (original) +++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/SingleByteFont.java Wed Jun 2 10:55:56 2010 @@ -44,6 +44,7 @@ public class SingleByteFont extends Cust //Map<Character, UnencodedCharacter> private List additionalEncodings; + private List cmaps; /** * Main constructor. @@ -334,5 +335,15 @@ public class SingleByteFont extends Cust } } + /** TODO remove */ + public void setCMaps(List cmaps) { + this.cmaps = cmaps; + } + + /** TODO remove */ + public List getCMaps() { + return cmaps; + } + } Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java?rev=950488&r1=950487&r2=950488&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java (original) +++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fonts/truetype/TTFFontLoader.java Wed Jun 2 10:55:56 2010 @@ -163,6 +163,7 @@ public class TTFFontLoader extends FontL singleFont.setEncoding(ttf.getCharSetName()); returnFont.setFirstChar(ttf.getFirstChar()); returnFont.setLastChar(ttf.getLastChar()); + singleFont.setCMaps(ttf.getCMaps()); copyWidthsSingleByte(ttf); } Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSFontUtils.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSFontUtils.java?rev=950488&r1=950487&r2=950488&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSFontUtils.java (original) +++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/ps/PSFontUtils.java Wed Jun 2 10:55:56 2010 @@ -23,8 +23,11 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; +import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; +import java.util.Set; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; @@ -37,6 +40,7 @@ import org.apache.xmlgraphics.ps.DSCCons import org.apache.xmlgraphics.ps.PSGenerator; import org.apache.xmlgraphics.ps.PSResource; import org.apache.xmlgraphics.ps.dsc.ResourceTracker; +import org.apache.xmlgraphics.util.io.ASCIIHexOutputStream; import org.apache.fop.fonts.Base14Font; import org.apache.fop.fonts.CustomFont; @@ -47,6 +51,7 @@ import org.apache.fop.fonts.LazyFont; import org.apache.fop.fonts.SingleByteEncoding; import org.apache.fop.fonts.SingleByteFont; import org.apache.fop.fonts.Typeface; +import org.apache.fop.fonts.truetype.TTFCmapEntry; /** * Utility code for font handling in PostScript. @@ -196,7 +201,8 @@ public class PSFontUtils extends org.apa public static void embedFont(PSGenerator gen, Typeface tf, PSResource fontRes) throws IOException { boolean embeddedFont = false; - if (FontType.TYPE1 == tf.getFontType()) { + FontType fontType = tf.getFontType(); + if (fontType == FontType.TYPE1 || fontType == FontType.TRUETYPE) { if (tf instanceof CustomFont) { CustomFont cf = (CustomFont)tf; if (isEmbeddable(cf)) { @@ -204,7 +210,11 @@ public class PSFontUtils extends org.apa if (in != null) { gen.writeDSCComment(DSCConstants.BEGIN_RESOURCE, fontRes); - embedType1Font(gen, in); + if (fontType == FontType.TYPE1) { + embedType1Font(gen, in); + } else { + embedTrueTypeFont(gen, (SingleByteFont) tf, in); + } gen.writeDSCComment(DSCConstants.END_RESOURCE); gen.getResourceTracker().registerSuppliedResource(fontRes); embeddedFont = true; @@ -221,6 +231,94 @@ public class PSFontUtils extends org.apa } } + private static void embedTrueTypeFont(PSGenerator gen, + SingleByteFont font, InputStream fontStream) throws IOException { + /* See Adobe Technical Note #5012, "The Type 42 Font Format Specification" */ + gen.commentln("%!PS-TrueTypeFont-65536-65536-1"); // TODO TrueType & font versions + gen.writeln("11 dict begin"); + gen.write("/FontName /"); + gen.write(font.getFontName()); + gen.writeln(" def"); + gen.writeln("/Encoding 256 array"); + gen.writeln("0 1 255{1 index exch/.notdef put}for"); + Set glyphs = new HashSet(); + for (int i = 0; i < Glyphs.WINANSI_ENCODING.length; i++) { + gen.write("dup "); + gen.write(Integer.toString(i)); + gen.write(" /"); + String glyphName = Glyphs.charToGlyphName(Glyphs.WINANSI_ENCODING[i]); + if (glyphName.equals("")) { + gen.write(Glyphs.NOTDEF); + } else { + glyphs.add(glyphName); + gen.write(glyphName); + } + gen.writeln(" put"); + } + gen.writeln("readonly def"); + gen.writeln("/PaintType 0 def"); + gen.writeln("/FontMatrix [1 0 0 1 0 0] def"); + int[] bbox = font.getFontBBox(); + gen.write("/FontBBox["); + for (int i = 0; i < 4; i++) { + gen.write(" "); + gen.write(Integer.toString(bbox[i])); + } + gen.writeln(" ] def"); + gen.writeln("/FontType 42 def"); + gen.write("/sfnts["); + /* + * Store the font file in an array of hex-encoded strings. Strings are limited to + * 65535 characters, string will start with a newline, 2 characters are needed to + * hex-encode each byte, one newline character will be added every 40 bytes, each + * string should start at a 4-byte boundary + * => buffer size = floor((65535 - 1) * 40 / 81 / 4) * 4 + * TODO this is not robust: depends on how often ASCIIHexOutputStream adds a newline + */ + // TODO does not follow Technical Note #5012's requirements: + // "strings must begin at TrueType table boundaries, or at individual glyph + // boundaries within the glyf table." + // There may be compatibility issues with older PostScript interpreters + byte[] buffer = new byte[32360]; + int readCount; + while ((readCount = fontStream.read(buffer)) > 0) { + ASCIIHexOutputStream hexOut = new ASCIIHexOutputStream(gen.getOutputStream()); + gen.writeln("<"); + hexOut.write(buffer, 0, readCount); + gen.write("> "); + } + gen.writeln("]def"); + gen.write("/CharStrings "); + gen.write(Integer.toString(glyphs.size() + 1)); + gen.writeln(" dict dup begin"); + gen.write("/"); + gen.write(Glyphs.NOTDEF); + gen.writeln(" 0 def"); // TODO always glyph index 0? + // TODO ugly and temporary, until CID is implemented + List cmaps = font.getCMaps(); + for (Iterator iter = glyphs.iterator(); iter.hasNext();) { + String glyphName = (String) iter.next(); + gen.write("/"); + gen.write(glyphName); + gen.write(" "); + gen.write(Integer.toString(getGlyphIndex(glyphName, cmaps))); + gen.writeln(" def"); + } + gen.writeln("end readonly def"); + gen.writeln("FontName currentdict end definefont pop"); + } + + private static int getGlyphIndex(String glyphName, List cmaps) { + char c = Glyphs.getUnicodeSequenceForGlyphName(glyphName).charAt(0); + for (Iterator iter = cmaps.iterator(); iter.hasNext();) { + TTFCmapEntry cmap = (TTFCmapEntry) iter.next(); + if (cmap.getUnicodeStart() <= c && c <= cmap.getUnicodeEnd()) { + return cmap.getGlyphStartIndex() + c - cmap.getUnicodeStart(); + } + } + return 0; + } + private static boolean isEmbeddable(CustomFont font) { return font.isEmbeddable(); } --------------------------------------------------------------------- To unsubscribe, e-mail: aaron59@example.net For additional commands, e-mail: aaron59@example.net From fop-commits-return-11462aaron59@example.net Fri Jun 04 09:04:21 2010 Return-Path: <fop-commits-return-11462aaron59@example.net> Delivered-To: aaron59@example.net Received: (qmail 94265 invoked from network); 4 Jun 2010 09:04:21 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 4 Jun 2010 09:04:21 -0000 Received: (qmail 22032 invoked by uid 500); 4 Jun 2010 09:04:21 -0000 Delivered-To: aaron59@example.net Received: (qmail 21938 invoked by uid 500); 4 Jun 2010 09:04:19 -0000 Mailing-List: contact aaron59@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:aaron59@example.net> List-Unsubscribe: <mailto:aaron59@example.net> List-Post: <mailto:aaron59@example.net> List-Id: <fop-commits.xmlgraphics.apache.org> Reply-To: aaron59@example.net Delivered-To: mailing list aaron59@example.net Received: (qmail 21930 invoked by uid 99); 4 Jun 2010 09:04:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jun 2010 09:04:18 +0000 X-ASF-Spam-Status: No, hits=-1320.9 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jun 2010 09:04:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DD54223889B2; Fri, 4 Jun 2010 09:03:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r951333 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/pdf/PDFNumber.java status.xml Date: Fri, 04 Jun 2010 09:03:57 -0000 To: aaron59@example.net From: aaron59@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <aaron59@example.net> Author: jeremias Date: Fri Jun 4 09:03:57 2010 New Revision: 951333 URL: http://svn.apache.org/viewvc?rev=951333&view=rev Log: Bugfix for formatting of floating point numbers which could lead to invalid PDFs. Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFNumber.java xmlgraphics/fop/trunk/status.xml Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFNumber.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFNumber.java?rev=951333&r1=951332&r2=951333&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFNumber.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFNumber.java Fri Jun 4 09:03:57 2010 @@ -88,7 +88,7 @@ public class PDFNumber extends PDFObject if (hasObjectNumber()) { sb.append(getObjectID()); } - sb.append(getNumber().toString()); + sb.append(doubleOut(getNumber().doubleValue(), 10)); if (hasObjectNumber()) { sb.append("\nendobj\n"); } Modified: xmlgraphics/fop/trunk/status.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=951333&r1=951332&r2=951333&view=diff ============================================================================== --- xmlgraphics/fop/trunk/status.xml (original) +++ xmlgraphics/fop/trunk/status.xml Fri Jun 4 09:03:57 2010 @@ -59,6 +59,9 @@ --> <release version="FOP Trunk" date="TBD"> <action context="Renderers" dev="JM" type="fix"> + Bugfix for formatting of floating point numbers which could lead to invalid PDFs. + </action> + <action context="Renderers" dev="JM" type="fix"> Added a save/restoreGraphicsState pair for the initial coordinate system in PDF output for easier post-processing. </action> --------------------------------------------------------------------- To unsubscribe, e-mail: aaron59@example.net For additional commands, e-mail: aaron59@example.net From fop-commits-return-11463aaron59@example.net Tue Jun 08 19:02:23 2010 Return-Path: <fop-commits-return-11463aaron59@example.net> Delivered-To: aaron59@example.net Received: (qmail 56532 invoked from network); 8 Jun 2010 19:02:22 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 8 Jun 2010 19:02:22 -0000 Received: (qmail 52106 invoked by uid 500); 8 Jun 2010 19:02:22 -0000 Delivered-To: aaron59@example.net Received: (qmail 52067 invoked by uid 500); 8 Jun 2010 19:02:22 -0000 Mailing-List: contact aaron59@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:aaron59@example.net> List-Unsubscribe: <mailto:aaron59@example.net> List-Post: <mailto:aaron59@example.net> List-Id: <fop-commits.xmlgraphics.apache.org> Reply-To: aaron59@example.net Delivered-To: mailing list aaron59@example.net Received: (qmail 52060 invoked by uid 99); 8 Jun 2010 19:02:22 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jun 2010 19:02:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jun 2010 19:02:18 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 235BB2388980; Tue, 8 Jun 2010 19:01:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r952770 - in /xmlgraphics/fop/trunk: ./ src/java/org/apache/fop/render/awt/viewer/ Date: Tue, 08 Jun 2010 19:01:57 -0000 To: aaron59@example.net From: aaron59@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <aaron59@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: jeremias Date: Tue Jun 8 19:01:56 2010 New Revision: 952770 URL: http://svn.apache.org/viewvc?rev=952770&view=rev Log: Bugzilla #42306: Fix for AWT viewer to correctly track page numbers in continuous display mode. Submitted by: Richard Wheeldon <aaron59@example.net> Modifications to original patch: - Small adjustments for out code conventions. - Added some missing Javadocs. Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java (with props) xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java (with props) Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java xmlgraphics/fop/trunk/status.xml Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java?rev=952770&view=auto ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java (added) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java Tue Jun 8 19:01:56 2010 @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.render.awt.viewer; + +import java.util.EventObject; + +/** + * Swing event fired whenever the current page selection of a + * {@link PreviewPanel} changes. Page numbers are 0-based. + */ +public class PageChangeEvent extends EventObject { + + private int oldPage; + private int newPage; + + /** + * Creates an new page change event. + * @param panel the preview panel the event is produced for. + * @param oldPage the old page (zero based) + * @param newPage the new page (zero based) + */ + public PageChangeEvent(PreviewPanel panel, int oldPage, int newPage) { + super(panel); + this.oldPage = oldPage; + this.newPage = newPage; + } + + /** + * Returns the new page. + * @return the new page (zero based) + */ + public int getNewPage() { + return newPage; + } + + /** + * Returns the old page. + * @return the old page (zero based) + */ + public int getOldPage() { + return oldPage; + } + +} Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java ------------------------------------------------------------------------------ svn:keywords = Id Added: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java?rev=952770&view=auto ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java (added) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java Tue Jun 8 19:01:56 2010 @@ -0,0 +1,36 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* $Id$ */ + +package org.apache.fop.render.awt.viewer; + +import java.util.EventListener; + +/** + * Swing listener interface for classes which wish to receive + * notification of page change events. + */ +public interface PageChangeListener extends EventListener { + + /** + * Called whenever the current page is changed. + * @param pce the page change event + */ + void pageChanged(PageChangeEvent pce); + +} Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java ------------------------------------------------------------------------------ svn:keywords = Id Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java?rev=952770&r1=952769&r2=952770&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java Tue Jun 8 19:01:56 2010 @@ -171,6 +171,11 @@ public class PreviewDialog extends JFram //Page view stuff previewPanel = new PreviewPanel(foUserAgent, renderable, renderer); getContentPane().add(previewPanel, BorderLayout.CENTER); + previewPanel.addPageChangeListener(new PageChangeListener() { + public void pageChanged(PageChangeEvent pce) { + new ShowInfo().run(); + } + }); // Keyboard shortcuts - pgup/pgdn InputMap im = previewPanel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW); @@ -260,6 +265,7 @@ public class PreviewDialog extends JFram * Creates and initialize the AWT Viewer main window. * @param foUserAgent the FO user agent * @param renderable the target for the rendering + * @param asMainWindow true if the window shall act as the main application window. * @return the newly initialized preview dialog */ public static PreviewDialog createPreviewDialog(FOUserAgent foUserAgent, @@ -530,12 +536,18 @@ public class PreviewDialog extends JFram goToPage(currentPage); } - /** Scales page image */ + /** + * Scales page image. + * @param scaleFactor the scale factor + */ public void setScale(double scaleFactor) { scale.setSelectedItem(percentFormat.format(scaleFactor) + "%"); previewPanel.setScaleFactor(scaleFactor / 100d); } + /** + * Sets the scaling so the contents fit into the window. + */ public void setScaleToFitWindow() { try { setScale(previewPanel.getScaleToFitWindow() * 100); @@ -544,6 +556,9 @@ public class PreviewDialog extends JFram } } + /** + * Sets the scaling so the contents are spread over the whole width available. + */ public void setScaleToFitWidth() { try { setScale(previewPanel.getScaleToFitWidth() * 100); @@ -569,7 +584,7 @@ public class PreviewDialog extends JFram //Restore originally configured target resolution float saveResolution = foUserAgent.getTargetResolution(); foUserAgent.setTargetResolution(this.configuredTargetResolution); - + PrinterJob pj = PrinterJob.getPrinterJob(); pj.setPageable(renderer); if (!showDialog || pj.printDialog()) { @@ -579,7 +594,7 @@ public class PreviewDialog extends JFram e.printStackTrace(); } } - + foUserAgent.setTargetResolution(saveResolution); } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java?rev=952770&r1=952769&r2=952770&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java Tue Jun 8 19:01:56 2010 @@ -19,11 +19,14 @@ package org.apache.fop.render.awt.viewer; +import java.awt.Adjustable; import java.awt.Color; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Point; import java.awt.Toolkit; +import java.awt.event.AdjustmentEvent; +import java.awt.event.AdjustmentListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; @@ -166,6 +169,8 @@ public class PreviewPanel extends JPanel previewArea = new JScrollPane(gridPanel); previewArea.getViewport().setBackground(Color.gray); + previewArea.getVerticalScrollBar().addAdjustmentListener(new PageNumberListener()); + // FIXME should add scroll wheel support here at some point. scroller = new ViewportScroller(previewArea.getViewport()); previewArea.addMouseListener(scroller); @@ -188,6 +193,7 @@ public class PreviewPanel extends JPanel * @param number the page number */ public void setPage(int number) { + int oldPage = currentPage; if (displayMode == CONTINUOUS || displayMode == CONT_FACING) { currentPage = number; gridPanel.scrollRectToVisible(pagePanels[currentPage].getBounds()); @@ -196,6 +202,7 @@ public class PreviewPanel extends JPanel firstPage = currentPage; } showPage(); + firePageChange(oldPage, currentPage); } /** @@ -237,6 +244,42 @@ public class PreviewPanel extends JPanel } /** + * Add a listener to receive notification of page change events. Events will + * be fired whenever the currentPage value is changed. The values recorded + * are 0-based. + * @param l the page change listener to add + */ + public void addPageChangeListener(PageChangeListener l) { + listenerList.add(PageChangeListener.class, l); + } + + /** + * Removes a page change listener. + * @param l the page change listener to remove + */ + public void removePageChangeListener(PageChangeListener l) { + listenerList.remove(PageChangeListener.class, l); + } + + /** + * Notify all registered listeners of a page change event. + * @param oldPage the old page + * @param newPage the new page + */ + protected void firePageChange(int oldPage, int newPage) { + Object[] listeners = listenerList.getListenerList(); + PageChangeEvent e = null; + for (int i = listeners.length - 2; i >= 0; i -= 2) { + if (listeners[i] == PageChangeListener.class) { + if (e == null) { + e = new PageChangeEvent(this, newPage, oldPage); + } + ((PageChangeListener)listeners[i + 1]).pageChanged(e); + } + } + } + + /** * Allows any mouse drag on the page area to scroll the display window. */ private class ViewportScroller implements MouseListener, MouseMotionListener { @@ -352,6 +395,23 @@ public class PreviewPanel extends JPanel } } + private class PageNumberListener implements AdjustmentListener { + public void adjustmentValueChanged(AdjustmentEvent e) { + if (displayMode == PreviewPanel.CONTINUOUS || displayMode == PreviewPanel.CONT_FACING) { + Adjustable a = e.getAdjustable(); + int value = +e.getValue(); + int min = a.getMinimum(); + int max = a.getMaximum(); + int page = ( (renderer.getNumberOfPages() * value) / (max - min) ); + if (page != currentPage) { + int oldPage = currentPage; + currentPage = page; + firePageChange(oldPage, currentPage); + } + } + } + } + /** * Scales page image * @param scale [0;1] Modified: xmlgraphics/fop/trunk/status.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=952770&r1=952769&r2=952770&view=diff ============================================================================== --- xmlgraphics/fop/trunk/status.xml (original) +++ xmlgraphics/fop/trunk/status.xml Tue Jun 8 19:01:56 2010 @@ -58,6 +58,9 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> <release version="FOP Trunk" date="TBD"> + <action context="Renderers" dev="JM" type="fix" fixes-bug="42306" due-to="Richard Wheeldon"> + Fix for AWT viewer to correctly track page numbers in continuous display mode. + </action> <action context="Renderers" dev="JM" type="fix"> Bugfix for formatting of floating point numbers which could lead to invalid PDFs. </action> --------------------------------------------------------------------- To unsubscribe, e-mail: aaron59@example.net For additional commands, e-mail: aaron59@example.net From fop-commits-return-11464aaron59@example.net Fri Jun 11 12:32:33 2010 Return-Path: <fop-commits-return-11464aaron59@example.net> Delivered-To: aaron59@example.net Received: (qmail 12772 invoked from network); 11 Jun 2010 12:32:33 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 11 Jun 2010 12:32:33 -0000 Received: (qmail 83223 invoked by uid 500); 11 Jun 2010 12:32:33 -0000 Delivered-To: aaron59@example.net Received: (qmail 83139 invoked by uid 500); 11 Jun 2010 12:32:32 -0000 Mailing-List: contact aaron59@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:aaron59@example.net> List-Unsubscribe: <mailto:aaron59@example.net> List-Post: <mailto:aaron59@example.net> List-Id: <fop-commits.xmlgraphics.apache.org> Reply-To: aaron59@example.net Delivered-To: mailing list aaron59@example.net Received: (qmail 83130 invoked by uid 99); 11 Jun 2010 12:32:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jun 2010 12:32:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jun 2010 12:32:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id EE93F23889B2; Fri, 11 Jun 2010 12:31:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r953684 - in /xmlgraphics/fop/trunk: src/java/org/apache/fop/afp/AFPGraphics2D.java status.xml Date: Fri, 11 Jun 2010 12:31:45 -0000 To: aaron59@example.net From: aaron59@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <aaron59@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: jeremias Date: Fri Jun 11 12:31:45 2010 New Revision: 953684 URL: http://svn.apache.org/viewvc?rev=953684&view=rev Log: AFP Output: Fix for bitmap images inside an SVG or G2D graphic (printer errors) and positioning fix for bitmaps from G2D graphics. Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPGraphics2D.java xmlgraphics/fop/trunk/status.xml Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPGraphics2D.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPGraphics2D.java?rev=953684&r1=953683&r2=953684&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPGraphics2D.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPGraphics2D.java Fri Jun 11 12:31:45 2010 @@ -584,6 +584,10 @@ public class AFPGraphics2D extends Abstr int dataWidth = renderedImage.getWidth(); imageObjectInfo.setDataWidth(dataWidth); + int resolution = paintingState.getResolution(); + imageObjectInfo.setDataWidthRes(resolution); + imageObjectInfo.setDataHeightRes(resolution); + boolean colorImages = paintingState.isColorImages(); imageObjectInfo.setColor(colorImages); @@ -598,6 +602,10 @@ public class AFPGraphics2D extends Abstr ImageEncodingHelper.encodeRGBAsGrayScale( imageData, dataWidth, dataHeight, bitsPerPixel, boas); imageData = boas.toByteArray(); + if (bitsPerPixel == 1) { + //FS10 should generate a page seqment to avoid problems + imageObjectInfo.setCreatePageSegment(true); + } } imageObjectInfo.setData(imageData); @@ -612,7 +620,6 @@ public class AFPGraphics2D extends Abstr objectAreaInfo.setWidth(width); objectAreaInfo.setHeight(height); - int resolution = paintingState.getResolution(); objectAreaInfo.setWidthRes(resolution); objectAreaInfo.setHeightRes(resolution); @@ -667,23 +674,7 @@ public class AFPGraphics2D extends Abstr boolean drawn = drawBufferedImage(img, bufferedImage, width, height, observer); if (drawn) { - AffineTransform at = gc.getTransform(); - float[] srcPts = new float[] {x, y}; - float[] dstPts = new float[srcPts.length]; - at.transform(srcPts, 0, dstPts, 0, 1); - x = Math.round(dstPts[X]); - y = Math.round(dstPts[Y]); - try { - // get image object info - AFPImageObjectInfo imageObjectInfo - = createImageObjectInfo(bufferedImage, x, y, width, height); - - // create image resource - resourceManager.createObject(imageObjectInfo); - return true; - } catch (IOException ioe) { - handleIOException(ioe); - } + drawRenderedImage(bufferedImage, new AffineTransform()); } return false; } Modified: xmlgraphics/fop/trunk/status.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=953684&r1=953683&r2=953684&view=diff ============================================================================== --- xmlgraphics/fop/trunk/status.xml (original) +++ xmlgraphics/fop/trunk/status.xml Fri Jun 11 12:31:45 2010 @@ -58,6 +58,10 @@ documents. Example: the fix of marks layering will be such a case when it's done. --> <release version="FOP Trunk" date="TBD"> + <action context="Renderers" dev="JM" type="fix"> + AFP Output: Fix for bitmap images inside an SVG or G2D graphic (printer errors) and + positioning fix for bitmaps from G2D graphics. + </action> <action context="Renderers" dev="JM" type="fix" fixes-bug="42306" due-to="Richard Wheeldon"> Fix for AWT viewer to correctly track page numbers in continuous display mode. </action> --------------------------------------------------------------------- To unsubscribe, e-mail: aaron59@example.net For additional commands, e-mail: aaron59@example.net From fop-commits-return-11465aaron59@example.net Sat Jun 12 08:20:40 2010 Return-Path: <fop-commits-return-11465aaron59@example.net> Delivered-To: aaron59@example.net Received: (qmail 47972 invoked from network); 12 Jun 2010 08:20:40 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 12 Jun 2010 08:20:40 -0000 Received: (qmail 17414 invoked by uid 500); 12 Jun 2010 08:20:40 -0000 Delivered-To: aaron59@example.net Received: (qmail 17337 invoked by uid 500); 12 Jun 2010 08:20:38 -0000 Mailing-List: contact aaron59@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:aaron59@example.net> List-Unsubscribe: <mailto:aaron59@example.net> List-Post: <mailto:aaron59@example.net> List-Id: <fop-commits.xmlgraphics.apache.org> Reply-To: aaron59@example.net Delivered-To: mailing list aaron59@example.net Received: (qmail 17319 invoked by uid 99); 12 Jun 2010 08:20:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jun 2010 08:20:37 +0000 X-ASF-Spam-Status: No, hits=-1998.0 required=10.0 tests=ALL_TRUSTED,FB_GET_MEDS X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jun 2010 08:20:32 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 823C223889F1; Sat, 12 Jun 2010 08:19:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r953952 - in /xmlgraphics/fop/trunk: ./ src/documentation/content/xdocs/trunk/ src/java/org/apache/fop/afp/ src/java/org/apache/fop/afp/modca/ src/java/org/apache/fop/render/afp/ src/java/org/apache/fop/util/bitmap/ Date: Sat, 12 Jun 2010 08:19:49 -0000 To: aaron59@example.net From: aaron59@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <aaron59@example.net> X-Virus-Checked: Checked by ClamAV on apache.org Author: jeremias Date: Sat Jun 12 08:19:48 2010 New Revision: 953952 URL: http://svn.apache.org/viewvc?rev=953952&view=rev Log: AFP Output Changes: - Fixed positioning of Java2D-based images (when GOCA is enabled). GraphicsDataDescriptor had a bit order bug. The Graphics2D image handler didn't save state and reposition the image origin. - Switched bitmap image handling in AFPGraphics2D to (re-)use AFPImageHandlerRenderedImage so it can profit from it's advanced image conversion functionality. This also avoids some bugs with certain image formats. - Added enhanced dithering functionality for images that need to be converted to bi-level images. Modified: xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/output.xml xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPGraphics2D.java xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPCustomizable.java xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRenderer.java xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java xmlgraphics/fop/trunk/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java xmlgraphics/fop/trunk/status.xml Modified: xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/output.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/output.xml?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/output.xml (original) +++ xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/output.xml Sat Jun 12 08:19:48 2010 @@ -531,9 +531,10 @@ out = proc.getOutputStream();]]></source latest features. We're trying to make AFP output work in as many environments as possible. However, to make AFP output work on older environments it is recommended to set to configuration to 1 bit per pixel (see below on how to do this). In this case, all images - are converted to bi-level images using IOCA function set 10 (FS10). If a higher number of - bits per pixel is configured, FOP has to switch to at least FS11 which may not work - everywhere. + are converted to bi-level images using IOCA function set 10 (FS10) and are enclosed in + page-segments since some implementation cannot deal with IOCA objects directly. + If a higher number of bits per pixel is configured, FOP has to switch to at least FS11 + which may not work everywhere. </p> </section> <section id="afp-configuration"> @@ -724,8 +725,20 @@ Note that the value of the encoding attr colors. This will only have an effect if the color mode is set to "color". Example: </p> <source><![CDATA[ - <images mode="color" cmyk="true"/> -]]></source> + <images mode="color" cmyk="true"/>]]></source> + <p> + When the color mode is set to 1 bit (bi-level), the "dithering-quality" attribute can + be used to select the level of quality to use when converting images to bi-level images. + Valid values for this attribute are floating point numbers from 0.0 (fastest) to + 1.0 (best), or special values: "minimum" (=0.0), "maximum" (1.0), + "medium" (0.5, the default). For the higher settings to work as expected, JAI needs to + be present in the classpath. If JAI is present, 0.0 results in a minimal darkness-level + switching between white and black. 0.5 does bayer-based dithering and 1.0 will use + error-diffusion dithering. The higher the value, the higher the quality and the slower + the processing of the images. + </p> + <source><![CDATA[ + <images mode="b+w" bits-per-pixel="1" dithering-quality="maximum"/>]]></source> </section> <section id="afp-shading-config"> <title>Shading</title> Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPGraphics2D.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPGraphics2D.java?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPGraphics2D.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPGraphics2D.java Sat Jun 12 08:19:48 2010 @@ -45,7 +45,6 @@ import java.awt.image.RenderedImage; import java.awt.image.renderable.RenderableImage; import java.io.IOException; -import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -56,8 +55,6 @@ import org.apache.xmlgraphics.java2d.Abs import org.apache.xmlgraphics.java2d.GraphicContext; import org.apache.xmlgraphics.java2d.StrokingTextHandler; import org.apache.xmlgraphics.java2d.TextHandler; -import org.apache.xmlgraphics.ps.ImageEncodingHelper; -import org.apache.xmlgraphics.util.MimeConstants; import org.apache.xmlgraphics.util.UnitConv; import org.apache.fop.afp.goca.GraphicsSetLineType; @@ -65,6 +62,8 @@ import org.apache.fop.afp.modca.Graphics import org.apache.fop.afp.svg.AFPGraphicsConfiguration; import org.apache.fop.afp.util.CubicBezierApproximator; import org.apache.fop.fonts.FontInfo; +import org.apache.fop.render.afp.AFPImageHandlerRenderedImage; +import org.apache.fop.render.afp.AFPRenderingContext; import org.apache.fop.svg.NativeImageHandler; /** @@ -559,75 +558,6 @@ public class AFPGraphics2D extends Abstr BufferedImage.TYPE_INT_ARGB); } - private AFPImageObjectInfo createImageObjectInfo( - RenderedImage img, int x, int y, int width, int height) throws IOException { - ImageInfo imageInfo = new ImageInfo(null, "image/unknown"); - ImageSize size = new ImageSize(img.getWidth(), img.getHeight(), 72); - imageInfo.setSize(size); - - ImageRendered imageRendered = new ImageRendered(imageInfo, img, null); - RenderedImage renderedImage = imageRendered.getRenderedImage(); - - // create image object info - AFPImageObjectInfo imageObjectInfo = new AFPImageObjectInfo(); - - imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS45); - - int bitsPerPixel = paintingState.getBitsPerPixel(); - imageObjectInfo.setBitsPerPixel(bitsPerPixel); - - imageObjectInfo.setResourceInfo(resourceInfo); - - int dataHeight = renderedImage.getHeight(); - imageObjectInfo.setDataHeight(dataHeight); - - int dataWidth = renderedImage.getWidth(); - imageObjectInfo.setDataWidth(dataWidth); - - int resolution = paintingState.getResolution(); - imageObjectInfo.setDataWidthRes(resolution); - imageObjectInfo.setDataHeightRes(resolution); - - boolean colorImages = paintingState.isColorImages(); - imageObjectInfo.setColor(colorImages); - - ByteArrayOutputStream boas = new ByteArrayOutputStream(); - ImageEncodingHelper.encodeRenderedImageAsRGB(renderedImage, boas); - byte[] imageData = boas.toByteArray(); - - // convert to grayscale - if (!colorImages) { - boas.reset(); - imageObjectInfo.setBitsPerPixel(bitsPerPixel); - ImageEncodingHelper.encodeRGBAsGrayScale( - imageData, dataWidth, dataHeight, bitsPerPixel, boas); - imageData = boas.toByteArray(); - if (bitsPerPixel == 1) { - //FS10 should generate a page seqment to avoid problems - imageObjectInfo.setCreatePageSegment(true); - } - } - imageObjectInfo.setData(imageData); - - if (imageInfo != null) { - imageObjectInfo.setUri(imageInfo.getOriginalURI()); - } - - // create object area info - AFPObjectAreaInfo objectAreaInfo = new AFPObjectAreaInfo(); - objectAreaInfo.setX(x); - objectAreaInfo.setY(y); - objectAreaInfo.setWidth(width); - objectAreaInfo.setHeight(height); - - objectAreaInfo.setWidthRes(resolution); - objectAreaInfo.setHeightRes(resolution); - - imageObjectInfo.setObjectAreaInfo(objectAreaInfo); - - return imageObjectInfo; - } - /** * Draws an AWT image into a BufferedImage using an AWT Graphics2D implementation * @@ -667,7 +597,6 @@ public class AFPGraphics2D extends Abstr /** {@inheritDoc} */ public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { - // draw with AWT Graphics2D Dimension imageSize = new Dimension(width, height); BufferedImage bufferedImage = buildBufferedImage(imageSize); @@ -684,20 +613,33 @@ public class AFPGraphics2D extends Abstr int imgWidth = img.getWidth(); int imgHeight = img.getHeight(); - AffineTransform at = paintingState.getData().getTransform(); AffineTransform gat = gc.getTransform(); int graphicsObjectHeight = graphicsObj.getObjectEnvironmentGroup().getObjectAreaDescriptor().getHeight(); - int x = (int)Math.round(at.getTranslateX() + gat.getTranslateX()); - int y = (int)Math.round(at.getTranslateY() - (gat.getTranslateY() - graphicsObjectHeight)); - int width = (int)Math.round(imgWidth * gat.getScaleX()); - int height = (int)Math.round(imgHeight * -gat.getScaleY()); + + double toMillipointFactor = UnitConv.IN2PT * 1000 / (double)paintingState.getResolution(); + double x = gat.getTranslateX(); + double y = -(gat.getTranslateY() - graphicsObjectHeight); + x = toMillipointFactor * x; + y = toMillipointFactor * y; + double w = toMillipointFactor * imgWidth * gat.getScaleX(); + double h = toMillipointFactor * imgHeight * -gat.getScaleY(); + + AFPImageHandlerRenderedImage handler = new AFPImageHandlerRenderedImage(); + ImageInfo imageInfo = new ImageInfo(null, null); + imageInfo.setSize(new ImageSize( + img.getWidth(), img.getHeight(), paintingState.getResolution())); + imageInfo.getSize().calcSizeFromPixels(); + ImageRendered red = new ImageRendered(imageInfo, img, null); + Rectangle targetPos = new Rectangle( + (int)Math.round(x), + (int)Math.round(y), + (int)Math.round(w), + (int)Math.round(h)); + AFPRenderingContext context = new AFPRenderingContext(null, + resourceManager, paintingState, fontInfo, null); try { - // get image object info - AFPImageObjectInfo imageObjectInfo - = createImageObjectInfo(img, x, y, width, height); - // create image resource - resourceManager.createObject(imageObjectInfo); + handler.handleImage(context, red, targetPos); } catch (IOException ioe) { handleIOException(ioe); } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java Sat Jun 12 08:19:48 2010 @@ -51,6 +51,9 @@ public class AFPPaintingState extends or /** color image support */ private boolean colorImages = false; + /** dithering quality setting (0.0f..1.0f) */ + private float ditheringQuality; + /** color image handler */ private ColorConverter colorConverter = GrayScaleColorConverter.getInstance(); @@ -234,6 +237,25 @@ public class AFPPaintingState extends or } /** + * Gets the dithering quality setting to use when converting images to monochrome images. + * @return the dithering quality (a value between 0.0f and 1.0f) + */ + public float getDitheringQuality() { + return this.ditheringQuality; + } + + /** + * Sets the dithering quality setting to use when converting images to monochrome images. + * @param quality Defines the desired quality level for the conversion. + * Valid values: a value between 0.0f (fastest) and 1.0f (best) + */ + public void setDitheringQuality(float quality) { + quality = Math.max(quality, 0.0f); + quality = Math.min(quality, 1.0f); + this.ditheringQuality = quality; + } + + /** * Sets the output/device resolution * * @param resolution Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java Sat Jun 12 08:19:48 2010 @@ -104,8 +104,8 @@ public class GraphicsDataDescriptor exte return data; } - private static final int ABS = 2; - private static final int IMGRES = 8; + private static final int ABS = 64; + private static final int IMGRES = 16; /** * Returns the window specification data Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPCustomizable.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPCustomizable.java?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPCustomizable.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPCustomizable.java Sat Jun 12 08:19:48 2010 @@ -65,6 +65,13 @@ public interface AFPCustomizable { void setShadingMode(AFPShadingMode shadingMode); /** + * Sets the dithering quality setting to use when converting images to monochrome images. + * @param quality Defines the desired quality level for the conversion. + * Valid values: a value between 0.0f (fastest) and 1.0f (best) + */ + void setDitheringQuality(float quality); + + /** * Sets the output/device resolution * * @param resolution Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java Sat Jun 12 08:19:48 2010 @@ -46,8 +46,8 @@ import org.apache.fop.fonts.FontManager; import org.apache.fop.render.afp.extensions.AFPElementMapping; import org.apache.fop.render.afp.extensions.AFPIncludeFormMap; import org.apache.fop.render.afp.extensions.AFPInvokeMediumMap; -import org.apache.fop.render.afp.extensions.AFPPageSetup; import org.apache.fop.render.afp.extensions.AFPPageOverlay; +import org.apache.fop.render.afp.extensions.AFPPageSetup; import org.apache.fop.render.intermediate.AbstractBinaryWritingIFDocumentHandler; import org.apache.fop.render.intermediate.IFDocumentHandler; import org.apache.fop.render.intermediate.IFDocumentHandlerConfigurator; @@ -362,6 +362,11 @@ public class AFPDocumentHandler extends } /** {@inheritDoc} */ + public void setDitheringQuality(float quality) { + this.paintingState.setDitheringQuality(quality); + } + + /** {@inheritDoc} */ public void setShadingMode(AFPShadingMode shadingMode) { this.shadingMode = shadingMode; } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java Sat Jun 12 08:19:48 2010 @@ -20,6 +20,7 @@ package org.apache.fop.render.afp; import java.awt.Rectangle; +import java.awt.geom.AffineTransform; import java.io.IOException; import org.apache.xmlgraphics.image.loader.Image; @@ -136,6 +137,12 @@ public class AFPImageHandlerGraphics2D e setDefaultResourceLevel(graphicsObjectInfo, afpContext.getResourceManager()); + AFPPaintingState paintingState = afpContext.getPaintingState(); + paintingState.save(); // save + AffineTransform placement = new AffineTransform(); + placement.translate(pos.x, pos.y); + paintingState.concatenate(placement); + // Image content ImageGraphics2D imageG2D = (ImageGraphics2D)image; boolean textAsShapes = false; //TODO Make configurable @@ -152,6 +159,8 @@ public class AFPImageHandlerGraphics2D e // Create image afpContext.getResourceManager().createObject(graphicsObjectInfo); + + paintingState.restore(); // resume } /** {@inheritDoc} */ Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java Sat Jun 12 08:19:48 2010 @@ -101,6 +101,7 @@ public class AFPImageHandlerRenderedImag maxPixelSize *= 3; //RGB is maximum } } + float ditheringQuality = paintingState.getDitheringQuality(); RenderedImage renderedImage = imageRendered.getRenderedImage(); ImageInfo imageInfo = imageRendered.getInfo(); @@ -130,9 +131,13 @@ public class AFPImageHandlerRenderedImag log.debug("Resample from " + intrinsicSize.getDimensionPx() + " to " + resampledDim); } - renderedImage = BitmapImageUtil.convertToMonochrome(renderedImage, resampledDim); + renderedImage = BitmapImageUtil.convertToMonochrome(renderedImage, + resampledDim, ditheringQuality); effIntrinsicSize = new ImageSize( resampledDim.width, resampledDim.height, resolution); + } else if (ditheringQuality >= 0.5f) { + renderedImage = BitmapImageUtil.convertToMonochrome(renderedImage, + intrinsicSize.getDimensionPx(), ditheringQuality); } } @@ -157,7 +162,6 @@ public class AFPImageHandlerRenderedImag if (cm.hasAlpha()) { pixelSize -= 8; } - //TODO Add support for CMYK images byte[] imageData = null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRenderer.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRenderer.java?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRenderer.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRenderer.java Sat Jun 12 08:19:48 2010 @@ -839,6 +839,11 @@ public class AFPRenderer extends Abstrac } /** {@inheritDoc} */ + public void setDitheringQuality(float quality) { + this.paintingState.setDitheringQuality(quality); + } + + /** {@inheritDoc} */ public void setShadingMode(AFPShadingMode shadingMode) { this.shadingMode = shadingMode; } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java Sat Jun 12 08:19:48 2010 @@ -390,6 +390,21 @@ public class AFPRendererConfigurator ext customizable.setBitsPerPixel(bitsPerPixel); } + String dithering = imagesCfg.getAttribute("dithering-quality", "medium"); + float dq = 0.5f; + if (dithering.startsWith("min")) { + dq = 0.0f; + } else if (dithering.startsWith("max")) { + dq = 1.0f; + } else { + try { + dq = Float.parseFloat(dithering); + } catch (NumberFormatException nfe) { + //ignore and leave the default above + } + } + customizable.setDitheringQuality(dq); + // native image support boolean nativeImageSupport = imagesCfg.getAttributeAsBoolean("native", false); customizable.setNativeImagesSupported(nativeImageSupport); Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java Sat Jun 12 08:19:48 2010 @@ -135,6 +135,53 @@ public class BitmapImageUtil { */ public static final BufferedImage convertToMonochrome(RenderedImage img, Dimension targetDimension) { + return toBufferedImage(convertToMonochrome(img, targetDimension, 0.0f)); + } + + /** + * Converts an image to a monochrome 1-bit image. Optionally, the image can be scaled. + * @param img the image to be converted + * @param targetDimension the new target dimensions or null if no scaling is necessary + * @param quality Defines the desired quality level for the conversion. + * Valid values: a value between 0.0f (fastest) and 1.0f (best) + * @return the monochrome image + */ + public static final RenderedImage convertToMonochrome(RenderedImage img, + Dimension targetDimension, float quality) { + if (!isMonochromeImage(img)) { + if (quality >= 0.5f) { + BufferedImage bi; + Dimension orgDim = new Dimension(img.getWidth(), img.getHeight()); + if (targetDimension != null && !orgDim.equals(targetDimension)) { + //Scale only before dithering + ColorModel cm = img.getColorModel(); + BufferedImage tgt = new BufferedImage(cm, + cm.createCompatibleWritableRaster( + targetDimension.width, targetDimension.height), + cm.isAlphaPremultiplied(), null); + transferImage(img, tgt); + bi = tgt; + } else { + bi = toBufferedImage(img); + } + //Now convert to monochrome (dithering if available) + MonochromeBitmapConverter converter = createDefaultMonochromeBitmapConverter(); + if (quality >= 0.8f) { + //Activates error diffusion if JAI is available + converter.setHint("quality", Boolean.TRUE.toString()); + //Need to convert to grayscale first since otherwise, there may be encoding + //problems later with the images JAI can generate. + bi = convertToGrayscale(bi, targetDimension); + } + try { + return converter.convertToMonochrome(bi); + } catch (Exception e) { + //Provide a fallback if exotic formats are encountered + bi = convertToGrayscale(bi, targetDimension); + return converter.convertToMonochrome(bi); + } + } + } return convertAndScaleImage(img, targetDimension, BufferedImage.TYPE_BYTE_BINARY); } Modified: xmlgraphics/fop/trunk/status.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/status.xml?rev=953952&r1=953951&r2=953952&view=diff ============================================================================== --- xmlgraphics/fop/trunk/status.xml (original) +++ xmlgraphics/fop/trunk/status.xml Sat Jun 12 08:19:48 2010 @@ -59,6 +59,13 @@ --> <release version="FOP Trunk" date="TBD"> <action context="Renderers" dev="JM" type="fix"> + AFP Output: Fixed positioning of Java2D-based images (when GOCA is enabled). + </action> + <action context="Renderers" dev="JM" type="add"> + AFP Output: Added enhanced dithering functionality for images that are converted to + bi-level images. + </action> + <action context="Renderers" dev="JM" type="fix"> AFP Output: Fix for bitmap images inside an SVG or G2D graphic (printer errors) and positioning fix for bitmaps from G2D graphics. </action> --------------------------------------------------------------------- To unsubscribe, e-mail: aaron59@example.net For additional commands, e-mail: aaron59@example.net From fop-commits-return-11466aaron59@example.net Mon Jun 14 15:22:08 2010 Return-Path: <fop-commits-return-11466aaron59@example.net> Delivered-To: aaron59@example.net Received: (qmail 117 invoked from network); 14 Jun 2010 15:22:07 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 14 Jun 2010 15:22:07 -0000 Received: (qmail 77281 invoked by uid 500); 14 Jun 2010 15:22:07 -0000 Delivered-To: aaron59@example.net Received: (qmail 77232 invoked by uid 500); 14 Jun 2010 15:22:06 -0000 Mailing-List: contact aaron59@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:aaron59@example.net> List-Unsubscribe: <mailto:aaron59@example.net> List-Post: <mailto:aaron59@example.net> List-Id: <fop-commits.xmlgraphics.apache.org> Reply-To: aaron59@example.net Delivered-To: mailing list aaron59@example.net Received: (qmail 77088 invoked by uid 99); 14 Jun 2010 15:22:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jun 2010 15:22:06 +0000 X-ASF-Spam-Status: No, hits=-1393.6 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jun 2010 15:22:05 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6169D23888EA; Mon, 14 Jun 2010 15:21:19 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r954512 - in /xmlgraphics/fop/trunk: lib/ src/java/org/apache/fop/afp/ src/java/org/apache/fop/afp/modca/ src/java/org/apache/fop/pdf/ src/java/org/apache/fop/svg/ src/java/org/apache/fop/util/ test/java/org/apache/fop/traits/ test/java/org... Date: Mon, 14 Jun 2010 15:21:19 -0000 To: aaron59@example.net From: aaron59@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <aaron59@example.net> Author: jeremias Date: Mon Jun 14 15:21:18 2010 New Revision: 954512 URL: http://svn.apache.org/viewvc?rev=954512&view=rev Log: Color-related classes were moved to the org.apache.xmlgraphics.java2d.color package. Updated XML Graphics Commons Snapshot. Modified: xmlgraphics/fop/trunk/lib/xmlgraphics-commons-1.4svn.jar xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/GraphicsObject.java xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFColor.java xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorUtil.java xmlgraphics/fop/trunk/test/java/org/apache/fop/traits/BorderPropsTestCase.java xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ColorUtilTestCase.java Modified: xmlgraphics/fop/trunk/lib/xmlgraphics-commons-1.4svn.jar URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/lib/xmlgraphics-commons-1.4svn.jar?rev=954512&r1=954511&r2=954512&view=diff ============================================================================== Binary files - no diff available. Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java?rev=954512&r1=954511&r2=954512&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/AFPPaintingState.java Mon Jun 14 15:21:18 2010 @@ -24,9 +24,9 @@ import java.awt.Point; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.xmlgraphics.java2d.ColorConverter; -import org.apache.xmlgraphics.java2d.DefaultColorConverter; -import org.apache.xmlgraphics.java2d.GrayScaleColorConverter; +import org.apache.xmlgraphics.java2d.color.ColorConverter; +import org.apache.xmlgraphics.java2d.color.DefaultColorConverter; +import org.apache.xmlgraphics.java2d.color.GrayScaleColorConverter; import org.apache.fop.afp.fonts.AFPPageFonts; import org.apache.fop.util.AbstractPaintingState; Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/GraphicsObject.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/GraphicsObject.java?rev=954512&r1=954511&r2=954512&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/GraphicsObject.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/modca/GraphicsObject.java Mon Jun 14 15:21:18 2010 @@ -25,7 +25,7 @@ import java.io.OutputStream; import java.util.Iterator; import java.util.List; -import org.apache.xmlgraphics.java2d.ColorConverter; +import org.apache.xmlgraphics.java2d.color.ColorConverter; import org.apache.fop.afp.AFPDataObjectInfo; import org.apache.fop.afp.AFPObjectAreaInfo; Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFColor.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFColor.java?rev=954512&r1=954511&r2=954512&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFColor.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/pdf/PDFColor.java Mon Jun 14 15:21:18 2010 @@ -26,8 +26,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.apache.xmlgraphics.java2d.CMYKColorSpace; -import org.apache.xmlgraphics.java2d.ColorExt; +import org.apache.xmlgraphics.java2d.color.CMYKColorSpace; +import org.apache.xmlgraphics.java2d.color.ColorExt; /** * PDF Color object. Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java?rev=954512&r1=954511&r2=954512&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/svg/PDFGraphics2D.java Mon Jun 14 15:21:18 2010 @@ -66,8 +66,8 @@ import org.apache.xmlgraphics.image.load import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG; import org.apache.xmlgraphics.image.loader.impl.ImageRendered; import org.apache.xmlgraphics.java2d.AbstractGraphics2D; -import org.apache.xmlgraphics.java2d.ColorExt; import org.apache.xmlgraphics.java2d.GraphicContext; +import org.apache.xmlgraphics.java2d.color.ColorExt; import org.apache.fop.fonts.Font; import org.apache.fop.fonts.FontInfo; @@ -762,7 +762,7 @@ public class PDFGraphics2D extends Abstr //currentStream.write(currentColour.getColorSpaceOut(fill)); } else { throw new UnsupportedOperationException( - "Color Space not supported by PDFGraphics2D"); + "Color Space not supported by PDFGraphics2D: " + c.getColorSpace()); } } Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorUtil.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorUtil.java?rev=954512&r1=954511&r2=954512&view=diff ============================================================================== --- xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorUtil.java (original) +++ xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorUtil.java Mon Jun 14 15:21:18 2010 @@ -27,8 +27,8 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.xmlgraphics.java2d.CMYKColorSpace; -import org.apache.xmlgraphics.java2d.ColorExt; +import org.apache.xmlgraphics.java2d.color.CMYKColorSpace; +import org.apache.xmlgraphics.java2d.color.ColorExt; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.fo.expr.PropertyException; @@ -682,7 +682,7 @@ public final class ColorUtil { * @return the modified color */ public static Color lightenColor(Color col, float factor) { - return org.apache.xmlgraphics.java2d.ColorUtil.lightenColor(col, factor); + return org.apache.xmlgraphics.java2d.color.ColorUtil.lightenColor(col, factor); } /** @@ -701,7 +701,7 @@ public final class ColorUtil { * @return true if it is a gray value */ public static boolean isGray(Color col) { - return org.apache.xmlgraphics.java2d.ColorUtil.isGray(col); + return org.apache.xmlgraphics.java2d.color.ColorUtil.isGray(col); } /** @@ -711,6 +711,6 @@ public final class ColorUtil { */ public static Color toCMYKGrayColor(float black) { - return org.apache.xmlgraphics.java2d.ColorUtil.toCMYKGrayColor(black); + return org.apache.xmlgraphics.java2d.color.ColorUtil.toCMYKGrayColor(black); } } Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/traits/BorderPropsTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/traits/BorderPropsTestCase.java?rev=954512&r1=954511&r2=954512&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/java/org/apache/fop/traits/BorderPropsTestCase.java (original) +++ xmlgraphics/fop/trunk/test/java/org/apache/fop/traits/BorderPropsTestCase.java Mon Jun 14 15:21:18 2010 @@ -23,8 +23,8 @@ import java.awt.Color; import junit.framework.TestCase; -import org.apache.xmlgraphics.java2d.CMYKColorSpace; -import org.apache.xmlgraphics.java2d.ColorExt; +import org.apache.xmlgraphics.java2d.color.CMYKColorSpace; +import org.apache.xmlgraphics.java2d.color.ColorExt; import org.apache.fop.fo.Constants; import org.apache.fop.util.ColorUtil; Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ColorUtilTestCase.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ColorUtilTestCase.java?rev=954512&r1=954511&r2=954512&view=diff ============================================================================== --- xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ColorUtilTestCase.java (original) +++ xmlgraphics/fop/trunk/test/java/org/apache/fop/util/ColorUtilTestCase.java Mon Jun 14 15:21:18 2010 @@ -24,8 +24,8 @@ import java.awt.color.ColorSpace; import junit.framework.TestCase; -import org.apache.xmlgraphics.java2d.CMYKColorSpace; -import org.apache.xmlgraphics.java2d.ColorExt; +import org.apache.xmlgraphics.java2d.color.CMYKColorSpace; +import org.apache.xmlgraphics.java2d.color.ColorExt; import org.apache.fop.apps.FOUserAgent; import org.apache.fop.apps.FopFactory; --------------------------------------------------------------------- To unsubscribe, e-mail: aaron59@example.net For additional commands, e-mail: aaron59@example.net From fop-commits-return-11467aaron59@example.net Mon Jun 14 17:02:04 2010 Return-Path: <fop-commits-return-11467aaron59@example.net> Delivered-To: aaron59@example.net Received: (qmail 62370 invoked from network); 14 Jun 2010 17:02:04 -0000 Received: from unknown (HELO mail.apache.org) (83.161.120.155) by 83.161.120.155 with SMTP; 14 Jun 2010 17:02:04 -0000 Received: (qmail 29483 invoked by uid 500); 14 Jun 2010 17:02:04 -0000 Delivered-To: aaron59@example.net Received: (qmail 29435 invoked by uid 500); 14 Jun 2010 17:02:04 -0000 Mailing-List: contact aaron59@example.net; run by ezmlm Precedence: bulk List-Help: <mailto:aaron59@example.net> List-Unsubscribe: <mailto:aaron59@example.net> List-Post: <mailto:aaron59@example.net> List-Id: <fop-commits.xmlgraphics.apache.org> Reply-To: aaron59@example.net Delivered-To: mailing list aaron59@example.net Received: (qmail 29428 invoked by uid 99); 14 Jun 2010 17:02:04 -0000 Received: from athena.apache.org (HELO athena.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jun 2010 17:02:04 +0000 X-ASF-Spam-Status: No, hits=-1159.1 required=10.0 tests=ALL_TRUSTED,AWL,FB_GET_MEDS X-Spam-Check-By: apache.org Received: from [83.161.120.155] (HELO eris.apache.org) (83.161.120.155) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 14 Jun 2010 17:02:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 149BD23889BB; Mon, 14 Jun 2010 17:01:16 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r954554 - in /xmlgraphics/fop/branches/Temp_TrueTypeInPostScript: ./ lib/ src/documentation/content/xdocs/trunk/ src/java/org/apache/fop/afp/ src/java/org/apache/fop/afp/modca/ src/java/org/apache/fop/pdf/ src/java/org/apache/fop/render/afp... Date: Mon, 14 Jun 2010 17:01:15 -0000 To: aaron59@example.net From: aaron59@example.net X-Mailer: svnmailer-1.0.8 Message-Id: <aaron59@example.net> Author: vhennebert Date: Mon Jun 14 17:01:14 2010 New Revision: 954554 URL: http://svn.apache.org/viewvc?rev=954554&view=rev Log: Merged changes from Trunk up to revision 954512 Added: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java - copied unchanged from r954552, xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeEvent.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java - copied unchanged from r954552, xmlgraphics/fop/trunk/src/java/org/apache/fop/render/awt/viewer/PageChangeListener.java Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/ (props changed) xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/lib/xmlgraphics-commons-1.4svn.jar xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/documentation/content/xdocs/trunk/output.xml xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/AFPGraphics2D.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/AFPPaintingState.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/modca/GraphicsObject.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColor.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNumber.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPCustomizable.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPDocumentHandler.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPImageHandlerGraphics2D.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPImageHandlerRenderedImage.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPRenderer.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPRendererConfigurator.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/awt/viewer/PreviewDialog.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/awt/viewer/PreviewPanel.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/svg/PDFGraphics2D.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/util/ColorUtil.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/util/bitmap/BitmapImageUtil.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/status.xml xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/test/java/org/apache/fop/traits/BorderPropsTestCase.java xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/test/java/org/apache/fop/util/ColorUtilTestCase.java Propchange: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/ ------------------------------------------------------------------------------ --- svn:mergeinfo (original) +++ svn:mergeinfo Mon Jun 14 17:01:14 2010 @@ -1,2 +1,3 @@ /xmlgraphics/fop/branches/Temp_AreaTreeNewDesign:603620-746655 /xmlgraphics/fop/branches/fop-0_95:684572,688085,688696 +/xmlgraphics/fop/trunk:949179-954552 Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/lib/xmlgraphics-commons-1.4svn.jar URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/lib/xmlgraphics-commons-1.4svn.jar?rev=954554&r1=954553&r2=954554&view=diff ============================================================================== Binary files - no diff available. Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/documentation/content/xdocs/trunk/output.xml URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/documentation/content/xdocs/trunk/output.xml?rev=954554&r1=954553&r2=954554&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/documentation/content/xdocs/trunk/output.xml (original) +++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/documentation/content/xdocs/trunk/output.xml Mon Jun 14 17:01:14 2010 @@ -531,9 +531,10 @@ out = proc.getOutputStream();]]></source latest features. We're trying to make AFP output work in as many environments as possible. However, to make AFP output work on older environments it is recommended to set to configuration to 1 bit per pixel (see below on how to do this). In this case, all images - are converted to bi-level images using IOCA function set 10 (FS10). If a higher number of - bits per pixel is configured, FOP has to switch to at least FS11 which may not work - everywhere. + are converted to bi-level images using IOCA function set 10 (FS10) and are enclosed in + page-segments since some implementation cannot deal with IOCA objects directly. + If a higher number of bits per pixel is configured, FOP has to switch to at least FS11 + which may not work everywhere. </p> </section> <section id="afp-configuration"> @@ -724,8 +725,20 @@ Note that the value of the encoding attr colors. This will only have an effect if the color mode is set to "color". Example: </p> <source><![CDATA[ - <images mode="color" cmyk="true"/> -]]></source> + <images mode="color" cmyk="true"/>]]></source> + <p> + When the color mode is set to 1 bit (bi-level), the "dithering-quality" attribute can + be used to select the level of quality to use when converting images to bi-level images. + Valid values for this attribute are floating point numbers from 0.0 (fastest) to + 1.0 (best), or special values: "minimum" (=0.0), "maximum" (1.0), + "medium" (0.5, the default). For the higher settings to work as expected, JAI needs to + be present in the classpath. If JAI is present, 0.0 results in a minimal darkness-level + switching between white and black. 0.5 does bayer-based dithering and 1.0 will use + error-diffusion dithering. The higher the value, the higher the quality and the slower + the processing of the images. + </p> + <source><![CDATA[ + <images mode="b+w" bits-per-pixel="1" dithering-quality="maximum"/>]]></source> </section> <section id="afp-shading-config"> <title>Shading</title> Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/AFPGraphics2D.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/AFPGraphics2D.java?rev=954554&r1=954553&r2=954554&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/AFPGraphics2D.java (original) +++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/AFPGraphics2D.java Mon Jun 14 17:01:14 2010 @@ -45,7 +45,6 @@ import java.awt.image.RenderedImage; import java.awt.image.renderable.RenderableImage; import java.io.IOException; -import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -56,8 +55,6 @@ import org.apache.xmlgraphics.java2d.Abs import org.apache.xmlgraphics.java2d.GraphicContext; import org.apache.xmlgraphics.java2d.StrokingTextHandler; import org.apache.xmlgraphics.java2d.TextHandler; -import org.apache.xmlgraphics.ps.ImageEncodingHelper; -import org.apache.xmlgraphics.util.MimeConstants; import org.apache.xmlgraphics.util.UnitConv; import org.apache.fop.afp.goca.GraphicsSetLineType; @@ -65,6 +62,8 @@ import org.apache.fop.afp.modca.Graphics import org.apache.fop.afp.svg.AFPGraphicsConfiguration; import org.apache.fop.afp.util.CubicBezierApproximator; import org.apache.fop.fonts.FontInfo; +import org.apache.fop.render.afp.AFPImageHandlerRenderedImage; +import org.apache.fop.render.afp.AFPRenderingContext; import org.apache.fop.svg.NativeImageHandler; /** @@ -559,68 +558,6 @@ public class AFPGraphics2D extends Abstr BufferedImage.TYPE_INT_ARGB); } - private AFPImageObjectInfo createImageObjectInfo( - RenderedImage img, int x, int y, int width, int height) throws IOException { - ImageInfo imageInfo = new ImageInfo(null, "image/unknown"); - ImageSize size = new ImageSize(img.getWidth(), img.getHeight(), 72); - imageInfo.setSize(size); - - ImageRendered imageRendered = new ImageRendered(imageInfo, img, null); - RenderedImage renderedImage = imageRendered.getRenderedImage(); - - // create image object info - AFPImageObjectInfo imageObjectInfo = new AFPImageObjectInfo(); - - imageObjectInfo.setMimeType(MimeConstants.MIME_AFP_IOCA_FS45); - - int bitsPerPixel = paintingState.getBitsPerPixel(); - imageObjectInfo.setBitsPerPixel(bitsPerPixel); - - imageObjectInfo.setResourceInfo(resourceInfo); - - int dataHeight = renderedImage.getHeight(); - imageObjectInfo.setDataHeight(dataHeight); - - int dataWidth = renderedImage.getWidth(); - imageObjectInfo.setDataWidth(dataWidth); - - boolean colorImages = paintingState.isColorImages(); - imageObjectInfo.setColor(colorImages); - - ByteArrayOutputStream boas = new ByteArrayOutputStream(); - ImageEncodingHelper.encodeRenderedImageAsRGB(renderedImage, boas); - byte[] imageData = boas.toByteArray(); - - // convert to grayscale - if (!colorImages) { - boas.reset(); - imageObjectInfo.setBitsPerPixel(bitsPerPixel); - ImageEncodingHelper.encodeRGBAsGrayScale( - imageData, dataWidth, dataHeight, bitsPerPixel, boas); - imageData = boas.toByteArray(); - } - imageObjectInfo.setData(imageData); - - if (imageInfo != null) { - imageObjectInfo.setUri(imageInfo.getOriginalURI()); - } - - // create object area info - AFPObjectAreaInfo objectAreaInfo = new AFPObjectAreaInfo(); - objectAreaInfo.setX(x); - objectAreaInfo.setY(y); - objectAreaInfo.setWidth(width); - objectAreaInfo.setHeight(height); - - int resolution = paintingState.getResolution(); - objectAreaInfo.setWidthRes(resolution); - objectAreaInfo.setHeightRes(resolution); - - imageObjectInfo.setObjectAreaInfo(objectAreaInfo); - - return imageObjectInfo; - } - /** * Draws an AWT image into a BufferedImage using an AWT Graphics2D implementation * @@ -660,30 +597,13 @@ public class AFPGraphics2D extends Abstr /** {@inheritDoc} */ public boolean drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) { - // draw with AWT Graphics2D Dimension imageSize = new Dimension(width, height); BufferedImage bufferedImage = buildBufferedImage(imageSize); boolean drawn = drawBufferedImage(img, bufferedImage, width, height, observer); if (drawn) { - AffineTransform at = gc.getTransform(); - float[] srcPts = new float[] {x, y}; - float[] dstPts = new float[srcPts.length]; - at.transform(srcPts, 0, dstPts, 0, 1); - x = Math.round(dstPts[X]); - y = Math.round(dstPts[Y]); - try { - // get image object info - AFPImageObjectInfo imageObjectInfo - = createImageObjectInfo(bufferedImage, x, y, width, height); - - // create image resource - resourceManager.createObject(imageObjectInfo); - return true; - } catch (IOException ioe) { - handleIOException(ioe); - } + drawRenderedImage(bufferedImage, new AffineTransform()); } return false; } @@ -693,20 +613,33 @@ public class AFPGraphics2D extends Abstr int imgWidth = img.getWidth(); int imgHeight = img.getHeight(); - AffineTransform at = paintingState.getData().getTransform(); AffineTransform gat = gc.getTransform(); int graphicsObjectHeight = graphicsObj.getObjectEnvironmentGroup().getObjectAreaDescriptor().getHeight(); - int x = (int)Math.round(at.getTranslateX() + gat.getTranslateX()); - int y = (int)Math.round(at.getTranslateY() - (gat.getTranslateY() - graphicsObjectHeight)); - int width = (int)Math.round(imgWidth * gat.getScaleX()); - int height = (int)Math.round(imgHeight * -gat.getScaleY()); + + double toMillipointFactor = UnitConv.IN2PT * 1000 / (double)paintingState.getResolution(); + double x = gat.getTranslateX(); + double y = -(gat.getTranslateY() - graphicsObjectHeight); + x = toMillipointFactor * x; + y = toMillipointFactor * y; + double w = toMillipointFactor * imgWidth * gat.getScaleX(); + double h = toMillipointFactor * imgHeight * -gat.getScaleY(); + + AFPImageHandlerRenderedImage handler = new AFPImageHandlerRenderedImage(); + ImageInfo imageInfo = new ImageInfo(null, null); + imageInfo.setSize(new ImageSize( + img.getWidth(), img.getHeight(), paintingState.getResolution())); + imageInfo.getSize().calcSizeFromPixels(); + ImageRendered red = new ImageRendered(imageInfo, img, null); + Rectangle targetPos = new Rectangle( + (int)Math.round(x), + (int)Math.round(y), + (int)Math.round(w), + (int)Math.round(h)); + AFPRenderingContext context = new AFPRenderingContext(null, + resourceManager, paintingState, fontInfo, null); try { - // get image object info - AFPImageObjectInfo imageObjectInfo - = createImageObjectInfo(img, x, y, width, height); - // create image resource - resourceManager.createObject(imageObjectInfo); + handler.handleImage(context, red, targetPos); } catch (IOException ioe) { handleIOException(ioe); } Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/AFPPaintingState.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/AFPPaintingState.java?rev=954554&r1=954553&r2=954554&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/AFPPaintingState.java (original) +++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/AFPPaintingState.java Mon Jun 14 17:01:14 2010 @@ -24,9 +24,9 @@ import java.awt.Point; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.xmlgraphics.java2d.ColorConverter; -import org.apache.xmlgraphics.java2d.DefaultColorConverter; -import org.apache.xmlgraphics.java2d.GrayScaleColorConverter; +import org.apache.xmlgraphics.java2d.color.ColorConverter; +import org.apache.xmlgraphics.java2d.color.DefaultColorConverter; +import org.apache.xmlgraphics.java2d.color.GrayScaleColorConverter; import org.apache.fop.afp.fonts.AFPPageFonts; import org.apache.fop.util.AbstractPaintingState; @@ -51,6 +51,9 @@ public class AFPPaintingState extends or /** color image support */ private boolean colorImages = false; + /** dithering quality setting (0.0f..1.0f) */ + private float ditheringQuality; + /** color image handler */ private ColorConverter colorConverter = GrayScaleColorConverter.getInstance(); @@ -234,6 +237,25 @@ public class AFPPaintingState extends or } /** + * Gets the dithering quality setting to use when converting images to monochrome images. + * @return the dithering quality (a value between 0.0f and 1.0f) + */ + public float getDitheringQuality() { + return this.ditheringQuality; + } + + /** + * Sets the dithering quality setting to use when converting images to monochrome images. + * @param quality Defines the desired quality level for the conversion. + * Valid values: a value between 0.0f (fastest) and 1.0f (best) + */ + public void setDitheringQuality(float quality) { + quality = Math.max(quality, 0.0f); + quality = Math.min(quality, 1.0f); + this.ditheringQuality = quality; + } + + /** * Sets the output/device resolution * * @param resolution Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java?rev=954554&r1=954553&r2=954554&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java (original) +++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/modca/GraphicsDataDescriptor.java Mon Jun 14 17:01:14 2010 @@ -104,8 +104,8 @@ public class GraphicsDataDescriptor exte return data; } - private static final int ABS = 2; - private static final int IMGRES = 8; + private static final int ABS = 64; + private static final int IMGRES = 16; /** * Returns the window specification data Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/modca/GraphicsObject.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/modca/GraphicsObject.java?rev=954554&r1=954553&r2=954554&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/modca/GraphicsObject.java (original) +++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/afp/modca/GraphicsObject.java Mon Jun 14 17:01:14 2010 @@ -25,7 +25,7 @@ import java.io.OutputStream; import java.util.Iterator; import java.util.List; -import org.apache.xmlgraphics.java2d.ColorConverter; +import org.apache.xmlgraphics.java2d.color.ColorConverter; import org.apache.fop.afp.AFPDataObjectInfo; import org.apache.fop.afp.AFPObjectAreaInfo; Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColor.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColor.java?rev=954554&r1=954553&r2=954554&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColor.java (original) +++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFColor.java Mon Jun 14 17:01:14 2010 @@ -26,8 +26,8 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.apache.xmlgraphics.java2d.CMYKColorSpace; -import org.apache.xmlgraphics.java2d.ColorExt; +import org.apache.xmlgraphics.java2d.color.CMYKColorSpace; +import org.apache.xmlgraphics.java2d.color.ColorExt; /** * PDF Color object. Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNumber.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNumber.java?rev=954554&r1=954553&r2=954554&view=diff ============================================================================== --- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNumber.java (original) +++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/pdf/PDFNumber.java Mon Jun 14 17:01:14 2010 @@ -88,7 +88,7 @@ public class PDFNumber extends PDFObject if (hasObjectNumber()) { sb.append(getObjectID()); } - sb.append(getNumber().toString()); + sb.append(doubleOut(getNumber().doubleValue(), 10)); if (hasObjectNumber()) { sb.append("\nendobj\n"); } Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPCustomizable.java URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/render/afp/AFPCustomizable.java?rev=954554&r1=954553&r2=954554&view=diff
{'source': 'Apache Software Foundation Public Mail Archives'}