From 956c6ac30199e427442ccd7ac829cb2d78cce856 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 4 May 2006 07:24:18 +0000 Subject: [PATCH] fox:disable-clipping on the i-f-o or e-g can be used to perform more painting operations natively in the HP GL/2 space. Since HP GL/2 provides only limited clipping functionality (which is not supported, yet) and the PCLGraphics2D fails with an UnsupportedException if it encounters an unsupported painting operation, every SVG graphic ends up being painted as a bitmap. This setting can help avoid that. Of course, I have yet to implement the IW (InputWindow, used for rectangular clipping) command. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@399582 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/render/pcl/PCLGraphics2D.java | 8 ++++++++ .../apache/fop/render/pcl/PCLGraphics2DAdapter.java | 1 + .../apache/fop/render/pcl/PCLRendererContext.java | 13 +++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/sandbox/org/apache/fop/render/pcl/PCLGraphics2D.java b/src/sandbox/org/apache/fop/render/pcl/PCLGraphics2D.java index fe2d6a12a..674b63941 100644 --- a/src/sandbox/org/apache/fop/render/pcl/PCLGraphics2D.java +++ b/src/sandbox/org/apache/fop/render/pcl/PCLGraphics2D.java @@ -94,6 +94,14 @@ public class PCLGraphics2D extends AbstractGraphics2D { this.gc = c; } + /** + * Allows to disable all clipping operations. + * @param value true if clipping should be disabled. + */ + public void setClippingDisabled(boolean value) { + this.clippingDisabled = value; + } + /** * Central handler for IOExceptions for this class. * @param ioe IOException to handle diff --git a/src/sandbox/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java b/src/sandbox/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java index 665eb6d6c..df9fb8589 100644 --- a/src/sandbox/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java +++ b/src/sandbox/org/apache/fop/render/pcl/PCLGraphics2DAdapter.java @@ -74,6 +74,7 @@ public class PCLGraphics2DAdapter extends AbstractGraphics2DAdapter { PCLGraphics2D graphics = new PCLGraphics2D(tempGen); graphics.setGraphicContext(ctx); + graphics.setClippingDisabled(pclContext.isClippingDisabled()); Rectangle2D area = new Rectangle2D.Double(0.0, 0.0, imw, imh); painter.paint(graphics, area); diff --git a/src/sandbox/org/apache/fop/render/pcl/PCLRendererContext.java b/src/sandbox/org/apache/fop/render/pcl/PCLRendererContext.java index 2f77dd4aa..462abfa48 100644 --- a/src/sandbox/org/apache/fop/render/pcl/PCLRendererContext.java +++ b/src/sandbox/org/apache/fop/render/pcl/PCLRendererContext.java @@ -18,9 +18,6 @@ package org.apache.fop.render.pcl; -import java.util.Map; - -import org.apache.avalon.framework.configuration.Configuration; import org.apache.fop.fo.extensions.ExtensionElementMapping; import org.apache.fop.render.RendererContext; import org.apache.fop.util.QName; @@ -54,7 +51,15 @@ public class PCLRendererContext extends RendererContext.RendererContextWrapper { public boolean paintAsBitmap() { QName qName = new QName(ExtensionElementMapping.URI, null, "conversion-mode"); return getForeignAttributes() != null - && "bitmap".equals(getForeignAttributes().get(qName)); + && "bitmap".equalsIgnoreCase((String)getForeignAttributes().get(qName)); } + + /** @return true if clipping is disabled inside the PCLGraphics2D. */ + public boolean isClippingDisabled() { + QName qName = new QName(ExtensionElementMapping.URI, null, "disable-clipping"); + return getForeignAttributes() != null + && "true".equalsIgnoreCase((String)getForeignAttributes().get(qName)); + } + } \ No newline at end of file -- 2.39.5