]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Applied Thomas DeWeese's (Batik team) patches to the transcoder code.
authorGlen Mazza <gmazza@apache.org>
Sat, 13 Sep 2003 14:23:40 +0000 (14:23 +0000)
committerGlen Mazza <gmazza@apache.org>
Sat, 13 Sep 2003 14:23:40 +0000 (14:23 +0000)
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

src/java/org/apache/fop/render/ps/PSTextPainter.java
src/java/org/apache/fop/svg/PDFGraphics2D.java
src/java/org/apache/fop/svg/PDFTextPainter.java

index 855be1ddcfca0537509398dc1187d42282f987f7..ca12f70edb558fe97856012d265f79fc3b994d8f 100644 (file)
@@ -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) {
index d3f48f1feac3b5f28974fded8d101ac939969a9a..dc4523d17e00663a9904321e676488d86f8df96e 100644 (file)
@@ -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");
index 135d8740e1b22dcdc436294358583aa98507cf5c..6dd83e35fcbf485d0e0f405f0490a7394f9302bd 100644 (file)
@@ -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) {