From: Glen Mazza Date: Sat, 13 Sep 2003 14:23:40 +0000 (+0000) Subject: Applied Thomas DeWeese's (Batik team) patches to the transcoder code. X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1104 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2febf79f726b7956d570d7ae0a0899833b49d795;p=xmlgraphics-fop.git Applied Thomas DeWeese's (Batik team) patches to the transcoder code. patch info: http://marc.theaimsgroup.com/?l=fop-dev&m=106318855328310&w=2 git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196902 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/render/ps/PSTextPainter.java b/src/java/org/apache/fop/render/ps/PSTextPainter.java index 855be1ddc..ca12f70ed 100644 --- a/src/java/org/apache/fop/render/ps/PSTextPainter.java +++ b/src/java/org/apache/fop/render/ps/PSTextPainter.java @@ -146,7 +146,7 @@ public class PSTextPainter implements TextPainter { List gvtFonts; gvtFonts = (List) aci.getAttribute( GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES); - Paint forg = (Paint) aci.getAttribute(TextAttribute.FOREGROUND); + Paint forg = tpi.fillPaint; Paint strokePaint = tpi.strokePaint; Float size = (Float) aci.getAttribute(TextAttribute.SIZE); if (size == null) { diff --git a/src/java/org/apache/fop/svg/PDFGraphics2D.java b/src/java/org/apache/fop/svg/PDFGraphics2D.java index d3f48f1fe..dc4523d17 100644 --- a/src/java/org/apache/fop/svg/PDFGraphics2D.java +++ b/src/java/org/apache/fop/svg/PDFGraphics2D.java @@ -471,6 +471,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { g.setPaint(new Color(1, 1, 1, 0)); g.fillRect(0, 0, width * scaleFactor, height * scaleFactor); g.clip(new Rectangle(0, 0, buf.getWidth(), buf.getHeight())); + g.setComposite(gc.getComposite()); if (!g.drawImage(img, 0, 0, buf.getWidth(), buf.getHeight(), observer)) { return false; @@ -500,29 +501,10 @@ public class PDFGraphics2D extends AbstractGraphics2D { mask[maskpos++] = (byte)(alpha & 0xFF); if (alpha != 255) { hasMask = true; - /* - if (alpha != 0) { - binaryMask = false; - }*/ - - // System.out.println("Alpha: " + alpha); - // Composite with opaque white... - add = (255 - alpha); - mult = (alpha << 16) / 255; - result[count++] = - (byte)(add - + ((((val >> 16) & 0xFF) * mult) >> 16)); - result[count++] = - (byte)(add - + ((((val >> 8) & 0xFF) * mult) >> 16)); - result[count++] = (byte)(add - + ((((val) & 0xFF) * mult) - >> 16)); - } else { - result[count++] = (byte)((val >> 16) & 0xFF); - result[count++] = (byte)((val >> 8) & 0xFF); - result[count++] = (byte)((val) & 0xFF); } + result[count++] = (byte)((val >> 16) & 0xFF); + result[count++] = (byte)((val >> 8) & 0xFF); + result[count++] = (byte)((val) & 0xFF); } } break; @@ -641,12 +623,6 @@ public class PDFGraphics2D extends AbstractGraphics2D { */ public void draw(Shape s) { // System.out.println("draw(Shape)"); - Color c; - c = getColor(); - if (c.getAlpha() == 0) { - return; - } - AffineTransform trans = getTransform(); double[] tranvals = new double[6]; trans.getMatrix(tranvals); @@ -672,6 +648,11 @@ public class PDFGraphics2D extends AbstractGraphics2D { } } + Color c; + c = getColor(); + if (c.getAlpha() == 0) { + return; + } if (c.getAlpha() != 255) { Map vals = new java.util.HashMap(); vals.put(PDFGState.GSTATE_ALPHA_STROKE, new Float(c.getAlpha() / 255f)); @@ -1237,6 +1218,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { writeClip(imclip); Color c = getColor(); applyColor(c, true); + applyPaint(getPaint(), true); int salpha = c.getAlpha(); if (salpha != 255) { @@ -1374,6 +1356,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { writeClip(imclip); Color c = getColor(); applyColor(c, true); + applyPaint(getPaint(), true); boolean fill = true; boolean stroke = false; @@ -1382,6 +1365,7 @@ public class PDFGraphics2D extends AbstractGraphics2D { stroke = true; applyStroke(currentStroke); applyColor(c, false); + applyPaint(getPaint(), false); } currentStream.write("BT\n"); diff --git a/src/java/org/apache/fop/svg/PDFTextPainter.java b/src/java/org/apache/fop/svg/PDFTextPainter.java index 135d8740e..6dd83e35f 100644 --- a/src/java/org/apache/fop/svg/PDFTextPainter.java +++ b/src/java/org/apache/fop/svg/PDFTextPainter.java @@ -138,7 +138,6 @@ public class PDFTextPainter implements TextPainter { gvtFonts = (List) aci.getAttribute( GVTAttributedCharacterIterator.TextAttribute.GVT_FONT_FAMILIES); - Paint forg = (Paint) aci.getAttribute(TextAttribute.FOREGROUND); TextPaintInfo tpi = (TextPaintInfo) aci.getAttribute( GVTAttributedCharacterIterator.TextAttribute.PAINT_INFO); @@ -146,6 +145,7 @@ public class PDFTextPainter implements TextPainter { return; } + Paint forg = tpi.fillPaint; Paint strokePaint = tpi.strokePaint; Float size = (Float) aci.getAttribute(TextAttribute.SIZE); if (size == null) {