Hi Glen,

Thanks for doing this.

   I just updated my FOP and ran some FO/SVG through it.
You seem to have gotten most of it, but I noticed that
you didn't use TextPainterInfo.fillPaint - instead you
continued to use the value of the FOREGROUND attribute.
You may not have noticed this becuase I was unable to
'remove' the FOREGROUND ACI attribute as I was for the
others (it comes from the JDK).  I've attached a tiny
patch that fixes this for the PDFTextPainter.

   I also have attached a patch for PDFGraphics2D.
The patch has two parts - the first is the more important
of the two.

   The first block is for drawing images and
does two things - first it installs the composite from
the PDFGraphics when drawing the image to it's offscreen
buffer - this ensures that 'group opacity' is properly
propagated.  Second it removes the 'composite with white'
this was important before FOP handled masks but since it
does that now I would remove it, it makes a quite visible
difference in a lot of places.

   The second part of the patch is probably not that
important (but was part of my tracking down the FOREGROUND
bug).  It seems that in general PDFGraphics2D is a little
shaky in how it treats color vs paint.  This patch just
tries to make sure that everywhere it sets color it also
sets paint.  This part probably needs more work but might
warrent an entry in Bugzilla or something.

Glen Mazza wrote:
--- Thomas DeWeese <[EMAIL PROTECTED]> wrote:

1.) We do not have plans anytime soon for making a

new


release of maintenance--so, if I made the change,

the


new pdftranscoder.jar could be based only on a

nightly


build--is that OK with you?

I think that would be fine.




Changes have been made on maintenance (0.20.5) and
development (1.0) version.  I also updated the Batik
library to that of a nightly build.

I stand corrected--pdf transcoder.jar is actually
using our development (1.0) version--which is very
good news--you can checkout xml-fop and just run Ant
(default target) to get the pdftranscoder.jar.

We've had some moving around in the files recently--if
there's a problem with the pdftranscoder.jar, let us
know--we may need to update the build process in case
certain files have been left out.


How do I obtain a single batik.jar for me to compile

According to an email from Keiron in the fop-dev archives, FOP relies on the "all-jar" target in your build.xml. I just sent you a patch (in Bugzilla) to update the build.xml helptext to include a description of that target. (Saves confusion down the road...)

Great that is a good idea.
Index: src/java/org/apache/fop/svg/PDFTextPainter.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/svg/PDFTextPainter.java,v
retrieving revision 1.7
diff -w -u -r1.7 PDFTextPainter.java
--- src/java/org/apache/fop/svg/PDFTextPainter.java     9 Sep 2003 19:44:22 -0000      
 1.7
+++ src/java/org/apache/fop/svg/PDFTextPainter.java     10 Sep 2003 09:54:26 -0000
@@ -138,7 +138,6 @@
         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 @@
             return;
         }        
         
+        Paint forg = tpi.fillPaint;
         Paint strokePaint = tpi.strokePaint;
         Float size = (Float) aci.getAttribute(TextAttribute.SIZE);
         if (size == null) {
Index: src/java/org/apache/fop/svg/PDFGraphics2D.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/svg/PDFGraphics2D.java,v
retrieving revision 1.10
diff -w -u -r1.10 PDFGraphics2D.java
--- src/java/org/apache/fop/svg/PDFGraphics2D.java      20 Aug 2003 18:09:46 -0000     
 1.10
+++ src/java/org/apache/fop/svg/PDFGraphics2D.java      10 Sep 2003 09:56:47 -0000
@@ -471,6 +471,7 @@
             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;
@@ -498,33 +499,13 @@
                         val = iarray[j];
                         alpha = val >>> 24;
                         mask[maskpos++] = (byte)(alpha & 0xFF);
-                        if (alpha != 255) {
+                        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);
                         }
                     }
-                }
                 break;
                 default:
                 // error
@@ -641,12 +622,6 @@
      */
     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 +647,11 @@
             }
         }
 
+        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 +1217,7 @@
         writeClip(imclip);
         Color c = getColor();
         applyColor(c, true);
+        applyPaint(getPaint(), true);
         int salpha = c.getAlpha();
 
         if (salpha != 255) {
@@ -1374,6 +1355,7 @@
         writeClip(imclip);
         Color c = getColor();
         applyColor(c, true);
+        applyPaint(getPaint(), true);
 
         boolean fill = true;
         boolean stroke = false;
@@ -1382,6 +1364,7 @@
             stroke = true;
             applyStroke(currentStroke);
             applyColor(c, false);
+            applyPaint(getPaint(), false);
         }
 
         currentStream.write("BT\n");

Reply via email to