Author: acumiskey
Date: Mon Oct 20 06:42:28 2008
New Revision: 706282
URL: http://svn.apache.org/viewvc?rev=706282&view=rev
Log:
Merged revisions 706272,706276 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk
........
r706272 | jeremias | 2008-10-20 14:14:03 +0100 (Mon, 20 Oct 2008) | 1 line
Visually separated retroweaver part from hyphenation part.
........
r706276 | jeremias | 2008-10-20 14:20:26 +0100 (Mon, 20 Oct 2008) | 3 lines
Fixed size of images when vector graphic images are painted using
fox:conversion-mode="bitmap" (for PDF output).
Added support for fox:conversion-mode="bitmap" for PS output.
Avoid "unsupported target ImageFlavor" error after the fix in XML Graphics
Commons (rev 706270).
........
Modified:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/ (props changed)
xmlgraphics/fop/branches/Temp_AFPGOCAResources/build.xml
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSSVGHandler.java
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Oct 20 06:42:28 2008
@@ -1,2 +1,2 @@
/xmlgraphics/fop/branches/fop-0_95:684572,688085,688696
-/xmlgraphics/fop/trunk:693433-698670,699739,704008-704909,705529-706135
+/xmlgraphics/fop/trunk:693433-698670,699739,704008-704909,705529-706135,706272-706276
Propchange: xmlgraphics/fop/branches/Temp_AFPGOCAResources/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Oct 20 06:42:28 2008
@@ -1 +1 @@
-/xmlgraphics/fop/trunk:1-706270
+/xmlgraphics/fop/trunk:1-706277
Modified: xmlgraphics/fop/branches/Temp_AFPGOCAResources/build.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/build.xml?rev=706282&r1=706281&r2=706282&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_AFPGOCAResources/build.xml (original)
+++ xmlgraphics/fop/branches/Temp_AFPGOCAResources/build.xml Mon Oct 20
06:42:28 2008
@@ -459,6 +459,9 @@
</manifest>
</jar>
</target>
+ <!-- =================================================================== -->
+ <!-- Retroweaver -->
+ <!-- =================================================================== -->
<target name="retro-unavail" unless="java14.rt.lib">
<echo message="Please set the path to a JDK 1.4 installation in your
build-local.properties" />
<echo message="to allow for verification!" />
Modified:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java?rev=706282&r1=706281&r2=706282&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java
(original)
+++
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/image/loader/batik/ImageLoaderSVG.java
Mon Oct 20 06:42:28 2008
@@ -23,6 +23,7 @@
import java.util.Map;
import org.apache.batik.dom.svg.SVGDOMImplementation;
+
import org.apache.xmlgraphics.image.loader.Image;
import org.apache.xmlgraphics.image.loader.ImageException;
import org.apache.xmlgraphics.image.loader.ImageFlavor;
@@ -45,8 +46,8 @@
* @param targetFlavor the target flavor
*/
public ImageLoaderSVG(ImageFlavor targetFlavor) {
- if (!(XMLNamespaceEnabledImageFlavor.SVG_DOM.equals(targetFlavor))) {
- throw new IllegalArgumentException("Unsupported target
ImageFlavor: " + targetFlavor);
+ if
(!(XMLNamespaceEnabledImageFlavor.SVG_DOM.isCompatible(targetFlavor))) {
+ throw new IllegalArgumentException("Incompatible target
ImageFlavor: " + targetFlavor);
}
this.targetFlavor = targetFlavor;
}
Modified:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java?rev=706282&r1=706281&r2=706282&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
(original)
+++
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/AbstractGenericSVGHandler.java
Mon Oct 20 06:42:28 2008
@@ -37,7 +37,9 @@
import org.apache.commons.logging.LogFactory;
import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
+import org.apache.xmlgraphics.util.QName;
+import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.render.RendererContext.RendererContextWrapper;
import org.apache.fop.svg.SVGEventProducer;
import org.apache.fop.svg.SVGUserAgent;
@@ -50,8 +52,9 @@
*/
public abstract class AbstractGenericSVGHandler implements XMLHandler,
RendererContextConstants {
- /** logging instance */
- protected static Log log =
LogFactory.getLog(AbstractGenericSVGHandler.class);
+ /** Qualified name for the "conversion-mode" extension attribute. */
+ protected static final QName CONVERSION_MODE = new QName(
+ ExtensionElementMapping.URI, null, "conversion-mode");
/** [EMAIL PROTECTED] */
public void handleXML(RendererContext context,
Modified:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java?rev=706282&r1=706281&r2=706282&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java
(original)
+++
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/pdf/PDFGraphics2DAdapter.java
Mon Oct 20 06:42:28 2008
@@ -66,8 +66,8 @@
float imw = (float)dim.getWidth() / 1000f;
float imh = (float)dim.getHeight() / 1000f;
- float sx = fwidth / (float)imw;
- float sy = fheight / (float)imh;
+ float sx = pdfInfo.paintAsBitmap ? 1.0f : (fwidth / (float)imw);
+ float sy = pdfInfo.paintAsBitmap ? 1.0f : (fheight / (float)imh);
renderer.saveGraphicsState();
renderer.setColor(Color.black, false, null);
Modified:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java?rev=706282&r1=706281&r2=706282&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java
(original)
+++
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSGraphics2DAdapter.java
Mon Oct 20 06:42:28 2008
@@ -22,21 +22,32 @@
import java.awt.Dimension;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
import java.io.IOException;
+import java.util.Map;
import org.apache.xmlgraphics.java2d.Graphics2DImagePainter;
import org.apache.xmlgraphics.java2d.ps.PSGraphics2D;
import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.util.QName;
+import org.apache.fop.fo.extensions.ExtensionElementMapping;
import org.apache.fop.render.AbstractGraphics2DAdapter;
import org.apache.fop.render.Graphics2DAdapter;
import org.apache.fop.render.RendererContext;
+import org.apache.fop.render.RendererContextConstants;
+import org.apache.fop.render.RendererContext.RendererContextWrapper;
+import org.apache.fop.render.pdf.PDFRenderer;
/**
* Graphics2DAdapter implementation for PostScript.
*/
public class PSGraphics2DAdapter extends AbstractGraphics2DAdapter {
+ /** Qualified name for the "conversion-mode" extension attribute. */
+ protected static final QName CONVERSION_MODE = new QName(
+ ExtensionElementMapping.URI, null, "conversion-mode");
+
private PSGenerator gen;
private boolean clip = true;
@@ -72,8 +83,15 @@
float imw = (float)dim.getWidth() / 1000f;
float imh = (float)dim.getHeight() / 1000f;
- float sx = fwidth / (float)imw;
- float sy = fheight / (float)imh;
+ boolean paintAsBitmap = false;
+ if (context != null) {
+ Map foreign =
(Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
+ paintAsBitmap = (foreign != null
+ &&
"bitmap".equalsIgnoreCase((String)foreign.get(CONVERSION_MODE)));
+ }
+
+ float sx = paintAsBitmap ? 1.0f : (fwidth / (float)imw);
+ float sy = paintAsBitmap ? 1.0f : (fheight / (float)imh);
gen.commentln("%FOPBeginGraphics2D");
gen.saveGraphicsState();
@@ -96,8 +114,19 @@
// scale to viewbox
transform.translate(fx, fy);
gen.getCurrentState().concatMatrix(transform);
- Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh);
- painter.paint(graphics, area);
+ if (paintAsBitmap) {
+ //Fallback solution: Paint to a BufferedImage
+ int resolution =
(int)Math.round(context.getUserAgent().getTargetResolution());
+ RendererContextWrapper ctx =
RendererContext.wrapRendererContext(context);
+ BufferedImage bi = paintToBufferedImage(painter, ctx, resolution,
false, false);
+
+ float scale = PDFRenderer.NORMAL_PDF_RESOLUTION
+ / context.getUserAgent().getTargetResolution();
+ graphics.drawImage(bi, new AffineTransform(scale, 0, 0, scale, 0,
0), null);
+ } else {
+ Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh);
+ painter.paint(graphics, area);
+ }
gen.restoreGraphicsState();
gen.commentln("%FOPEndGraphics2D");
Modified:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java?rev=706282&r1=706281&r2=706282&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java
(original)
+++
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSRenderer.java
Mon Oct 20 06:42:28 2008
@@ -40,6 +40,36 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
+import org.apache.xmlgraphics.image.loader.ImageException;
+import org.apache.xmlgraphics.image.loader.ImageFlavor;
+import org.apache.xmlgraphics.image.loader.ImageInfo;
+import org.apache.xmlgraphics.image.loader.ImageManager;
+import org.apache.xmlgraphics.image.loader.ImageSessionContext;
+import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawEPS;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG;
+import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
+import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
+import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM;
+import org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline;
+import org.apache.xmlgraphics.image.loader.util.ImageUtil;
+import org.apache.xmlgraphics.ps.DSCConstants;
+import org.apache.xmlgraphics.ps.ImageEncoder;
+import org.apache.xmlgraphics.ps.PSDictionary;
+import org.apache.xmlgraphics.ps.PSDictionaryFormatException;
+import org.apache.xmlgraphics.ps.PSGenerator;
+import org.apache.xmlgraphics.ps.PSImageUtils;
+import org.apache.xmlgraphics.ps.PSPageDeviceDictionary;
+import org.apache.xmlgraphics.ps.PSProcSets;
+import org.apache.xmlgraphics.ps.PSResource;
+import org.apache.xmlgraphics.ps.PSState;
+import org.apache.xmlgraphics.ps.dsc.DSCException;
+import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBoundingBox;
+import org.apache.xmlgraphics.ps.dsc.events.DSCCommentHiResBoundingBox;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.area.Area;
@@ -77,34 +107,6 @@
import org.apache.fop.render.ps.extensions.PSSetupCode;
import org.apache.fop.util.CharUtilities;
import org.apache.fop.util.ColorUtil;
-import org.apache.xmlgraphics.image.loader.ImageException;
-import org.apache.xmlgraphics.image.loader.ImageFlavor;
-import org.apache.xmlgraphics.image.loader.ImageInfo;
-import org.apache.xmlgraphics.image.loader.ImageManager;
-import org.apache.xmlgraphics.image.loader.ImageSessionContext;
-import org.apache.xmlgraphics.image.loader.impl.ImageGraphics2D;
-import org.apache.xmlgraphics.image.loader.impl.ImageRawCCITTFax;
-import org.apache.xmlgraphics.image.loader.impl.ImageRawEPS;
-import org.apache.xmlgraphics.image.loader.impl.ImageRawJPEG;
-import org.apache.xmlgraphics.image.loader.impl.ImageRawStream;
-import org.apache.xmlgraphics.image.loader.impl.ImageRendered;
-import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM;
-import org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline;
-import org.apache.xmlgraphics.image.loader.util.ImageUtil;
-import org.apache.xmlgraphics.ps.DSCConstants;
-import org.apache.xmlgraphics.ps.ImageEncoder;
-import org.apache.xmlgraphics.ps.PSDictionary;
-import org.apache.xmlgraphics.ps.PSDictionaryFormatException;
-import org.apache.xmlgraphics.ps.PSGenerator;
-import org.apache.xmlgraphics.ps.PSImageUtils;
-import org.apache.xmlgraphics.ps.PSPageDeviceDictionary;
-import org.apache.xmlgraphics.ps.PSProcSets;
-import org.apache.xmlgraphics.ps.PSResource;
-import org.apache.xmlgraphics.ps.PSState;
-import org.apache.xmlgraphics.ps.dsc.DSCException;
-import org.apache.xmlgraphics.ps.dsc.ResourceTracker;
-import org.apache.xmlgraphics.ps.dsc.events.DSCCommentBoundingBox;
-import org.apache.xmlgraphics.ps.dsc.events.DSCCommentHiResBoundingBox;
/**
* Renderer that renders to PostScript.
@@ -1610,7 +1612,7 @@
* [EMAIL PROTECTED]
*/
public void renderImage(Image image, Rectangle2D pos) {
- drawImage(image.getURL(), pos);
+ drawImage(image.getURL(), pos, image.getForeignAttributes());
}
/**
Modified:
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSSVGHandler.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSSVGHandler.java?rev=706282&r1=706281&r2=706282&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSSVGHandler.java
(original)
+++
xmlgraphics/fop/branches/Temp_AFPGOCAResources/src/java/org/apache/fop/render/ps/PSSVGHandler.java
Mon Oct 20 06:42:28 2008
@@ -22,6 +22,7 @@
// Java
import java.awt.geom.AffineTransform;
import java.io.IOException;
+import java.util.Map;
import org.w3c.dom.Document;
@@ -39,6 +40,7 @@
import org.apache.fop.render.AbstractGenericSVGHandler;
import org.apache.fop.render.Renderer;
import org.apache.fop.render.RendererContext;
+import org.apache.fop.render.RendererContextConstants;
import org.apache.fop.svg.SVGEventProducer;
import org.apache.fop.svg.SVGUserAgent;
@@ -226,6 +228,23 @@
int yOffset = psInfo.currentYPosition;
PSGenerator gen = psInfo.psGenerator;
+ boolean paintAsBitmap = false;
+ if (context != null) {
+ Map foreign =
(Map)context.getProperty(RendererContextConstants.FOREIGN_ATTRIBUTES);
+ paintAsBitmap = (foreign != null
+ &&
"bitmap".equalsIgnoreCase((String)foreign.get(CONVERSION_MODE)));
+ }
+ if (paintAsBitmap) {
+ try {
+ super.renderSVGDocument(context, doc);
+ } catch (IOException ioe) {
+ SVGEventProducer eventProducer = SVGEventProducer.Provider.get(
+ context.getUserAgent().getEventBroadcaster());
+ eventProducer.svgRenderingError(this, ioe,
getDocumentURI(doc));
+ }
+ return;
+ }
+
//Controls whether text painted by Batik is generated using text or
path operations
boolean strokeText = false;
Configuration cfg = psInfo.getHandlerConfiguration();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]