You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by tk...@apache.org on 2001/03/30 13:46:12 UTC

cvs commit: xml-batik/sources/org/apache/batik/bridge CSSUtilities.java SVGGElementBridge.java SVGImageElementBridge.java SVGShapeElementBridge.java SVGTextElementBridge.java URIResolver.java

tkormann    01/03/30 03:46:12

  Modified:    sources/org/apache/batik/bridge CSSUtilities.java
                        SVGGElementBridge.java SVGImageElementBridge.java
                        SVGShapeElementBridge.java
                        SVGTextElementBridge.java URIResolver.java
  Added:       samples/tests image-rendering.svg shape-rendering.svg
                        text-rendering.svg
  Log:
  - Add shape-rendering, text-rendering, and image-rendering support.
  
  Shape rendering seems ok
  
  Image rendering seems to be not well supported in Java2D
  
  Text rendering does not work (The RenderingHints is TEXT_* and I think
  the drawing order are not text related but shape)
  
  For seeing the match between SVG and Java2D, see CSSUtilities class
  
  Revision  Changes    Path
  1.1                  xml-batik/samples/tests/image-rendering.svg
  
  Index: image-rendering.svg
  ===================================================================
  <?xml version="1.0" standalone="no"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
  "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
  
  <!-- ========================================================================= -->
  <!-- Copyright (C) The Apache Software Foundation. All rights reserved.        -->
  <!--                                                                           -->
  <!-- This software is published under the terms of the Apache Software License -->
  <!-- version 1.1, a copy of which has been included with this distribution in  -->
  <!-- the LICENSE file.                                                         -->
  <!-- ========================================================================= -->
  
  <!-- ========================================================================= -->
  <!--  Test 'image-rendering' property                                          -->
  <!--                                                                           -->
  <!-- @author tkormann@apache.org                                               -->
  <!-- @version $Id: image-rendering.svg,v 1.1 2001/03/30 11:46:02 tkormann Exp $ -->
  <!-- ========================================================================= -->
  
  <?xml-stylesheet type="text/css" href="test.css" ?>
  
  
  <svg id="body" width="450" height="500" viewBox="0 0 450 500">
  <title>Test the 'text-rendering' property</title>
      <!-- ============================================================= -->
      <!-- Test content                                                  -->
      <!-- ============================================================= -->
  <g id="testContent">
    <text x="225" y="50" class="title">
      Test the 'image-rendering' property
    </text>
  
    <g>
      <image x="60" y="90" width="100" height="100" xlink:href="jpeg.jpg" style="image-rendering:auto"/>
      <image x="260" y="90" width="100" height="100" xlink:href="jpeg.jpg" style="image-rendering:optimizeSpeed"/>
      <image x="60" y="240" width="100" height="100" xlink:href="jpeg.jpg" style="image-rendering:optimizeQuality"/>
    </g>
  
    <g style="font-size:11;fill:black;stroke:none;text-anchor:middle">
    <text x="110" y="204">auto</text>
    <text x="310" y="204">optimizeSpeed</text>
    <text x="110" y="354">optimizeQuality</text>
    </g>
  </g>
  
      <!-- ============================================================= -->
      <!-- Batik sample mark                                             -->
      <!-- ============================================================= -->
      <use xlink:href="../batikLogo.svg#Batik_Tag_Box" />
      
  </svg>
  
  
  
  1.1                  xml-batik/samples/tests/shape-rendering.svg
  
  Index: shape-rendering.svg
  ===================================================================
  <?xml version="1.0" standalone="no"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
  "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
  
  <!-- ========================================================================= -->
  <!-- Copyright (C) The Apache Software Foundation. All rights reserved.        -->
  <!--                                                                           -->
  <!-- This software is published under the terms of the Apache Software License -->
  <!-- version 1.1, a copy of which has been included with this distribution in  -->
  <!-- the LICENSE file.                                                         -->
  <!-- ========================================================================= -->
  
  <!-- ========================================================================= -->
  <!--  Test 'shape-rendering' property                                          -->
  <!--                                                                           -->
  <!-- @author tkormann@apache.org                                               -->
  <!-- @version $Id: shape-rendering.svg,v 1.1 2001/03/30 11:46:02 tkormann Exp $ -->
  <!-- ========================================================================= -->
  
  <?xml-stylesheet type="text/css" href="test.css" ?>
  
  
  <svg id="body" width="450" height="500" viewBox="0 0 450 500">
  <title>Test the 'shape-rendering' property</title>
      <!-- ============================================================= -->
      <!-- Test content                                                  -->
      <!-- ============================================================= -->
  <g id="testContent">
    <text x="225" y="50" class="title">
      Test the 'shape-rendering' property
    </text>
  
    <g style="fill:gold;stroke:orange;stroke-width:8">
  
    <circle cx="120" cy="140" r="40" style="shape-rendering:auto"/>
    <circle cx="300" cy="140" r="40" style="shape-rendering:optimizeSpeed"/>
    <circle cx="120" cy="290" r="40" style="shape-rendering:crispEdges"/>
    <circle cx="300" cy="290" r="40" style="shape-rendering:geometricPrecision"/>
    </g>
  
    <g style="font-size:11;fill:black;stroke:none;text-anchor:middle">
    <text x="120" y="204">auto</text>
    <text x="300" y="204">optimizeSpeed</text>
    <text x="120" y="354">crispEdges</text>
    <text x="300" y="354">geometricPrecision</text>
    </g>
  </g>
  
      <!-- ============================================================= -->
      <!-- Batik sample mark                                             -->
      <!-- ============================================================= -->
      <use xlink:href="../batikLogo.svg#Batik_Tag_Box" />
      
  </svg>
  
  
  
  1.1                  xml-batik/samples/tests/text-rendering.svg
  
  Index: text-rendering.svg
  ===================================================================
  <?xml version="1.0" standalone="no"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
  "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
  
  <!-- ========================================================================= -->
  <!-- Copyright (C) The Apache Software Foundation. All rights reserved.        -->
  <!--                                                                           -->
  <!-- This software is published under the terms of the Apache Software License -->
  <!-- version 1.1, a copy of which has been included with this distribution in  -->
  <!-- the LICENSE file.                                                         -->
  <!-- ========================================================================= -->
  
  <!-- ========================================================================= -->
  <!--  Test 'text-rendering' property                                           -->
  <!--                                                                           -->
  <!-- @author tkormann@apache.org                                               -->
  <!-- @version $Id: text-rendering.svg,v 1.1 2001/03/30 11:46:03 tkormann Exp $ -->
  <!-- ========================================================================= -->
  
  <?xml-stylesheet type="text/css" href="test.css" ?>
  
  
  <svg id="body" width="450" height="500" viewBox="0 0 450 500">
  <title>Test the 'text-rendering' property</title>
      <!-- ============================================================= -->
      <!-- Test content                                                  -->
      <!-- ============================================================= -->
  <g id="testContent">
    <text x="225" y="50" class="title">
      Test the 'text-rendering' property
    </text>
  
    <g style="text-anchor:middle;font-size:64;font-weight:bold;fill:gold;stroke:crimson;stroke-width:2">
  
    <text x="120" y="180" style="text-rendering:auto">Batik</text>
    <text x="330" y="180" style="text-rendering:optimizeSpeed">Batik</text>
    <text x="120" y="330" style="text-rendering:optimizeLegibility">Batik</text>
    <text x="330" y="330" style="text-rendering:geometricPrecision">Batik</text>
    </g>
  
    <g style="font-size:11;fill:black;stroke:none;text-anchor:middle">
    <text x="120" y="204">auto</text>
    <text x="330" y="204">optimizeSpeed</text>
    <text x="120" y="354">optimizeLegibility</text>
    <text x="330" y="354">geometricPrecision</text>
    </g>
  </g>
  
      <!-- ============================================================= -->
      <!-- Batik sample mark                                             -->
      <!-- ============================================================= -->
      <use xlink:href="../batikLogo.svg#Batik_Tag_Box" />
      
  </svg>
  
  
  
  1.21      +155 -1    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.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- CSSUtilities.java	2001/03/26 21:27:23	1.20
  +++ CSSUtilities.java	2001/03/30 11:46:04	1.21
  @@ -13,6 +13,7 @@
   import java.awt.Color;
   import java.awt.Composite;
   import java.awt.Paint;
  +import java.awt.RenderingHints;
   import java.awt.Shape;
   import java.awt.Stroke;
   import java.awt.geom.GeneralPath;
  @@ -21,6 +22,9 @@
   import java.net.MalformedURLException;
   import java.net.URL;
   
  +import java.util.Map;
  +import java.util.HashMap;
  +
   import org.apache.batik.css.AbstractViewCSS;
   import org.apache.batik.css.CSSOMReadOnlyStyleDeclaration;
   import org.apache.batik.css.CSSOMReadOnlyValue;
  @@ -62,7 +66,7 @@
    * concrete objects regarding to CSS properties.
    *
    * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
  - * @version $Id: CSSUtilities.java,v 1.20 2001/03/26 21:27:23 deweese Exp $
  + * @version $Id: CSSUtilities.java,v 1.21 2001/03/30 11:46:04 tkormann Exp $
    */
   public abstract class CSSUtilities implements CSSConstants, ErrorConstants {
   
  @@ -162,6 +166,156 @@
           return CSS_LINEARRGB_VALUE.equals(v.getStringValue())
               ? MultipleGradientPaint.LINEAR_RGB
               : MultipleGradientPaint.SRGB;
  +    }
  +
  +    /////////////////////////////////////////////////////////////////////////
  +    // 'color-rendering', 'text-rendering', 'image-rendering', 'shape-rendering'
  +    /////////////////////////////////////////////////////////////////////////
  +
  +    /**
  +     * Returns the rendering hints for the specified shape element or null
  +     * none has been specified. Checks the 'shape-rendering' property.
  +     *
  +     * @param e the element
  +     */
  +    public static Map convertShapeRendering(Element e) {
  +        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
  +        CSSPrimitiveValue v = (CSSPrimitiveValue)
  +            decl.getPropertyCSSValueInternal(CSS_SHAPE_RENDERING_PROPERTY);
  +        String s = v.getStringValue();
  +        if (s.charAt(0) == 'a') { // auto
  +            return null;
  +        }
  +        Map hints = new HashMap();
  +        switch(s.charAt(0)) {
  +        case 'o': // optimizeSpeed
  +            hints.put(RenderingHints.KEY_RENDERING,
  +                      RenderingHints.VALUE_RENDER_SPEED);
  +            hints.put(RenderingHints.KEY_ANTIALIASING,
  +                      RenderingHints.VALUE_ANTIALIAS_OFF);
  +            break;
  +        case 'c': // crispEdges
  +            hints.put(RenderingHints.KEY_RENDERING,
  +                      RenderingHints.VALUE_RENDER_DEFAULT);
  +            hints.put(RenderingHints.KEY_ANTIALIASING,
  +                      RenderingHints.VALUE_ANTIALIAS_OFF);
  +            break;
  +        case 'g': // geometricPrecision
  +            hints.put(RenderingHints.KEY_RENDERING,
  +                      RenderingHints.VALUE_RENDER_QUALITY);
  +            hints.put(RenderingHints.KEY_ANTIALIASING,
  +                      RenderingHints.VALUE_ANTIALIAS_ON);
  +            break;
  +        }
  +        return hints;
  +    }
  +
  +    /**
  +     * Returns the rendering hints for the specified text element or null
  +     * none has been specified. Checks the 'text-rendering' property.
  +     *
  +     * @param e the element
  +     */
  +    public static Map convertTextRendering(Element e) {
  +        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
  +        CSSPrimitiveValue v = (CSSPrimitiveValue)
  +            decl.getPropertyCSSValueInternal(CSS_TEXT_RENDERING_PROPERTY);
  +        String s = v.getStringValue();
  +        if (s.charAt(0) == 'a') { // auto
  +            return null;
  +        }
  +        Map hints = new HashMap();
  +        switch(s.charAt(9)) {
  +        case 'S': // optimizeSpeed
  +            hints.put(RenderingHints.KEY_RENDERING,
  +                      RenderingHints.VALUE_RENDER_SPEED);
  +            hints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
  +                      RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
  +            hints.put(RenderingHints.KEY_FRACTIONALMETRICS,
  +                      RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
  +            break;
  +        case 'L': // optimizeLegibility
  +            hints.put(RenderingHints.KEY_RENDERING,
  +                      RenderingHints.VALUE_RENDER_QUALITY);
  +            hints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
  +                      RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
  +            hints.put(RenderingHints.KEY_FRACTIONALMETRICS,
  +                      RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
  +            break;
  +        case 'c': // geometricPrecision
  +            hints.put(RenderingHints.KEY_RENDERING,
  +                      RenderingHints.VALUE_RENDER_QUALITY);
  +            hints.put(RenderingHints.KEY_TEXT_ANTIALIASING,
  +                      RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT);
  +            hints.put(RenderingHints.KEY_FRACTIONALMETRICS,
  +                      RenderingHints.VALUE_FRACTIONALMETRICS_ON);
  +            break;
  +        }
  +        return hints;
  +    }
  +
  +    /**
  +     * Returns the rendering hints for the specified image element or null
  +     * none has been specified. Checks the 'image-rendering' property.
  +     *
  +     * @param e the element
  +     */
  +    public static Map convertImageRendering(Element e) {
  +        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
  +        CSSPrimitiveValue v = (CSSPrimitiveValue)
  +            decl.getPropertyCSSValueInternal(CSS_IMAGE_RENDERING_PROPERTY);
  +        String s = v.getStringValue();
  +        if (s.charAt(0) == 'a') { // auto
  +            return null;
  +        }
  +        Map hints = new HashMap();
  +        switch(s.charAt(9)) {
  +        case 'S': // optimizeSpeed
  +            hints.put(RenderingHints.KEY_RENDERING,
  +                      RenderingHints.VALUE_RENDER_SPEED);
  +            hints.put(RenderingHints.KEY_INTERPOLATION,
  +                      RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR);
  +            break;
  +        case 'Q': // optimizeQuality
  +            hints.put(RenderingHints.KEY_RENDERING,
  +                      RenderingHints.VALUE_RENDER_QUALITY);
  +            hints.put(RenderingHints.KEY_INTERPOLATION,
  +                      RenderingHints.VALUE_INTERPOLATION_BICUBIC);
  +            break;
  +        }
  +        return hints;
  +    }
  +
  +    /**
  +     * Returns the rendering hints for the specified element or null
  +     * none has been specified. Checks the 'color-rendering' property.
  +     *
  +     * @param e the element
  +     */
  +    public static Map convertColorRendering(Element e) {
  +        CSSOMReadOnlyStyleDeclaration decl = getComputedStyle(e);
  +        CSSPrimitiveValue v = (CSSPrimitiveValue)
  +            decl.getPropertyCSSValueInternal(CSS_COLOR_RENDERING_PROPERTY);
  +        String s = v.getStringValue();
  +        if (s.charAt(0) == 'a') { // auto
  +            return null;
  +        }
  +        Map hints = new HashMap();
  +        switch(v.getStringValue().charAt(9)) {
  +        case 'S': // optimizeSpeed
  +            hints.put(RenderingHints.KEY_COLOR_RENDERING,
  +                      RenderingHints.VALUE_COLOR_RENDER_SPEED);
  +            hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION,
  +                      RenderingHints.VALUE_ALPHA_INTERPOLATION_SPEED);
  +            break;
  +        case 'Q': // optimizeQuality
  +            hints.put(RenderingHints.KEY_COLOR_RENDERING,
  +                      RenderingHints.VALUE_COLOR_RENDER_QUALITY);
  +            hints.put(RenderingHints.KEY_ALPHA_INTERPOLATION,
  +                      RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
  +            break;
  +        }
  +        return hints;
       }
   
       /////////////////////////////////////////////////////////////////////////
  
  
  
  1.9       +9 -1      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.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SVGGElementBridge.java	2001/03/08 12:39:26	1.8
  +++ SVGGElementBridge.java	2001/03/30 11:46:05	1.9
  @@ -8,7 +8,9 @@
   
   package org.apache.batik.bridge;
   
  +import java.awt.RenderingHints;
   import java.awt.geom.Rectangle2D;
  +import java.util.Map;
   
   import org.apache.batik.gvt.CompositeGraphicsNode;
   import org.apache.batik.gvt.GraphicsNode;
  @@ -19,7 +21,7 @@
    * Bridge class for the &lt;g> element.
    *
    * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
  - * @version $Id: SVGGElementBridge.java,v 1.8 2001/03/08 12:39:26 tkormann Exp $
  + * @version $Id: SVGGElementBridge.java,v 1.9 2001/03/30 11:46:05 tkormann Exp $
    */
   public class SVGGElementBridge extends AbstractGraphicsNodeBridge {
   
  @@ -38,6 +40,12 @@
       public GraphicsNode createGraphicsNode(BridgeContext ctx, Element e) {
           CompositeGraphicsNode gn =
               (CompositeGraphicsNode)super.createGraphicsNode(ctx, e);
  +
  +        // 'color-rendering'
  +        Map colorHints = CSSUtilities.convertColorRendering(e);
  +        if (colorHints != null) {
  +            gn.setRenderingHints(new RenderingHints(colorHints));
  +        }
   
           // 'enable-background'
           UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e);
  
  
  
  1.16      +27 -8     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.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- SVGImageElementBridge.java	2001/03/26 21:27:25	1.15
  +++ SVGImageElementBridge.java	2001/03/30 11:46:06	1.16
  @@ -8,6 +8,7 @@
   
   package org.apache.batik.bridge;
   
  +import java.awt.RenderingHints;
   import java.awt.Shape;
   import java.awt.color.ColorSpace;
   import java.awt.color.ICC_Profile;
  @@ -16,6 +17,7 @@
   import java.io.IOException;
   import java.net.MalformedURLException;
   import java.net.URL;
  +import java.util.Map;
   
   import org.apache.batik.dom.svg.SVGOMDocument;
   import org.apache.batik.dom.util.XLinkSupport;
  @@ -43,7 +45,7 @@
    * Bridge class for the &lt;image> element.
    *
    * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
  - * @version $Id: SVGImageElementBridge.java,v 1.15 2001/03/26 21:27:25 deweese Exp $
  + * @version $Id: SVGImageElementBridge.java,v 1.16 2001/03/30 11:46:06 tkormann Exp $
    */
   public class SVGImageElementBridge extends AbstractGraphicsNodeBridge {
   
  @@ -114,6 +116,23 @@
               throw new BridgeException(e, ERR_URI_IMAGE_INVALID,
                                         new Object[] {uriStr});
           }
  +
  +        // 'image-rendering' and 'color-rendering'
  +        Map imageHints = CSSUtilities.convertImageRendering(e);
  +        Map colorHints = CSSUtilities.convertColorRendering(e);
  +        if (imageHints != null || colorHints != null) {
  +            RenderingHints hints;
  +            if (imageHints == null) {
  +                hints = new RenderingHints(colorHints);
  +            } else if (colorHints == null) {
  +                hints = new RenderingHints(imageHints);
  +            } else {
  +                hints = new RenderingHints(imageHints);
  +                hints.putAll(colorHints);
  +            }
  +            node.setRenderingHints(hints);
  +        }
  +
           imageNode.setImage(node);
           return imageNode;
       }
  @@ -196,16 +215,16 @@
           }
   
           Rectangle2D bounds = getImageBounds(ctx, element);
  -        svgElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE, 
  +        svgElement.setAttributeNS(null, SVG_WIDTH_ATTRIBUTE,
                                     String.valueOf(bounds.getWidth()));
  -        svgElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE, 
  -                                  String.valueOf(bounds.getHeight())); 
  +        svgElement.setAttributeNS(null, SVG_HEIGHT_ATTRIBUTE,
  +                                  String.valueOf(bounds.getHeight()));
   
           AffineTransform at
  -            = ViewBox.getPreserveAspectRatioTransform(svgElement, 
  -                                                      (float)bounds.getWidth(), 
  +            = ViewBox.getPreserveAspectRatioTransform(svgElement,
  +                                                      (float)bounds.getWidth(),
                                                         (float)bounds.getHeight());
  -        at.preConcatenate(AffineTransform.getTranslateInstance(bounds.getX(), 
  +        at.preConcatenate(AffineTransform.getTranslateInstance(bounds.getX(),
                                                                  bounds.getY()));
           result.setTransform(at);
   
  @@ -214,7 +233,7 @@
   
           /*
           // resolve x, y, width, height and preserveAspectRatio on image
  -        
  +
           Rectangle2D bounds = getImageBounds(ctx, element);
           float x = (float)bounds.getX();
           float y = (float)bounds.getY();
  
  
  
  1.10      +19 -1     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.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SVGShapeElementBridge.java	2001/03/08 12:39:29	1.9
  +++ SVGShapeElementBridge.java	2001/03/30 11:46:06	1.10
  @@ -8,6 +8,9 @@
   
   package org.apache.batik.bridge;
   
  +import java.awt.RenderingHints;
  +import java.util.Map;
  +
   import org.apache.batik.gvt.GraphicsNode;
   import org.apache.batik.gvt.ShapeNode;
   import org.apache.batik.gvt.ShapePainter;
  @@ -18,7 +21,7 @@
    * The base bridge class for shapes. Subclasses bridge <tt>ShapeNode</tt>.
    *
    * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
  - * @version $Id: SVGShapeElementBridge.java,v 1.9 2001/03/08 12:39:29 tkormann Exp $
  + * @version $Id: SVGShapeElementBridge.java,v 1.10 2001/03/30 11:46:06 tkormann Exp $
    */
   public abstract class SVGShapeElementBridge extends AbstractGraphicsNodeBridge {
   
  @@ -39,6 +42,21 @@
           ShapeNode shapeNode = (ShapeNode)super.createGraphicsNode(ctx, e);
           // delegates to subclasses the shape construction
           buildShape(ctx, e, shapeNode);
  +        // 'shape-rendering' and 'color-rendering'
  +        Map shapeHints = CSSUtilities.convertShapeRendering(e);
  +        Map colorHints = CSSUtilities.convertColorRendering(e);
  +        if (shapeHints != null || colorHints != null) {
  +            RenderingHints hints;
  +            if (shapeHints == null) {
  +                hints = new RenderingHints(colorHints);
  +            } else if (colorHints == null) {
  +                hints = new RenderingHints(shapeHints);
  +            } else {
  +                hints = new RenderingHints(shapeHints);
  +                hints.putAll(colorHints);
  +            }
  +            shapeNode.setRenderingHints(hints);
  +        }
           return shapeNode;
       }
   
  
  
  
  1.18      +18 -1     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.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SVGTextElementBridge.java	2001/03/26 09:45:05	1.17
  +++ SVGTextElementBridge.java	2001/03/30 11:46:07	1.18
  @@ -13,6 +13,7 @@
   import java.awt.GraphicsEnvironment;
   import java.awt.Paint;
   import java.awt.RenderingHints;
  +import java.awt.RenderingHints;
   import java.awt.Shape;
   import java.awt.Stroke;
   import java.awt.font.TextAttribute;
  @@ -52,7 +53,7 @@
    * Bridge class for the &lt;text> element.
    *
    * @author <a href="bill.haneman@ireland.sun.com>Bill Haneman</a>
  - * @version $Id: SVGTextElementBridge.java,v 1.17 2001/03/26 09:45:05 tkormann Exp $
  + * @version $Id: SVGTextElementBridge.java,v 1.18 2001/03/30 11:46:07 tkormann Exp $
    */
   public class SVGTextElementBridge implements GraphicsNodeBridge,
                                                CSSConstants,
  @@ -82,6 +83,22 @@
           }
           // 'visibility'
           node.setVisible(CSSUtilities.convertVisibility(e));
  +
  +        // 'text-rendering' and 'color-rendering'
  +        Map textHints = CSSUtilities.convertTextRendering(e);
  +        Map colorHints = CSSUtilities.convertColorRendering(e);
  +        if (textHints != null || colorHints != null) {
  +            RenderingHints hints;
  +            if (textHints == null) {
  +                hints = new RenderingHints(colorHints);
  +            } else if (colorHints == null) {
  +                hints = new RenderingHints(textHints);
  +            } else {
  +                hints = new RenderingHints(textHints);
  +                hints.putAll(colorHints);
  +            }
  +            node.setRenderingHints(hints);
  +        }
   
           UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e);
   
  
  
  
  1.5       +12 -3     xml-batik/sources/org/apache/batik/bridge/URIResolver.java
  
  Index: URIResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/URIResolver.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- URIResolver.java	2001/03/08 12:39:31	1.4
  +++ URIResolver.java	2001/03/30 11:46:08	1.5
  @@ -25,7 +25,7 @@
    * This class is used to resolve the URI that can be found in a SVG document.
    *
    * @author <a href="mailto:stephane@hillion.org">Stephane Hillion</a>
  - * @version $Id: URIResolver.java,v 1.4 2001/03/08 12:39:31 tkormann Exp $
  + * @version $Id: URIResolver.java,v 1.5 2001/03/30 11:46:08 tkormann Exp $
    */
   public class URIResolver {
       /**
  @@ -50,7 +50,6 @@
        */
       public URIResolver(SVGDocument doc, DocumentLoader dl) {
           document = (SVGOMDocument)doc;
  -        documentURI = doc.getURL();
           documentLoader = dl;
       }
   
  @@ -76,17 +75,27 @@
        */
       public Node getNode(String uri)
           throws MalformedURLException, IOException {
  +
  +        if (uri.startsWith("#")) {
  +            return document.getElementById(uri.substring(1));
  +        }
  +
  +        if (documentURI == null)
  +            documentURI = document.getURL();
  +
           if (documentURI.equals(uri)) {
               return document;
           }
           if (uri.startsWith(documentURI) &&
               uri.length() > documentURI.length() + 1 &&
  -                uri.charAt(documentURI.length()) == '#') {
  +            uri.charAt(documentURI.length()) == '#') {
               uri = uri.substring(documentURI.length());
           }
  +
           if (uri.startsWith("#")) {
               return document.getElementById(uri.substring(1));
           }
  +
           URL url = new URL(((SVGOMDocument)document).getURLObject(), uri);
           Document doc = documentLoader.loadDocument(url.toString());
           documentLoader.dispose(doc);
  
  
  

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