xmlgraphics-batik-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tkorm...@apache.org
Subject cvs commit: xml-batik/sources/org/apache/batik/bridge SVGImageElementBridge.java
Date Wed, 12 Jun 2002 07:48:01 GMT
tkormann    2002/06/12 00:48:01

  Modified:    sources/org/apache/batik/bridge SVGImageElementBridge.java
  Added:       samples/tests/spec/scripting imageRendering.svg
  Log:
  add support for image-rendering in dynamic. The feature still has a
  bug. I think this is due to the bitmap image cache. I will send a bug
  report to thomas.
  
  Revision  Changes    Path
  1.1                  xml-batik/samples/tests/spec/scripting/imageRendering.svg
  
  Index: imageRendering.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 (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.                                      -->
  <!-- ====================================================================== -->
  
  <!-- ====================================================================== -->
  <!-- append child test                                                      -->
  <!--                                                                        -->
  <!-- @author tkormann@ilog.fr                                               -->
  <!-- @version $Id: imageRendering.svg,v 1.1 2002/06/12 07:48:01 tkormann Exp $ -->
  <!-- ====================================================================== -->
  
  <?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>  
  
  <svg xmlns="http://www.w3.org/2000/svg" 
       xmlns:xlink="http://www.w3.org/1999/xlink"
       id="body" width="450" height="500" viewBox="0 0 450 500">
  
      <title>'image-rendering' property test</title>
  
      <text x="50%" y="45" class="title">'image-rendering' property test</text>
  
      <script type="text/ecmascript">
  
      var speed = true;
  
      function changeImageRendering(evt) {
         var imageRendering;
         if (speed) {
             speed = false;
             imageRendering = "optimizeQuality";
         } else {
             speed = true;
             imageRendering = "optimizeSpeed";
         }
         evt.target.setAttribute("style", "image-rendering:"+imageRendering);
      }
  
      </script>
  
      <g id="test-content">
  <image onclick="changeImageRendering(evt)" 
         x="120" y="150" 
         width="200" height="100" 
         preserveAspectRatio="none"
         xlink:href="../../resources/images/tde.jpg" 
         style="image-rendering:optimizeSpeed" />
      </g>
  </svg>
  
  
  
  1.47      +20 -2     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.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- SVGImageElementBridge.java	25 May 2002 18:26:34 -0000	1.46
  +++ SVGImageElementBridge.java	12 Jun 2002 07:48:01 -0000	1.47
  @@ -238,7 +238,25 @@
   	    super.handleDOMAttrModifiedEvent(evt);
   	}
       }
  -    
  +
  +    /**
  +     * Invoked for each CSS property that has changed.
  +     */
  +    protected void handleCSSPropertyChanged(int property) {
  +        switch(property) {
  +        case SVGCSSEngine.IMAGE_RENDERING_INDEX:
  +        case SVGCSSEngine.COLOR_INTERPOLATION_INDEX:
  +            RenderingHints hints = CSSUtilities.convertImageRendering(e, null);
  +            hints = CSSUtilities.convertColorRendering(e, hints);
  +            if (hints != null) {
  +                node.setRenderingHints(hints);
  +            }
  +            break;
  +        default:
  +            super.handleCSSPropertyChanged(property);
  +        }
  +    }
  +
       // convenient methods //////////////////////////////////////////////////
   
       /**
  
  
  

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


Mime
View raw message