aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/render/pcl/PCLPainter.java
diff options
context:
space:
mode:
authorJeremias Maerki <jeremias@apache.org>2008-11-04 15:10:31 +0000
committerJeremias Maerki <jeremias@apache.org>2008-11-04 15:10:31 +0000
commitdfeb96c655c3e361b5fdf6f0cecbf46adab01a72 (patch)
tree27998c349075184f8f0d20a23602fa2732aee171 /src/java/org/apache/fop/render/pcl/PCLPainter.java
parenta4847a2df3717f54d54e3c914826e3ce0bb2dd28 (diff)
downloadxmlgraphics-fop-dfeb96c655c3e361b5fdf6f0cecbf46adab01a72.tar.gz
xmlgraphics-fop-dfeb96c655c3e361b5fdf6f0cecbf46adab01a72.zip
Making conversion hints available to ImageHandler implementations, too.
(Re-)implemented Graphics2D support for PCL. It can be disabled by fox:conversion-mode="bitmap" if necessary. Fixed a bug with non-uniform image scaling when encoding bitmap images. Commented some code that did not reliably convert color images to grayscale. The (probably slower) fallback code is used instead. Some performance improvements for text painting using bitmaps when <rendering>speed<rendering> is selected. Removed the RenderingContext interface from RendererContext since it's not used. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign@711269 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/render/pcl/PCLPainter.java')
-rw-r--r--src/java/org/apache/fop/render/pcl/PCLPainter.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/render/pcl/PCLPainter.java b/src/java/org/apache/fop/render/pcl/PCLPainter.java
index 7ad6ea931..b709c28f3 100644
--- a/src/java/org/apache/fop/render/pcl/PCLPainter.java
+++ b/src/java/org/apache/fop/render/pcl/PCLPainter.java
@@ -110,6 +110,10 @@ public class PCLPainter extends AbstractIFPainter implements PCLConstants {
}
}
+ private boolean isSpeedOptimized() {
+ return getPCLUtil().getRenderingMode() == PCLRenderingMode.SPEED;
+ }
+
//----------------------------------------------------------------------------------------------
/** {@inheritDoc} */
@@ -161,6 +165,10 @@ public class PCLPainter extends AbstractIFPainter implements PCLConstants {
return PCLPainter.this.transformedPoint(x, y);
}
+ public GraphicContext getGraphicContext() {
+ return PCLPainter.this.graphicContext;
+ }
+
};
return pdfContext;
}
@@ -203,7 +211,7 @@ public class PCLPainter extends AbstractIFPainter implements PCLConstants {
public void drawBorderRect(final Rectangle rect,
final BorderProps before, final BorderProps after,
final BorderProps start, final BorderProps end) throws IFException {
- if (getPCLUtil().getRenderingMode() == PCLRenderingMode.SPEED) {
+ if (isSpeedOptimized()) {
super.drawBorderRect(rect, before, after, start, end);
return;
}
@@ -239,7 +247,7 @@ public class PCLPainter extends AbstractIFPainter implements PCLConstants {
public void drawLine(final Point start, final Point end,
final int width, final Color color, final RuleStyle style)
throws IFException {
- if (getPCLUtil().getRenderingMode() == PCLRenderingMode.SPEED) {
+ if (isSpeedOptimized()) {
super.drawLine(start, end, width, color, style);
return;
}
@@ -278,8 +286,16 @@ public class PCLPainter extends AbstractIFPainter implements PCLConstants {
ImageGraphics2D img = new ImageGraphics2D(info, painter);
Map hints = new java.util.HashMap();
- hints.put(ImageProcessingHints.BITMAP_TYPE_INTENT,
- ImageProcessingHints.BITMAP_TYPE_INTENT_GRAY);
+ if (isSpeedOptimized()) {
+ //Gray text may not be painted in this case! We don't get dithering in Sun JREs.
+ //But this approach is about twice as fast as the grayscale image.
+ hints.put(ImageProcessingHints.BITMAP_TYPE_INTENT,
+ ImageProcessingHints.BITMAP_TYPE_INTENT_MONO);
+ } else {
+ hints.put(ImageProcessingHints.BITMAP_TYPE_INTENT,
+ ImageProcessingHints.BITMAP_TYPE_INTENT_GRAY);
+ }
+ hints.put(PCLConstants.CONV_MODE, "bitmap");
PCLRenderingContext context = (PCLRenderingContext)createRenderingContext();
context.setSourceTransparencyEnabled(true);
try {