[prev in list] [next in list] [prev in thread] [next in thread] 

List:       batik-dev
Subject:    cvs commit: xml-batik/sources/org/apache/batik/swing/svg JSVGComponent.java
From:       deweese () apache ! org
Date:       2004-08-20 19:29:48
Message-ID: 20040820192948.72258.qmail () minotaur ! apache ! org
[Download RAW message or body]

deweese     2004/08/20 12:29:48

  Modified:    lib      pdf-transcoder.jar
               resources/org/apache/batik/dom/resources Messages.properties
               sources/org/apache/batik/bridge BridgeContext.java
                        CSSUtilities.java CursorManager.java
                        SVGClipPathElementBridge.java
                        SVGGElementBridge.java SVGImageElementBridge.java
                        SVGSVGElementBridge.java SVGShapeElementBridge.java
                        SVGTextElementBridge.java SVGUseElementBridge.java
                        UpdateManager.java UpdateManagerEvent.java
               sources/org/apache/batik/css/engine CSSEngine.java
                        StyleMap.java
               sources/org/apache/batik/css/engine/value/css2
                        FontSizeManager.java
               sources/org/apache/batik/dom AbstractParentNode.java
               sources/org/apache/batik/ext/awt RenderingHintsKeyExt.java
               sources/org/apache/batik/ext/awt/image/renderable
                        ClipRable.java ClipRable8Bit.java
               sources/org/apache/batik/gvt AbstractGraphicsNode.java
               sources/org/apache/batik/swing/svg JSVGComponent.java
  Added:       samples/tests/spec/masking clipQuality.svg
  Log:
  1) Fixed Bug 28785 - 'a' element not clickable with namespace prefix.
     Thanks Richard
  2) Bug 29110 - Anti-aliased clips (hqClip patch).  This can be
                 disabled by setting the transcoding hint to
                 vector or print (so content doesn't get rasterized).
  3) Bug 30584 - Concurrent Modification believed fixed (couldn't get
                 test case to fail after fix).
  4) Bug 29891 - Rasterizer problem if w/h == viewBox w/h
  5) DOM will now detect when the child passed to insert/remove
     node is not the child of the node insert/remove is called on.
  6) No more 'flicker' when panning a dynamic document.
     Not 100% happy with solution (it looks like a bit of a hack).
  PR: 29110, 30584, 29891
  
  Revision  Changes    Path
  1.5       +2400 -1567xml-batik/lib/pdf-transcoder.jar
  
  	<<Binary file>>
  
  
  1.5       +5 -1      xml-batik/resources/org/apache/batik/dom/resources/Messages.properties
  
  Index: Messages.properties
  ===================================================================
  RCS file: /home/cvs/xml-batik/resources/org/apache/batik/dom/resources/Messages.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Messages.properties	8 Aug 2003 11:39:28 -0000	1.4
  +++ Messages.properties	20 Aug 2004 19:29:46 -0000	1.5
  @@ -101,7 +101,7 @@
   The namespace URI "{2}" is invalid. Current node type: {0}, name: {1}.
   
   need.parent = \
  -A text node needs a parent in order to be splitted.
  +A text node needs a parent node in order to be split.
   
   negative.count = \
   The given count ({0}) is negative.
  @@ -121,6 +121,10 @@
   
   offset = \
   The given offset ({0}) is out of range.
  +
  +parent.child.mismatch = \
  +The node (type: {0}, name: {1}) must be a child of the 'parent' node 
  +(type: {2}, name: {3}) but it is not.
   
   parent.not.allowed = \
   The current node (type: {0}, name: {1}) cannot have parent.
  
  
  
  1.1                  xml-batik/samples/tests/spec/masking/clipQuality.svg
  
  Index: clipQuality.svg
  ===================================================================
  <?xml version="1.0" standalone="no"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN"
  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
  
  <!--
  
     Copyright 2004  The Apache Software Foundation 
  
     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at
  
         http://www.apache.org/licenses/LICENSE-2.0
  
     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
  
  -->
  
  <!-- ====================================================================== -->
  <!-- Test clip property with 'shape-rendering' set to 'geometricPrecision'  -->
  <!--                                                                        -->
  <!-- @author tkormann@apache.org                                            -->
  <!-- @author deweese@apache.org                                             -->
  <!-- @version $Id: clipQuality.svg,v 1.1 2004/08/20 19:29:46 deweese Exp $  -->
  <!-- ====================================================================== -->
  
  <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
  
  <svg id="body" width="450" height="500" viewBox="0 0 450 500"
       xmlns="http://www.w3.org/2000/svg" 
       xmlns:xlink="http://www.w3.org/1999/xlink">
  
      <title>Clip Test (geometricPrecision)</title>
  
      <!-- ============================================================= -->
      <!-- Test content                                                  -->
      <!-- ============================================================= -->
      <g id="testContent">
  
      <text x="225" y="40" class="title"
       >Clip Test (geometricPrecision)</text>
  
      <defs shape-rendering="geometricPrecision">
          <!-- ============================================== -->
          <!-- clipPathUnits : default (userSpaceOnUse)       -->
          <!-- ============================================== -->
          <clipPath id="clip_1_1">
              <circle cx="36"  cy="60" r="36"/>
              <circle cx="84"  cy="60" r="36"/>
          </clipPath>
          <!-- ============================================== -->
          <!-- clipPathUnits : objectBoundingBox              -->
          <!-- ============================================== -->
          <clipPath id="clip_1_2" clipPathUnits="objectBoundingBox">
              <circle cx=".3" cy=".5" r=".3"/>
              <circle cx=".7" cy=".5" r=".3"/>
          </clipPath>
          <!-- ============================================== -->
          <!-- clipPathUnits : userSpaceOnUse                 -->
          <!-- ============================================== -->
          <clipPath id="clip_1_3" clipPathUnits="userSpaceOnUse">
              <circle cx="36"  cy="60" r="36"/>
              <circle cx="84"  cy="60" r="36"/>
          </clipPath>
  
          <clipPath id="clip00" clipPathUnits="objectBoundingBox">
              <circle cx=".5" cy=".5" r=".16"/>
          </clipPath>
  
          <clipPath id="clip0" clipPathUnits="objectBoundingBox">
              <circle cx=".5" cy=".5" r=".16" style="clip-path:url(#clip00)"/>
          </clipPath>
  
          <clipPath id="clip" clipPathUnits="objectBoundingBox" 
                    style="clip-path:url(#clip0)">
              <circle cx=".5" cy=".5" r=".16"/>
          </clipPath>
  
          <!-- ============================================== -->
          <!-- clipPathUnits : default (userSpaceOnUse)       -->
          <!-- clip-path on the clipPath element              -->
          <!-- ============================================== -->
          <clipPath id="clip_2_1" style="clip-path:url(#clip)">
              <circle cx="36"  cy="60" r="36"/>
              <circle cx="84"  cy="60" r="36"/>
          </clipPath>
          <!-- ============================================== -->
          <!-- clipPathUnits : objectBoundingBox              -->
          <!-- clip-path on the clipPath element              -->
          <!-- ============================================== -->
          <clipPath id="clip_2_2" clipPathUnits="objectBoundingBox" 
                    style="clip-path:url(#clip)">
              <circle cx=".3" cy=".5" r=".3"/>
              <circle cx=".7" cy=".5" r=".3"/>
          </clipPath>
          <!-- ============================================== -->
          <!-- clipPathUnits : userSpaceOnUse                 -->
          <!-- clip-path on the clipPath element              -->
          <!-- ============================================== -->
          <clipPath id="clip_2_3" clipPathUnits="userSpaceOnUse" 
                    style="clip-path:url(#clip)">
              <circle cx="36"  cy="60" r="36"/>
              <circle cx="84"  cy="60" r="36"/>
          </clipPath>
  
          <!-- ============================================== -->
          <!-- clipPathUnits : default (userSpaceOnUse)       -->
          <!-- clip-path on the clipPath children elements    -->
          <!-- ============================================== -->
          <clipPath id="clip_3_1">
              <circle cx="36"  cy="60" r="36" style="clip-path:url(#clip)"/>
              <circle cx="84"  cy="60" r="36" style="clip-path:url(#clip)"/>
          </clipPath>
          <!-- ============================================== -->
          <!-- clipPathUnits : objectBoundingBox              -->
          <!-- clip-path on the clipPath children elements    -->
          <!-- ============================================== -->
          <clipPath id="clip_3_2" clipPathUnits="objectBoundingBox">
              <circle cx=".3" cy=".5" r=".3" style="clip-path:url(#clip)"/>
              <circle cx=".7" cy=".5" r=".3" style="clip-path:url(#clip)"/>
          </clipPath>
          <!-- ============================================== -->
          <!-- clipPathUnits : userSpaceOnUse                 -->
          <!-- clip-path on the clipPath children elements    -->
          <!-- ============================================== -->
          <clipPath id="clip_3_3" clipPathUnits="userSpaceOnUse">
              <circle cx="36"  cy="60" r="36" style="clip-path:url(#clip)"/>
              <circle cx="84"  cy="60" r="36" style="clip-path:url(#clip)"/>
          </clipPath>
  
      </defs>
  
      <!-- ============================================== -->
      <!-- clip_1_*                                       -->
      <!-- ============================================== -->
      <g transform="translate(0 40)" class="legend">
      <g id="c1" transform="translate(20 20)">
          <rect x="0" y="0" width="120" height="120" style="fill:FireBrick;"/>
          <rect x="0" y="0" width="120" height="120" 
                style="fill:PaleVioletRed; clip-path:url(#clip_1_1)"/>
          <g transform="translate(60, 130)">
              <text x="0" y="0" style="text-anchor:middle">clip_1_1</text>
          </g>
      </g>
  
      <g id="c2" transform="translate(20 160)">
          <rect x="0" y="0" width="120" height="120" style="fill:FireBrick;"/>
          <rect x="0" y="0" width="120" height="120" 
                style="fill:PaleVioletRed; clip-path:url(#clip_1_2)"/>
          <g transform="translate(60, 130)">
              <text x="0" y="0" style="text-anchor:middle">clip_1_2</text>
          </g>
      </g>
  
      <g id="c3" transform="translate(20 300)">
          <rect x="0" y="0" width="120" height="120" style="fill:FireBrick;"/>
          <rect x="0" y="0" width="120" height="120" 
                style="fill:PaleVioletRed; clip-path:url(#clip_1_3)"/>
          <g transform="translate(60, 130)">
              <text x="0" y="0" style="text-anchor:middle">clip_1_2</text>
          </g>
      </g>
  
      <!-- ============================================== -->
      <!-- clip_2_*                                       -->
      <!-- ============================================== -->
  
      <g id="c4" transform="translate(160 20)">
          <rect x="0" y="0" width="120" height="120" style="fill:FireBrick;"/>
          <rect x="0" y="0" width="120" height="120" 
                style="fill:PaleVioletRed; clip-path:url(#clip_2_1)"/>
          <g transform="translate(60, 130)">
              <text x="0" y="0" style="text-anchor:middle">clip_2_1</text>
          </g>
      </g>
  
      <g id="c5" transform="translate(160 160)">
          <rect x="0" y="0" width="120" height="120" style="fill:FireBrick;"/>
          <rect x="0" y="0" width="120" height="120" 
                style="fill:PaleVioletRed; clip-path:url(#clip_2_2)"/>
          <g transform="translate(60, 130)">
              <text x="0" y="0" style="text-anchor:middle">clip_2_2</text>
          </g>
      </g>
  
      <g id="c6" transform="translate(160 300)">
          <rect x="0" y="0" width="120" height="120" style="fill:FireBrick;"/>
          <rect x="0" y="0" width="120" height="120" 
                style="fill:PaleVioletRed; clip-path:url(#clip_2_3)"/>
          <g transform="translate(60, 130)">
              <text x="0" y="0" style="text-anchor:middle">clip_2_3</text>
          </g>
      </g>
  
      <!-- ============================================== -->
      <!-- clip_3_*                                       -->
      <!-- ============================================== -->
  
      <g id="c7" transform="translate(300 20)">
          <rect x="0" y="0" width="120" height="120" style="fill:FireBrick;"/>
          <rect x="0" y="0" width="120" height="120" 
                style="fill:PaleVioletRed; clip-path:url(#clip_3_1)"/>
          <g transform="translate(60, 130)">
              <text x="0" y="0" style="text-anchor:middle">clip_3_1</text>
          </g>
      </g>
  
      <g id="c8" transform="translate(300 160)">
          <rect x="0" y="0" width="120" height="120" style="fill:FireBrick;"/>
          <rect x="0" y="0" width="120" height="120" 
                style="fill:PaleVioletRed; clip-path:url(#clip_3_2)"/>
          <g transform="translate(60, 130)">
              <text x="0" y="0" style="text-anchor:middle">clip_3_2</text>
          </g>
      </g>
  
      <g id="c9" transform="translate(300 300)">
          <rect x="0" y="0" width="120" height="120" style="fill:FireBrick;"/>
          <rect x="0" y="0" width="120" height="120" 
                style="fill:PaleVioletRed; clip-path:url(#clip_3_3)"/>
          <g transform="translate(60, 130)">
              <text x="0" y="0" style="text-anchor:middle">clip_3_2</text>
          </g>
      </g>
      </g>
  
      </g>
  
      <!-- ============================================================= -->
      <!-- Batik sample mark                                             -->
      <!-- ============================================================= -->
      <use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" />
      
  </svg>
  
  
  
  1.78      +2 -2      xml-batik/sources/org/apache/batik/bridge/BridgeContext.java
  
  Index: BridgeContext.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/BridgeContext.java,v
  retrieving revision 1.77
  retrieving revision 1.78
  diff -u -r1.77 -r1.78
  --- BridgeContext.java	18 Aug 2004 07:12:30 -0000	1.77
  +++ BridgeContext.java	20 Aug 2004 19:29:46 -0000	1.78
  @@ -1479,7 +1479,7 @@
        */
       public static boolean checkInteractiveElement(SVGDocument doc,
                                                     Element e) {
  -        String tag = e.getNodeName();
  +        String tag = e.getLocalName();
           
           // Check if it's one of our important element.
           if (SVGConstants.SVG_A_TAG.equals(tag))
  
  
  
  1.51      +26 -18    xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java
  
  Index: CSSUtilities.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/CSSUtilities.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- CSSUtilities.java	18 Aug 2004 07:12:31 -0000	1.50
  +++ CSSUtilities.java	20 Aug 2004 19:29:46 -0000	1.51
  @@ -297,14 +297,16 @@
        */
       public static RenderingHints convertShapeRendering(Element e,
                                                          RenderingHints hints) {
  -        Value v = getComputedStyle(e, SVGCSSEngine.SHAPE_RENDERING_INDEX);
  +        Value  v = getComputedStyle(e, SVGCSSEngine.SHAPE_RENDERING_INDEX);
           String s = v.getStringValue();
  -        if (s.charAt(0) == 'a') { // auto
  +        int    len = s.length();
  +        if ((len == 4) && (s.charAt(0) == 'a')) // auto
               return hints;
  -        }
  -        if (hints == null) {
  +        if (len < 10) return hints;  // Unknown.
  +
  +        if (hints == null)
               hints = new RenderingHints(null);
  -        }
  +        
           switch(s.charAt(0)) {
           case 'o': // optimizeSpeed
               hints.put(RenderingHints.KEY_RENDERING,
  @@ -381,12 +383,14 @@
                                                         RenderingHints hints) {
           Value v = getComputedStyle(e, SVGCSSEngine.TEXT_RENDERING_INDEX);
           String s = v.getStringValue();
  -        if (s.charAt(0) == 'a') { // auto
  +        int    len = s.length();
  +        if ((len == 4) && (s.charAt(0) == 'a')) // auto
               return hints;
  -        }
  -        if (hints == null) {
  +        if (len < 13) return hints;  // Unknown.
  +
  +        if (hints == null)
               hints = new RenderingHints(null);
  -        }
  +
           switch(s.charAt(8)) {
           case 's': // optimizeSpeed
               hints.put(RenderingHints.KEY_RENDERING,
  @@ -457,12 +461,14 @@
                                                          RenderingHints hints) {
           Value v = getComputedStyle(e, SVGCSSEngine.IMAGE_RENDERING_INDEX);
           String s = v.getStringValue();
  -        if (s.charAt(0) == 'a') { // auto
  +        int    len = s.length();
  +        if ((len == 4) && (s.charAt(0) == 'a')) // auto
               return hints;
  -        }
  -        if (hints == null) {
  +        if (len < 13) return hints;  // Unknown.
  +
  +        if (hints == null)
               hints = new RenderingHints(null);
  -        }
  +
           switch(s.charAt(8)) {
           case 's': // optimizeSpeed
               hints.put(RenderingHints.KEY_RENDERING,
  @@ -513,12 +519,14 @@
                                                          RenderingHints hints) {
           Value v = getComputedStyle(e, SVGCSSEngine.COLOR_RENDERING_INDEX);
           String s = v.getStringValue();
  -        if (s.charAt(0) == 'a') { // auto
  +        int    len = s.length();
  +        if ((len == 4) && (s.charAt(0) == 'a')) // auto
               return hints;
  -        }
  -        if (hints == null) {
  +        if (len < 13) return hints;  // Unknown.
  +
  +        if (hints == null)
               hints = new RenderingHints(null);
  -        }
  +
           switch(s.charAt(8)) {
           case 's': // optimizeSpeed
               hints.put(RenderingHints.KEY_COLOR_RENDERING,
  
  
  
  1.13      +5 -5      xml-batik/sources/org/apache/batik/bridge/CursorManager.java
  
  Index: CursorManager.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/CursorManager.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- CursorManager.java	18 Aug 2004 07:12:31 -0000	1.12
  +++ CursorManager.java	20 Aug 2004 19:29:46 -0000	1.13
  @@ -233,8 +233,8 @@
               //   set to the anchor cursor through the SVGAElementBridge.
               //
               String nameSpaceURI = e.getNamespaceURI();
  -            String tag = e.getNodeName();
               if (SVGConstants.SVG_NAMESPACE_URI.equals(nameSpaceURI)) {
  +                String tag = e.getLocalName();
                   if (SVGConstants.SVG_A_TAG.equals(tag)) {
                       cursor = CursorManager.ANCHOR_CURSOR;
                   } else if (SVGConstants.SVG_TEXT_TAG.equals(tag) ||
  @@ -290,9 +290,9 @@
                   if (cursorElement != null) {
                       // We go an element, check it is of type cursor
                       String cursorNS = cursorElement.getNamespaceURI();
  -                    if (SVGConstants.SVG_NAMESPACE_URI.equals(cursorNS)
  -                        &&
  -                        SVGConstants.SVG_CURSOR_TAG.equals(cursorElement.getNodeName())) {
  +                    if (SVGConstants.SVG_NAMESPACE_URI.equals(cursorNS) &&
  +                        SVGConstants.SVG_CURSOR_TAG.equals
  +                        (cursorElement.getLocalName())) {
                           Cursor c = convertSVGCursorElement(cursorElement);
                           if (c != null) { 
                               return c;
  
  
  
  1.22      +12 -2     xml-batik/sources/org/apache/batik/bridge/SVGClipPathElementBridge.java
  
  Index: SVGClipPathElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGClipPathElementBridge.java,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- SVGClipPathElementBridge.java	18 Aug 2004 07:12:33 -0000	1.21
  +++ SVGClipPathElementBridge.java	20 Aug 2004 19:29:46 -0000	1.22
  @@ -17,6 +17,7 @@
    */
   package org.apache.batik.bridge;
   
  +import java.awt.RenderingHints;
   import java.awt.Shape;
   import java.awt.geom.AffineTransform;
   import java.awt.geom.Area;
  @@ -182,6 +183,15 @@
               // Make the initial source as a RenderableImage
               filter = clipedNode.getGraphicsNodeRable(true);
           }
  -        return new ClipRable8Bit(filter, clipPath);
  +
  +        boolean useAA = false;
  +        RenderingHints hints;
  +        hints = CSSUtilities.convertShapeRendering(clipElement, null);
  +        if (hints != null) {
  +            Object o = hints.get(RenderingHints.KEY_ANTIALIASING);
  +            useAA = (o == RenderingHints.VALUE_ANTIALIAS_ON);
  +        }
  +            
  +        return new ClipRable8Bit(filter, clipPath, useAA);
       }
   }
  
  
  
  1.26      +7 -8      xml-batik/sources/org/apache/batik/bridge/SVGGElementBridge.java
  
  Index: SVGGElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGGElementBridge.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- SVGGElementBridge.java	18 Aug 2004 07:12:34 -0000	1.25
  +++ SVGGElementBridge.java	20 Aug 2004 19:29:46 -0000	1.26
  @@ -63,21 +63,20 @@
       public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
           CompositeGraphicsNode gn =
               (CompositeGraphicsNode)super.createGraphicsNode(ctx, e);
  -	if (gn == null) {
  +	if (gn == null)
   	    return null;
  -	}
   
           // 'color-rendering'
  -        RenderingHints hints = CSSUtilities.convertColorRendering(e, null);
  -        if (hints != null) {
  +        RenderingHints hints = null;
  +        hints = CSSUtilities.convertColorRendering(e, hints);
  +        if (hints != null)
               gn.setRenderingHints(hints);
  -        }
   
           // 'enable-background'
           Rectangle2D r = CSSUtilities.convertEnableBackground(e);
  -        if (r != null) {
  +        if (r != null)
               gn.setBackgroundEnable(r);
  -        }
  +
           return gn;
       }
   
  
  
  
  1.68      +5 -5      xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java
  
  Index: SVGImageElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGImageElementBridge.java,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -r1.67 -r1.68
  --- SVGImageElementBridge.java	18 Aug 2004 07:12:34 -0000	1.67
  +++ SVGImageElementBridge.java	20 Aug 2004 19:29:46 -0000	1.68
  @@ -117,11 +117,11 @@
           imageNode.setHitCheckChildren(hitCheckChildren);
   
           // 'image-rendering' and 'color-rendering'
  -        RenderingHints hints = CSSUtilities.convertImageRendering(e, null);
  +        RenderingHints hints = null;
  +        hints = CSSUtilities.convertImageRendering(e, hints);
           hints = CSSUtilities.convertColorRendering(e, hints);
  -        if (hints != null) {
  +        if (hints != null)
               imageNode.setRenderingHints(hints);
  -        }
   
           return imageNode;
       }
  @@ -275,7 +275,7 @@
                                         new Object[] {purl});
           } catch (Exception ex) {
               /* Nothing to do */
  -            ex.printStackTrace();
  +            // ex.printStackTrace();
           } 
   
           try {
  
  
  
  1.44      +7 -2      xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java
  
  Index: SVGSVGElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- SVGSVGElementBridge.java	18 Aug 2004 07:12:35 -0000	1.43
  +++ SVGSVGElementBridge.java	20 Aug 2004 19:29:46 -0000	1.44
  @@ -18,6 +18,7 @@
   package org.apache.batik.bridge;
   
   import java.awt.Dimension;
  +import java.awt.RenderingHints;
   import java.awt.Shape;
   import java.awt.geom.AffineTransform;
   import java.awt.geom.NoninvertibleTransformException;
  @@ -150,7 +151,7 @@
               cgn.setPositionTransform(positionTransform);
           } else if (doc == ctx.getDocument()) {
               // <!> FIXME: hack to compute the original document's size
  -            ctx.setDocumentSize(new Dimension((int)w, (int)h));
  +            ctx.setDocumentSize(new Dimension((int)(w+0.5f), (int)(h+0.5f)));
           }
           // Set the viewing transform, this is often updated when the
           // component prepares for rendering.
  @@ -184,6 +185,10 @@
                   cgn.setClip(new ClipRable8Bit(filter, clip));
               } catch (NoninvertibleTransformException ex) {}
           }
  +        RenderingHints hints = null;
  +        hints = CSSUtilities.convertColorRendering(e, hints);
  +        if (hints != null)
  +            cgn.setRenderingHints(hints);
   
           // 'enable-background'
           Rectangle2D r = CSSUtilities.convertEnableBackground(e);
  
  
  
  1.28      +5 -4      xml-batik/sources/org/apache/batik/bridge/SVGShapeElementBridge.java
  
  Index: SVGShapeElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGShapeElementBridge.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- SVGShapeElementBridge.java	18 Aug 2004 07:12:35 -0000	1.27
  +++ SVGShapeElementBridge.java	20 Aug 2004 19:29:46 -0000	1.28
  @@ -56,11 +56,12 @@
           buildShape(ctx, e, shapeNode);
   
           // 'shape-rendering' and 'color-rendering'
  -        RenderingHints hints = CSSUtilities.convertShapeRendering(e, null);
  +        RenderingHints hints = null;
           hints = CSSUtilities.convertColorRendering(e, hints);
  -        if (hints != null) {
  +        hints = CSSUtilities.convertShapeRendering(e, hints);
  +        if (hints != null)
               shapeNode.setRenderingHints(hints);
  -        }
  +
           return shapeNode;
       }
   
  
  
  
  1.96      +9 -8      xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java
  
  Index: SVGTextElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGTextElementBridge.java,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -u -r1.95 -r1.96
  --- SVGTextElementBridge.java	18 Aug 2004 07:12:35 -0000	1.95
  +++ SVGTextElementBridge.java	20 Aug 2004 19:29:46 -0000	1.96
  @@ -133,19 +133,20 @@
        */
       public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
           TextNode node = (TextNode)super.createGraphicsNode(ctx, e);
  -        if (node == null) {
  +        if (node == null)
               return null;
  -        }
  +
           // specify the text painter to use
  -        if (ctx.getTextPainter() != null) {
  +        if (ctx.getTextPainter() != null)
               node.setTextPainter(ctx.getTextPainter());
  -        }
  +
           // 'text-rendering' and 'color-rendering'
  -        RenderingHints hints = CSSUtilities.convertTextRendering(e, null);
  +        RenderingHints hints = null;
           hints = CSSUtilities.convertColorRendering(e, hints);
  -        if (hints != null) {
  +        hints = CSSUtilities.convertTextRendering (e, hints);
  +        if (hints != null)
               node.setRenderingHints(hints);
  -        }
  +
           node.setLocation(getLocation(ctx, e));
   
           return node;
  
  
  
  1.44      +8 -5      xml-batik/sources/org/apache/batik/bridge/SVGUseElementBridge.java
  
  Index: SVGUseElementBridge.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGUseElementBridge.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- SVGUseElementBridge.java	18 Aug 2004 07:12:36 -0000	1.43
  +++ SVGUseElementBridge.java	20 Aug 2004 19:29:46 -0000	1.44
  @@ -18,6 +18,7 @@
   package org.apache.batik.bridge;
   
   import java.awt.Cursor;
  +import java.awt.RenderingHints;
   import java.awt.geom.AffineTransform;
   import java.awt.geom.Rectangle2D;
   
  @@ -81,9 +82,8 @@
        */
       public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
           // 'requiredFeatures', 'requiredExtensions' and 'systemLanguage'
  -        if (!SVGUtilities.matchUserAgent(e, ctx.getUserAgent())) {
  +        if (!SVGUtilities.matchUserAgent(e, ctx.getUserAgent()))
               return null;
  -        }
   
           CompositeGraphicsNode gn = buildCompositeGraphicsNode(ctx, e, null);
   
  @@ -211,12 +211,15 @@
           // 'visibility'
           gn.setVisible(CSSUtilities.convertVisibility(e));
   
  +        RenderingHints hints = null;
  +        hints = CSSUtilities.convertColorRendering(e, hints);
  +        if (hints != null)
  +            gn.setRenderingHints(hints);
   
           // 'enable-background'
           Rectangle2D r = CSSUtilities.convertEnableBackground(e);
  -        if (r != null) {
  +        if (r != null)
               gn.setBackgroundEnable(r);
  -        }
   
           ///////////////////////////////////////////////////////////////////////
           
  
  
  
  1.32      +29 -5     xml-batik/sources/org/apache/batik/bridge/UpdateManager.java
  
  Index: UpdateManager.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/UpdateManager.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- UpdateManager.java	18 Aug 2004 07:12:36 -0000	1.31
  +++ UpdateManager.java	20 Aug 2004 19:29:46 -0000	1.32
  @@ -352,14 +352,37 @@
           repaintManager.setupRenderer(u2d,dbr,aoi,width,height);
           List l = new ArrayList(1);
           l.add(aoi);
  -        updateRendering(l);
  +        updateRendering(l, false);
  +    }
  +
  +    /**
  +     * Updates the rendering buffer.  Only to be called from the
  +     * update thread.
  +     * @param u2d The user to device transform.
  +     * @param dbr Whether the double buffering should be used.
  +     * @param cpt If the canvas painting transform should be cleared
  +     *            when the update complets
  +     * @param aoi The area of interest in the renderer space units.
  +     * @param width&nbsp;height The offscreen buffer size.
  +     */
  +    public void updateRendering(AffineTransform u2d,
  +                                boolean dbr,
  +                                boolean cpt,
  +                                Shape aoi,
  +                                int width,
  +                                int height) {
  +        repaintManager.setupRenderer(u2d,dbr,aoi,width,height);
  +        List l = new ArrayList(1);
  +        l.add(aoi);
  +        updateRendering(l, cpt);
       }
   
       /**
        * Updates the rendering buffer.
        * @param aoi The area of interest in the renderer space units.
        */
  -    protected void updateRendering(List areas) {
  +    protected void updateRendering(List areas, 
  +                                   boolean clearPaintingTransform) {
           try {
               fireEvent(updateStartedDispatcher,new UpdateManagerEvent
                         (this, repaintManager.getOffScreen(), null));
  @@ -367,7 +390,8 @@
               Collection c = repaintManager.updateRendering(areas);
               List l = new ArrayList(c);
               fireEvent(updateCompletedDispatcher,new UpdateManagerEvent
  -                      (this, repaintManager.getOffScreen(), l));
  +                      (this, repaintManager.getOffScreen(), l,
  +                       clearPaintingTransform));
           } catch (ThreadDeath td) {
               fireEvent(updateFailedDispatcher,
                         new UpdateManagerEvent(this, null, null));
  @@ -405,7 +429,7 @@
           List dirtyAreas = updateTracker.getDirtyAreas();
           updateTracker.clear();
           if (dirtyAreas != null) {
  -            updateRendering(dirtyAreas);
  +            updateRendering(dirtyAreas, false);
           }
           lastRepaint = System.currentTimeMillis();
       }
  
  
  
  1.6       +39 -4     xml-batik/sources/org/apache/batik/bridge/UpdateManagerEvent.java
  
  Index: UpdateManagerEvent.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/UpdateManagerEvent.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- UpdateManagerEvent.java	18 Aug 2004 07:12:36 -0000	1.5
  +++ UpdateManagerEvent.java	20 Aug 2004 19:29:46 -0000	1.6
  @@ -41,16 +41,43 @@
       protected List dirtyAreas;
   
       /**
  +     * True if before painting this update the canvas's painting
  +     * transform needs to be cleared.
  +     */
  +    protected boolean clearPaintingTransform;
  +
  +    /**
        * Creates a new UpdateManagerEvent.
        * @param source the object that originated the event, ie. the
        *               UpdateManager.
        * @param bi the image to paint.
        * @param r The dirty area.
  +     * @param cpt Indicates if the painting transform should be
  +     *            cleared as a result of this event.
        */
  -    public UpdateManagerEvent(Object source, BufferedImage bi, List das) {
  +    public UpdateManagerEvent(Object source, BufferedImage bi, 
  +                              List das) {
           super(source);
  -        image = bi;
  -        dirtyAreas = das;
  +        this.image = bi;
  +        this.dirtyAreas = das;
  +        this.clearPaintingTransform = false;
  +    }
  +
  +    /**
  +     * Creates a new UpdateManagerEvent.
  +     * @param source the object that originated the event, ie. the
  +     *               UpdateManager.
  +     * @param bi the image to paint.
  +     * @param r The dirty area.
  +     * @param cpt Indicates if the painting transform should be
  +     *            cleared as a result of this event.
  +     */
  +    public UpdateManagerEvent(Object source, BufferedImage bi, 
  +                              List das, boolean cpt) {
  +        super(source);
  +        this.image = bi;
  +        this.dirtyAreas = das;
  +        this.clearPaintingTransform = cpt;
       }
   
       /**
  @@ -65,5 +92,13 @@
        */
       public List getDirtyAreas() {
           return dirtyAreas;
  +    }
  +
  +    /**
  +     * returns true if the component should clear it's painting transform
  +     * before painting the associated BufferedImage.
  +     */
  +    public boolean getClearPaintingTransform() {
  +        return clearPaintingTransform;
       }
   }
  
  
  
  1.40      +40 -41    xml-batik/sources/org/apache/batik/css/engine/CSSEngine.java
  
  Index: CSSEngine.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/engine/CSSEngine.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- CSSEngine.java	18 Aug 2004 07:12:48 -0000	1.39
  +++ CSSEngine.java	20 Aug 2004 19:29:47 -0000	1.40
  @@ -784,41 +784,41 @@
           }
   
           Value value = sm.getValue(propidx);
  -        if (!sm.isComputed(propidx)) {
  -            Value result = value;
  -            ValueManager vm = valueManagers[propidx];
  -            CSSStylableElement p = getParentCSSStylableElement(elt);
  -            if (value == null && (!vm.isInheritedProperty() || p == null)) {
  +        if (sm.isComputed(propidx)) 
  +            return value;
  +
  +        Value result = value;
  +        ValueManager vm = valueManagers[propidx];
  +        CSSStylableElement p = getParentCSSStylableElement(elt);
  +        if (value == null) {
  +            if ((p == null) || !vm.isInheritedProperty()) 
                   result = vm.getDefaultValue();
  -            } else if (value != null &&
  -                       (value == InheritValue.INSTANCE) &&
  -                       p != null) {
  -                result = null;
  -            }
  -            if (result == null) {
  -                // Value is 'inherit' and p != null.
  -                // The pseudo class is not propagated.
  -                result = getComputedStyle(p, null, propidx);
  -                sm.putParentRelative(propidx, true);
  -            } else {
  -                // Maybe is it a relative value.
  -                result = vm.computeValue(elt, pseudo, this, propidx,
  -                                         sm, result);
  -            }
  -            if (value == null) {
  -                sm.putValue(propidx, result);
  -                sm.putNullCascaded(propidx, true);
  -            } else if (result != value) {
  -                ComputedValue cv = new ComputedValue(value);
  -                cv.setComputedValue(result);
  -                sm.putValue(propidx, cv);
  -                result = cv;
  -            }
  -            sm.putComputed(propidx, true);
  -            value = result;
  +        } else if ((p != null) && (value == InheritValue.INSTANCE)) {
  +            result = null;
  +        }
  +        if (result == null) {
  +            // Value is 'inherit' and p != null.
  +            // The pseudo class is not propagated.
  +            result = getComputedStyle(p, null, propidx);
  +            sm.putParentRelative(propidx, true);
  +            sm.putInherited     (propidx, true);
  +        } else {
  +            // Maybe is it a relative value.
  +            result = vm.computeValue(elt, pseudo, this, propidx,
  +                                     sm, result);
  +        }
  +        if (value == null) {
  +            sm.putValue(propidx, result);
  +            sm.putNullCascaded(propidx, true);
  +        } else if (result != value) {
  +            ComputedValue cv = new ComputedValue(value);
  +            cv.setComputedValue(result);
  +            sm.putValue(propidx, cv);
  +            result = cv;
           }
   
  -        return value;
  +        sm.putComputed(propidx, true);
  +        return result;
       }
   
       /**
  @@ -2303,15 +2303,15 @@
   
               Node attr = mevt.getRelatedNode();
               String attrNS = attr.getNamespaceURI();
  -            String name = (attrNS == null)
  -                ? attr.getNodeName()
  -                : attr.getLocalName();
  +            String name   = ((attrNS == null) ? 
  +                             attr.getNodeName() :
  +                             attr.getLocalName());
                   
               CSSStylableElement elt = (CSSStylableElement)et;
               StyleMap style = elt.getComputedStyleMap(null);
               if (style != null) {
  -                if ((attrNS == null && styleNamespaceURI == null) ||
  -                    (attrNS != null && attrNS.equals(styleNamespaceURI))) {
  +                if ((attrNS == styleNamespaceURI) ||
  +                    ((attrNS != null) && attrNS.equals(styleNamespaceURI))) {
                       if (name.equals(styleLocalName)) {
                           // The style declaration attribute has been modified.
                           inlineStyleAttributeUpdated(elt, style, mevt);
  @@ -2320,9 +2320,8 @@
                   }
   
                   if (nonCSSPresentationalHints != null) {
  -                    if ((attrNS == null &&
  -                         nonCSSPresentationalHintsNamespaceURI == null) ||
  -                        (attrNS != null &&
  +                    if ((attrNS == nonCSSPresentationalHintsNamespaceURI) ||
  +                        ((attrNS != null) &&
                            attrNS.equals(nonCSSPresentationalHintsNamespaceURI))) {
                           if (nonCSSPresentationalHints.contains(name)) {
                               // The 'name' attribute which represents a non CSS
  
  
  
  1.4       +63 -47    xml-batik/sources/org/apache/batik/css/engine/StyleMap.java
  
  Index: StyleMap.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/engine/StyleMap.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- StyleMap.java	18 Aug 2004 07:12:48 -0000	1.3
  +++ StyleMap.java	20 Aug 2004 19:29:47 -0000	1.4
  @@ -28,30 +28,31 @@
   public class StyleMap {
       
       //
  -    // The masks
  -    //
  -    public final static short IMPORTANT_MASK = 0x0001;
  -    public final static short COMPUTED_MASK = 0x0002;
  -    public final static short NULL_CASCADED_MASK = 0x0004;
  -
  -    public final static short LINE_HEIGHT_RELATIVE_MASK = 0x0008;
  -    public final static short FONT_SIZE_RELATIVE_MASK = 0x0010;
  -    public final static short COLOR_RELATIVE_MASK = 0x0020;
  -    public final static short PARENT_RELATIVE_MASK = 0x0040;
  -    public final static short BLOCK_WIDTH_RELATIVE_MASK = 0x0080;
  -    public final static short BLOCK_HEIGHT_RELATIVE_MASK = 0x0100;
  -    public final static short BOX_RELATIVE_MASK = 0x0200;
  -
  +    // The masks, still have 2 free bits: 0x0800, & 0x1000, could also
  +    // go to int if needed.
  +    // 
  +    public final static short IMPORTANT_MASK             = 0x0001;
  +    public final static short COMPUTED_MASK              = 0x0002;
  +    public final static short NULL_CASCADED_MASK         = 0x0004;
  +    public final static short INHERITED_MASK             = 0x0008;
  +
  +    public final static short LINE_HEIGHT_RELATIVE_MASK  = 0x0010;
  +    public final static short FONT_SIZE_RELATIVE_MASK    = 0x0020;
  +    public final static short COLOR_RELATIVE_MASK        = 0x0040;
  +    public final static short PARENT_RELATIVE_MASK       = 0x0080;
  +    public final static short BLOCK_WIDTH_RELATIVE_MASK  = 0x0100;
  +    public final static short BLOCK_HEIGHT_RELATIVE_MASK = 0x0200;
  +    public final static short BOX_RELATIVE_MASK          = 0x0400;
  +    
       public final static short ORIGIN_MASK = (short)0xE000; // 3 last bits
   
  -
       //
       // The origin values.
       //
  -    public final static short USER_AGENT_ORIGIN = 0;
  -    public final static short USER_ORIGIN = 0x2000; // 0010
  -    public final static short NON_CSS_ORIGIN = 0x4000; // 0100
  -    public final static short AUTHOR_ORIGIN = 0x6000; // 0110
  +    public final static short USER_AGENT_ORIGIN    = 0;
  +    public final static short USER_ORIGIN          = 0x2000; // 0010
  +    public final static short NON_CSS_ORIGIN       = 0x4000; // 0100
  +    public final static short AUTHOR_ORIGIN        = 0x6000; // 0110
       public final static short INLINE_AUTHOR_ORIGIN = (short)0x8000; // 1000
   
       /**
  @@ -127,6 +128,14 @@
       }
   
       /**
  +     * Tells whether the given cascaded property value was
  +     * inherited from it's parent or set locally.
  +     */
  +    public boolean isInherited(int i) {
  +        return (masks[i] & INHERITED_MASK) != 0;
  +    }
  +
  +    /**
        * Returns the origin value.
        */
       public short getOrigin(int i) {
  @@ -200,8 +209,8 @@
        * Sets the priority of a property value.
        */
       public void putImportant(int i, boolean b) {
  -        masks[i] &= ~IMPORTANT_MASK;
  -        masks[i] |= (b) ? IMPORTANT_MASK : 0;
  +        if (b) masks[i] |=  IMPORTANT_MASK;
  +        else   masks[i] &= ~IMPORTANT_MASK;
       }
   
       /**
  @@ -216,64 +225,73 @@
        * Sets the computed flag of a property value.
        */
       public void putComputed(int i, boolean b) {
  -        masks[i] &= ~COMPUTED_MASK;
  -        masks[i] |= (b) ? COMPUTED_MASK : 0;
  +        if (b) masks[i] |=  COMPUTED_MASK;
  +        else   masks[i] &= ~COMPUTED_MASK;
       }
   
       /**
        * Sets the null-cascaded flag of a property value.
        */
       public void putNullCascaded(int i, boolean b) {
  -        masks[i] &= ~NULL_CASCADED_MASK;
  -        masks[i] |= (b) ? NULL_CASCADED_MASK : 0;
  +        if (b) masks[i] |=  NULL_CASCADED_MASK;
  +        else   masks[i] &= ~NULL_CASCADED_MASK;
  +    }
  +
  +    /**
  +     * Sets the inherited flag of a property value.
  +     * If true this computed value was inherited from it's parent.
  +     */
  +    public void putInherited(int i, boolean b) {
  +        if (b) masks[i] |=  INHERITED_MASK;
  +        else   masks[i] &= ~INHERITED_MASK;
       }
   
       /**
        * Sets the color-relative flag of a property value.
        */
       public void putColorRelative(int i, boolean b) {
  -        masks[i] &= ~COLOR_RELATIVE_MASK;
  -        masks[i] |= (b) ? COLOR_RELATIVE_MASK : 0;
  +        if (b) masks[i] |=  COLOR_RELATIVE_MASK;
  +        else   masks[i] &= ~COLOR_RELATIVE_MASK;
       }
   
       /**
        * Sets the parent-relative flag of a property value.
        */
       public void putParentRelative(int i, boolean b) {
  -        masks[i] &= ~PARENT_RELATIVE_MASK;
  -        masks[i] |= (b) ? PARENT_RELATIVE_MASK : 0;
  +        if (b) masks[i] |=  PARENT_RELATIVE_MASK;
  +        else   masks[i] &= ~PARENT_RELATIVE_MASK;
       }
   
       /**
        * Sets the line-height-relative flag of a property value.
        */
       public void putLineHeightRelative(int i, boolean b) {
  -        masks[i] &= ~LINE_HEIGHT_RELATIVE_MASK;
  -        masks[i] |= (b) ? LINE_HEIGHT_RELATIVE_MASK : 0;
  +        if (b) masks[i] |=  LINE_HEIGHT_RELATIVE_MASK;
  +        else   masks[i] &= ~LINE_HEIGHT_RELATIVE_MASK;
       }
   
       /**
        * Sets the font-size-relative flag of a property value.
        */
       public void putFontSizeRelative(int i, boolean b) {
  -        masks[i] &= ~FONT_SIZE_RELATIVE_MASK;
  -        masks[i] |= (b) ? FONT_SIZE_RELATIVE_MASK : 0;
  +        if (b) masks[i] |=  FONT_SIZE_RELATIVE_MASK;
  +        else   masks[i] &= ~FONT_SIZE_RELATIVE_MASK;
       }
   
       /**
        * Sets the block-width-relative flag of a property value.
        */
       public void putBlockWidthRelative(int i, boolean b) {
  -        masks[i] &= ~BLOCK_WIDTH_RELATIVE_MASK;
  -        masks[i] |= (b) ? BLOCK_WIDTH_RELATIVE_MASK : 0;
  +        if (b) masks[i] |=  BLOCK_WIDTH_RELATIVE_MASK;
  +        else   masks[i] &= ~BLOCK_WIDTH_RELATIVE_MASK;
       }
   
       /**
        * Sets the block-height-relative flag of a property value.
        */
       public void putBlockHeightRelative(int i, boolean b) {
  -        masks[i] &= ~BLOCK_HEIGHT_RELATIVE_MASK;
  -        masks[i] |= (b) ? BLOCK_HEIGHT_RELATIVE_MASK : 0;
  +        if (b) masks[i] |=  BLOCK_HEIGHT_RELATIVE_MASK;
  +        else   masks[i] &= ~BLOCK_HEIGHT_RELATIVE_MASK;
       }
   
       /**
  @@ -283,15 +301,13 @@
           StringBuffer sb = new StringBuffer();
           for (int i = 0; i < values.length; i++) {
               Value v = values[i];
  -            if (v != null) {
  -                sb.append(eng.getPropertyName(i));
  -                sb.append(": ");
  -                sb.append(v);
  -                if (isImportant(i)) {
  -                    sb.append(" !important");
  -                }
  -                sb.append(";\n");
  -            }
  +            if (v == null) continue;
  +
  +            sb.append(eng.getPropertyName(i));
  +            sb.append(": ");
  +            sb.append(v);
  +            if (isImportant(i)) sb.append(" !important");
  +            sb.append(";\n");
           }
           return sb.toString();
       }
  
  
  
  1.9       +22 -55    xml-batik/sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java
  
  Index: FontSizeManager.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/css/engine/value/css2/FontSizeManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- FontSizeManager.java	18 Aug 2004 07:12:55 -0000	1.8
  +++ FontSizeManager.java	20 Aug 2004 19:29:47 -0000	1.9
  @@ -133,6 +133,9 @@
                                 int idx,
                                 StyleMap sm,
                                 Value value) {
  +        float scale = 1.0f;
  +        boolean doParentRelative = false;
  +
           switch (value.getPrimitiveType()) {
           case CSSPrimitiveValue.CSS_NUMBER:
           case CSSPrimitiveValue.CSS_PX:
  @@ -171,64 +174,29 @@
                                      (6f * ctx.getPixelUnitToMillimeter())));
   
           case CSSPrimitiveValue.CSS_EMS:
  -            sm.putParentRelative(idx, true);
  -
  -            v = value.getFloatValue();
  -            CSSStylableElement p;
  -            p = CSSEngine.getParentCSSStylableElement(elt);
  -            float fs;
  -            if (p == null) {
  -                ctx = engine.getCSSContext();
  -                fs = ctx.getMediumFontSize();
  -            } else {
  -                fs = engine.getComputedStyle(p, null, idx).getFloatValue();
  -            }
  -            return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, v * fs);
  -
  +            doParentRelative = true;
  +            scale = value.getFloatValue();
  +            break;
           case CSSPrimitiveValue.CSS_EXS:
  -            sm.putParentRelative(idx, true);
  -
  -            v = value.getFloatValue();
  -            p = CSSEngine.getParentCSSStylableElement(elt);
  -            if (p == null) {
  -                ctx = engine.getCSSContext();
  -                fs = ctx.getMediumFontSize();
  -            } else {
  -                fs = engine.getComputedStyle(p, null, idx).getFloatValue();
  -            }
  -            return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
  -                                  v * fs * 0.5f); // !!! x-height
  -
  +            doParentRelative = true;
  +            scale = value.getFloatValue()*0.5f;   // !!! x-height
  +            break;
           case CSSPrimitiveValue.CSS_PERCENTAGE:
  -            sm.putParentRelative(idx, true);
  -
  -            v = value.getFloatValue();
  -            p = CSSEngine.getParentCSSStylableElement(elt);
  -            if (p == null) {
  -                ctx = engine.getCSSContext();
  -                fs = ctx.getMediumFontSize();
  -            } else {
  -                fs = engine.getComputedStyle(p, null, idx).getFloatValue();
  -            }
  -            return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
  -                                  v * fs / 100f);
  +            doParentRelative = true;
  +            scale = value.getFloatValue()*0.01f;
  +            break;
  +        default:
           }
   
           if (value == ValueConstants.LARGER_VALUE) {
  -            sm.putParentRelative(idx, true);
  -
  -            CSSStylableElement p;
  -            p = CSSEngine.getParentCSSStylableElement(elt);
  -            float fs;
  -            if (p == null) {
  -                CSSContext ctx = engine.getCSSContext();
  -                fs = ctx.getMediumFontSize();
  -            } else {
  -                fs = engine.getComputedStyle(p, null, idx).getFloatValue();
  -            }
  -            return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
  -                                  fs * 1.2f);
  +            doParentRelative = true;
  +            scale = 1.2f;
           } else if (value == ValueConstants.SMALLER_VALUE) {
  +            doParentRelative = true;
  +            scale = 1/1.2f;
  +        }
  +
  +        if (doParentRelative) {
               sm.putParentRelative(idx, true);
   
               CSSStylableElement p;
  @@ -240,8 +208,7 @@
               } else {
                   fs = engine.getComputedStyle(p, null, idx).getFloatValue();
               }
  -            return new FloatValue(CSSPrimitiveValue.CSS_NUMBER,
  -                                  fs / 1.2f);
  +            return new FloatValue(CSSPrimitiveValue.CSS_NUMBER, fs * scale);
           }
           
           // absolute identifiers
  
  
  
  1.23      +55 -48    xml-batik/sources/org/apache/batik/dom/AbstractParentNode.java
  
  Index: AbstractParentNode.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/dom/AbstractParentNode.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- AbstractParentNode.java	18 Aug 2004 07:13:07 -0000	1.22
  +++ AbstractParentNode.java	20 Aug 2004 19:29:47 -0000	1.23
  @@ -71,13 +71,14 @@
        */
       public Node insertBefore(Node newChild, Node refChild)
           throws DOMException {
  -	if (refChild != null && childNodes == null) {
  +	if ((refChild != null) && ((childNodes == null) ||
  +                                   (refChild.getParentNode() != this))) 
   	    throw createDOMException
   		(DOMException.NOT_FOUND_ERR,
   		 "child.missing",
   		 new Object[] { new Integer(refChild.getNodeType()),
   				refChild.getNodeName() });
  -	}
  +
   	checkAndRemove(newChild, false);
   
   	if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) {
  @@ -112,47 +113,52 @@
        */
       public Node replaceChild(Node newChild, Node oldChild)
           throws DOMException {
  -	if (childNodes == null) {
  +	if ((childNodes == null) || (oldChild.getParentNode() != this) )
   	    throw createDOMException
   		(DOMException.NOT_FOUND_ERR,
   		 "child.missing",
   		 new Object[] { new Integer(oldChild.getNodeType()),
   				oldChild.getNodeName() });
  -	}
  +
   	checkAndRemove(newChild, true);
   
   	if (newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE) {
   	    Node n  = newChild.getLastChild();
  -	    Node ps = oldChild.getNextSibling();
  -	    if (n != null) {
  -		replaceChild(n, oldChild);
  -		n = n.getPreviousSibling();
  -	    }
  -	    while (n != null) {
  -		insertBefore(n, ps);
  -		n = n.getPreviousSibling();
  -	    }
  -	    return newChild;
  -	} else {
  -	    // Mutation event
  -	    fireDOMNodeRemovedEvent(oldChild);
  +	    if (n == null) 
  +                return newChild;
   
  -            getCurrentDocument().nodeToBeRemoved(oldChild);
  -            nodeToBeRemoved(oldChild);
  +            Node ps = n.getPreviousSibling();
  +            replaceChild(n, oldChild);
  +	    Node ns = n;
  +            n  = ps;
  +            while (n != null) {
  +                ps = n.getPreviousSibling();
  +                insertBefore(n, ns);
  +                ns = n;
  +                n = ps;
  +            }
   
  -	    // Node modification
  -	    ExtendedNode n = (ExtendedNode)newChild;
  -	    ExtendedNode o = childNodes.replace(n, (ExtendedNode)oldChild);
  -	    n.setParentNode(this);
  -	    o.setParentNode(null);
  -
  -            nodeAdded(n);
  -
  -	    // Mutation event
  -	    fireDOMNodeInsertedEvent(n);
  -	    fireDOMSubtreeModifiedEvent();
  -	    return n;
  +	    return newChild;
   	}
  +
  +        // Mutation event
  +        fireDOMNodeRemovedEvent(oldChild);
  +        
  +        getCurrentDocument().nodeToBeRemoved(oldChild);
  +        nodeToBeRemoved(oldChild);
  +        
  +        // Node modification
  +        ExtendedNode n = (ExtendedNode)newChild;
  +        ExtendedNode o = childNodes.replace(n, (ExtendedNode)oldChild);
  +        n.setParentNode(this);
  +        o.setParentNode(null);
  +        
  +        nodeAdded(n);
  +        
  +        // Mutation event
  +        fireDOMNodeInsertedEvent(n);
  +        fireDOMSubtreeModifiedEvent();
  +        return n;
       }
   
       /**
  @@ -203,9 +209,9 @@
   	    }
   	    return newChild;
   	} else {
  -	    if (childNodes == null) {
  +	    if (childNodes == null)
   		childNodes = new ChildNodes();
  -	    }
  +
   	    // Node modification
   	    ExtendedNode n = childNodes.append((ExtendedNode)newChild);
   	    n.setParentNode(this);
  @@ -422,33 +428,34 @@
        */
       protected void checkAndRemove(Node n, boolean replace) {
   	checkChildType(n, replace);
  -	if (isReadonly()) {
  +
  +	if (isReadonly())
   	    throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR,
   				     "readonly.node",
   				     new Object[] { new Integer(getNodeType()),
   						    getNodeName() });
  -	}
  -	if (n.getOwnerDocument() != getCurrentDocument()) {
  +
  +	if (n.getOwnerDocument() != getCurrentDocument())
   	    throw createDOMException(DOMException.WRONG_DOCUMENT_ERR,
   				     "node.from.wrong.document",
   				     new Object[] { new Integer(getNodeType()),
   						    getNodeName() });
  -	}
  -	for (Node pn = getParentNode(); pn != null; pn = pn.getParentNode()) {
  -	    if (pn == n) {
  -		throw createDOMException
  -                    (DOMException.WRONG_DOCUMENT_ERR,
  +        
  +	Node np = n.getParentNode();
  +        if (np == null)
  +            return;  // Already removed from tree, do nothing.
  +
  +        for (Node pn = getParentNode(); pn != null; pn = pn.getParentNode()) {
  +            if (pn == n)
  +                throw createDOMException
  +                    (DOMException.HIERARCHY_REQUEST_ERR,
                        "add.ancestor",
                        new Object[] { new Integer(getNodeType()),
                                       getNodeName() });
  -	    }
  -	}
  +        }
   
   	// Remove the node from the tree
  -	Node np = n.getParentNode();
  -	if (np != null) {
  -	    np.removeChild(n);
  -	}
  +        np.removeChild(n);
       }
   
       /**
  
  
  
  1.8       +10 -7     xml-batik/sources/org/apache/batik/ext/awt/RenderingHintsKeyExt.java
  
  Index: RenderingHintsKeyExt.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/RenderingHintsKeyExt.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RenderingHintsKeyExt.java	18 Aug 2004 07:13:41 -0000	1.7
  +++ RenderingHintsKeyExt.java	20 Aug 2004 19:29:47 -0000	1.8
  @@ -36,7 +36,10 @@
   
       public static final String VALUE_TRANSCODING_PRINTING = 
           new String("Printing");
  -    
  +
  +    public static final String VALUE_TRANSCODING_VECTOR = 
  +        new String("Vector");
  +
       /**
        * Key for the AOI hint. This hint is used to propagate the AOI to Paint
        * and PaintContext instances.
  @@ -84,11 +87,11 @@
               }
               break;
           }
  -        KEY_BASE             = base;
  -        KEY_TRANSCODING      = trans;
  -        KEY_AREA_OF_INTEREST = aoi;
  -        KEY_BUFFERED_IMAGE   = bi;
  -        KEY_COLORSPACE       = cs;
  +        KEY_BASE              = base;
  +        KEY_TRANSCODING       = trans;
  +        KEY_AREA_OF_INTEREST  = aoi;
  +        KEY_BUFFERED_IMAGE    = bi;
  +        KEY_COLORSPACE        = cs;
       }
   
       /**
  
  
  
  1.4       +14 -1     xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ClipRable.java
  
  Index: ClipRable.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ClipRable.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClipRable.java	18 Aug 2004 07:13:58 -0000	1.3
  +++ ClipRable.java	20 Aug 2004 19:29:47 -0000	1.4
  @@ -28,6 +28,19 @@
    * @version $Id$ */
   public interface ClipRable extends Filter {
   
  +    /**
  +     * Set the default behaviour of anti-aliased clipping.
  +     * for this clip object.
  +     */
  +    public void setUseAntialiasedClip(boolean useAA);
  +
  +    /**
  +     * Resturns true if the default behaviour should be to use
  +     * anti-aliased clipping.
  +     */
  +    public boolean getUseAntialiasedClip();
  +
  +
         /**
          * The source to be clipped by the outline of the clip node.
          * @param src The Image to be clipped.
  
  
  
  1.7       +28 -1     xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ClipRable8Bit.java
  
  Index: ClipRable8Bit.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/ext/awt/image/renderable/ClipRable8Bit.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ClipRable8Bit.java	18 Aug 2004 07:13:58 -0000	1.6
  +++ ClipRable8Bit.java	20 Aug 2004 19:29:47 -0000	1.7
  @@ -46,6 +46,8 @@
       extends    AbstractRable 
       implements ClipRable {
   
  +    protected boolean useAA;
  +
       /**
        * The node who's outline specifies our mask.
        */
  @@ -54,6 +56,13 @@
       public ClipRable8Bit(Filter src, Shape clipPath) {
           super(src, null);
           setClipPath(clipPath);
  +        setUseAntialiasedClip(false);
  +    }
  +
  +    public ClipRable8Bit(Filter src, Shape clipPath, boolean useAA) {
  +        super(src, null);
  +        setClipPath(clipPath);
  +        setUseAntialiasedClip(useAA);
       }
   
       /**
  @@ -71,6 +80,24 @@
       public Filter getSource() {
           return (Filter)getSources().get(0);
       }
  +
  +    /**
  +     * Set the default behaviour of anti-aliased clipping.
  +     * for this clip object.
  +     */
  +    public void setUseAntialiasedClip(boolean useAA) {
  +        touch();
  +        this.useAA = useAA;
  +    }
  +
  +    /**
  +     * Resturns true if the default behaviour should be to use
  +     * anti-aliased clipping.
  +     */
  +    public boolean getUseAntialiasedClip() {
  +        return useAA;
  +    }
  +
   
       /**
        * Set the clip path to use.
  
  
  
  1.54      +22 -22    xml-batik/sources/org/apache/batik/gvt/AbstractGraphicsNode.java
  
  Index: AbstractGraphicsNode.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/gvt/AbstractGraphicsNode.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- AbstractGraphicsNode.java	18 Aug 2004 07:14:25 -0000	1.53
  +++ AbstractGraphicsNode.java	20 Aug 2004 19:29:48 -0000	1.54
  @@ -434,8 +434,9 @@
                   return;         // No point in drawing
           }
   
  -        // Set up graphic context. It is important to setup the transform first,
  -        // because the clip is defined in this node's user space.
  +        // Set up graphic context. It is important to setup the
  +        // transform first, because the clip is defined in this node's
  +        // user space.
           Shape defaultClip = g2d.getClip();
           Composite defaultComposite = g2d.getComposite();
           AffineTransform defaultTransform = g2d.getTransform();
  @@ -477,11 +478,10 @@
           // Only paint if needed.
           if (paintNeeded){
               boolean antialiasedClip = false;
  -            if(clip != null){
  -                antialiasedClip = false;
  -                    /*                    isAntialiasedClip(g2d.getTransform(),
  -                                      g2d.getRenderingHints(),
  -                                      clip.getClipPath());*/
  +            if ((clip != null) && clip.getUseAntialiasedClip()) {
  +                antialiasedClip = isAntialiasedClip(g2d.getTransform(),
  +                                                    g2d.getRenderingHints(),
  +                                                    clip.getClipPath());
               }
   
               boolean useOffscreen = isOffscreenBufferNeeded();
  @@ -574,9 +574,8 @@
       protected boolean isAntialiasedClip(AffineTransform usr2dev,
                                           RenderingHints hints,
                                           Shape clip){
  -        //
           // Antialias clip if:
  -        // + Antialiasing is on *or* rendering quality is on
  +        // + The KEY_CLIP_ANTIALIASING is true.
           // *and*
           // + clip is not null
           // *and*
  @@ -587,18 +586,19 @@
           // of the current Graphics2D's clip and this node's clip)
           // is not a rectangle.
           //
  -        boolean antialiased = false;
  -        if((hints.get(RenderingHints.KEY_ANTIALIASING) ==
  -            RenderingHints.VALUE_ANTIALIAS_ON) ||
  -           (hints.get(RenderingHints.KEY_RENDERING) ==
  -            RenderingHints.VALUE_RENDER_QUALITY)){
  -            if(!(clip instanceof Rectangle2D &&
  -                 usr2dev.getShearX() == 0 &&
  -                 usr2dev.getShearY() == 0)){
  -                antialiased = true;
  -            }
  -        }
  -        return antialiased;
  +        if (clip == null) return false;
  +
  +        Object val = hints.get(RenderingHintsKeyExt.KEY_TRANSCODING);
  +        if ((val == RenderingHintsKeyExt.VALUE_TRANSCODING_PRINTING) ||
  +            (val == RenderingHintsKeyExt.VALUE_TRANSCODING_VECTOR))
  +            return false;
  +
  +        if(!(clip instanceof Rectangle2D &&
  +             usr2dev.getShearX() == 0 &&
  +             usr2dev.getShearY() == 0))
  +            return true;
  +
  +        return false;
       }
   
       //
  
  
  
  1.97      +22 -12    xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java
  
  Index: JSVGComponent.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/swing/svg/JSVGComponent.java,v
  retrieving revision 1.96
  retrieving revision 1.97
  diff -u -r1.96 -r1.97
  --- JSVGComponent.java	18 Aug 2004 07:15:35 -0000	1.96
  +++ JSVGComponent.java	20 Aug 2004 19:29:48 -0000	1.97
  @@ -330,6 +330,8 @@
   
       protected boolean recenterOnResize = true;
   
  +    protected AffineTransform viewingTransform = null;
  +
       /**
        * Creates a new JSVGComponent.
        */
  @@ -740,6 +742,7 @@
               (fragmentIdentifier, elt);
           CanvasGraphicsNode cgn = getCanvasGraphicsNode(gn);
           cgn.setViewingTransform(at);
  +        viewingTransform = at;
           initialTransform = new AffineTransform();
           setRenderingTransform(initialTransform, false);
           jsvgComponentListener.updateMatrix(initialTransform);
  @@ -822,11 +825,8 @@
           AffineTransform at = getRenderingTransform();
           if (at == null) at = new AffineTransform();
           else            at = new AffineTransform(at);
  -        CanvasGraphicsNode cgn = getCanvasGraphicsNode();
  -        if (cgn != null) {
  -            AffineTransform vAT = cgn.getViewingTransform();
  -            if (vAT != null)
  -                at.concatenate(vAT);
  +        if (viewingTransform != null) {
  +            at.concatenate(viewingTransform);
           }
           return at;
       }
  @@ -873,10 +873,9 @@
               prevComponentSize = d;
               if (d.width  < 1) d.width  = 1;
               if (d.height < 1) d.height = 1;
  -            AffineTransform at = calculateViewingTransform
  +            final AffineTransform at = calculateViewingTransform
                   (fragmentIdentifier, elt);
  -            CanvasGraphicsNode cgn = getCanvasGraphicsNode();
  -            AffineTransform vt = cgn.getViewingTransform();
  +            AffineTransform vt = viewingTransform;
               if (at.equals(vt)) {
                   // No new transform
                   // Only repaint if size really changed.
  @@ -923,7 +922,17 @@
                       (AffineTransform.getTranslateInstance(dx, dy));
                   setRenderingTransform(rendAT, false);
               }
  -            cgn.setViewingTransform(at);
  +            viewingTransform = at;
  +            Runnable r = new Runnable() {
  +                    AffineTransform myAT = at;
  +                    CanvasGraphicsNode myCGN = getCanvasGraphicsNode();
  +                    public void run() {
  +                        myCGN.setViewingTransform(myAT);
  +                    }
  +                };
  +            UpdateManager um = getUpdateManager();
  +            if (um != null) um.getUpdateRunnableQueue().invokeLater(r);
  +            else             r.run();
           } catch (BridgeException e) {
               userAgent.displayError(e);
           }
  @@ -960,9 +969,8 @@
   
           updateManager.getUpdateRunnableQueue().invokeLater
               (new Runnable() { public void run() {
  -                paintingTransform = null;
                   updateManager.updateRendering(renderingTransform,
  -                                              doubleBufferedRendering, s,
  +                                              doubleBufferedRendering, true, s,
                                                 visRect.width, visRect.height);
               }});
       }
  @@ -1733,6 +1741,8 @@
                   EventQueue.invokeAndWait(new Runnable() {
                           public void run() {
                               image = e.getImage();
  +                            if (e.getClearPaintingTransform())
  +                                paintingTransform = null;
   
                               List l = e.getDirtyAreas();
                               if (l != null) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic