You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by de...@apache.org on 2005/08/05 12:43:39 UTC

svn commit: r230434 - in /xmlgraphics/batik/trunk: samples/tests/spec/text/ sources/org/apache/batik/bridge/ sources/org/apache/batik/ext/awt/image/spi/

Author: deweese
Date: Fri Aug  5 03:43:19 2005
New Revision: 230434

URL: http://svn.apache.org/viewcvs?rev=230434&view=rev
Log:
1) Fixed raster images under JDK 1.5.0
2) Added test file

Added:
    xmlgraphics/batik/trunk/samples/tests/spec/text/textBiDi2.svg   (with props)
Modified:
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/CursorManager.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/BrokenLinkProvider.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java
    xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java

Added: xmlgraphics/batik/trunk/samples/tests/spec/text/textBiDi2.svg
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/samples/tests/spec/text/textBiDi2.svg?rev=230434&view=auto
==============================================================================
--- xmlgraphics/batik/trunk/samples/tests/spec/text/textBiDi2.svg (added)
+++ xmlgraphics/batik/trunk/samples/tests/spec/text/textBiDi2.svg Fri Aug  5 03:43:19 2005
@@ -0,0 +1,57 @@
+<?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 2001-2003,2005  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 mixing text directions with X/Y attrs.                            -->
+<!--                                                                        -->
+<!-- @author deweese@apache.org                                             -->
+<!-- @version $Id: textBiDi.svg 201374 2004-08-18 07:17:26Z vhardy $        -->
+<!-- ====================================================================== -->
+<?xml-stylesheet type="text/css" href="../../resources/style/test.css" ?>
+
+<svg width="450" height="500" viewBox="0 0 450 500"
+     xmlns="http://www.w3.org/2000/svg" 
+     xmlns:xlink="http://www.w3.org/1999/xlink" >
+    <!-- ============================================================= -->
+    <!-- Test content                                                  -->
+    <!-- ============================================================= -->
+
+    <g id="testContent">
+        <text class="title" x="50%" y="10%" font-size="15" text-anchor="middle" >
+            BiDi Text / International Text 2</text>
+
+      <g font-family="dialog" font-size="15" text-anchor="start">
+        <text id="HE" fill="DarkOliveGreen" x="40" y="110"
+         >&#x5d0;&#x5d1;&#x5d2; ABC</text>
+        <text id="EH" fill="DarkOliveGreen" x="225" y="110"
+         >ABC &#x5d0;&#x5d1;&#x5d2;</text>
+        <text id="EHE" fill="DarkOliveGreen" x="40" y="140"
+         >ABC &#x5d0;&#x5d1;&#x5d2; ABC</text>
+        <text id="HEH" fill="DarkOliveGreen" x="225" y="140"
+         >&#x5d0;&#x5d1;&#x5d2;&#x5d3; ABCD &#x5d0;&#x5d1;&#x5d2;&#x5d3;</text>
+      </g>
+   </g>
+    <!-- ============================================================= -->
+    <!-- Batik sample mark                                             -->
+    <!-- ============================================================= -->
+    <use xlink:href="../../../batikLogo.svg#Batik_Tag_Box" />
+    
+</svg>

Propchange: xmlgraphics/batik/trunk/samples/tests/spec/text/textBiDi2.svg
------------------------------------------------------------------------------
    svn:executable = *

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/CursorManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/CursorManager.java?rev=230434&r1=230433&r2=230434&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/CursorManager.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/CursorManager.java Fri Aug  5 03:43:19 2005
@@ -504,9 +504,7 @@
             }
 
             // Check if we got a broken image
-            Object prop = filter.getProperty
-                (BrokenLinkProvider.BROKEN_LINK_PROPERTY);
-            if (prop != null) {
+            if (BrokenLinkProvider.hasBrokenLinkProperty(filter)) {
                 return null;
             } 
             

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java?rev=230434&r1=230433&r2=230434&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/bridge/SVGImageElementBridge.java Fri Aug  5 03:43:19 2005
@@ -552,11 +552,11 @@
             return sn;
         }
 
-        Object obj = img.getProperty(BrokenLinkProvider.BROKEN_LINK_PROPERTY);
-        if (obj != null) {
+        if (BrokenLinkProvider.hasBrokenLinkProperty(img)) {
+            Object o=img.getProperty(BrokenLinkProvider.BROKEN_LINK_PROPERTY);
             String msg = "unknown";
-            if (obj instanceof String)
-                msg = (String)obj;
+            if (o instanceof String)
+                msg = (String)o;
             SVGDocument doc = ctx.getUserAgent().getBrokenLinkDocument
                 (e, purl.toString(), msg);
             return createSVGImageNode(ctx, e, doc);

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/BrokenLinkProvider.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/BrokenLinkProvider.java?rev=230434&r1=230433&r2=230434&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/BrokenLinkProvider.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/BrokenLinkProvider.java Fri Aug  5 03:43:19 2005
@@ -17,6 +17,8 @@
  */
 package org.apache.batik.ext.awt.image.spi;
 
+import java.awt.Image;
+
 import org.apache.batik.ext.awt.image.renderable.Filter;
 
 /**
@@ -24,7 +26,7 @@
  * generating a placeholder image when the ImageTagRegistry
  * fails to handle a given reference.
  */
-public interface BrokenLinkProvider {
+public abstract class BrokenLinkProvider {
 
     /**
      * The image returned by getBrokenLinkImage should always
@@ -50,6 +52,14 @@
      *             be taken from ErrorConstants.
      * @param params This is more detailed information about
      *        the circumstances of the failure.  */
-    public Filter getBrokenLinkImage(Object base,
-                                     String code, Object[] params);
+    public abstract Filter getBrokenLinkImage(Object base,
+                                              String code, Object[] params);
+
+    public static boolean hasBrokenLinkProperty(Filter f) {
+        Object o = f.getProperty(BROKEN_LINK_PROPERTY);
+        if (o == null) return false;
+        if (o == Image.UndefinedProperty) return false;
+        return true;
+    }
+
 }

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java?rev=230434&r1=230433&r2=230434&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java Fri Aug  5 03:43:19 2005
@@ -28,7 +28,7 @@
 import org.apache.batik.i18n.LocalizableSupport;
 
 public class DefaultBrokenLinkProvider 
-    implements BrokenLinkProvider {
+    extends BrokenLinkProvider {
 
     static Filter brokenLinkImg = null;
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java?rev=230434&r1=230433&r2=230434&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java Fri Aug  5 03:43:19 2005
@@ -135,14 +135,13 @@
         i = entries.iterator();
         while (i.hasNext()) {
             RegistryEntry re = (RegistryEntry)i.next();
-
             if (re instanceof URLRegistryEntry) {
                 if ((purl == null) || !allowOpenStream) continue;
 
                 URLRegistryEntry ure = (URLRegistryEntry)re;
                 if (ure.isCompatibleURL(purl)) {
                     ret = ure.handleURL(purl, needRawData);
-
+                    
                     // Check if we got an image.
                     if (ret != null) break;
                 }
@@ -163,6 +162,7 @@
                         try {
                             is = purl.openStream(mimeTypes.iterator());
                         } catch(IOException ioe) {
+                            ioe.printStackTrace();
                             // Couldn't open the stream, go to next entry.
                             openFailed = true;
                             continue;
@@ -203,7 +203,7 @@
             return getBrokenLinkImage(this, ERR_URL_UNINTERPRETABLE, null);
         }
 
-        if (ret.getProperty(BrokenLinkProvider.BROKEN_LINK_PROPERTY) != null) {
+        if (BrokenLinkProvider.hasBrokenLinkProperty(ret)) {
             // Don't Return Broken link image unless requested
             return (returnBrokenLink)?ret:null;
         }
@@ -230,6 +230,7 @@
         Iterator i = entries.iterator();
         while (i.hasNext()) {
             RegistryEntry re = (RegistryEntry)i.next();
+            
             if (! (re instanceof StreamRegistryEntry))
                 continue;
             StreamRegistryEntry sre = (StreamRegistryEntry)re;
@@ -249,7 +250,7 @@
             return getBrokenLinkImage(this, ERR_STREAM_UNREADABLE, null);
 
         if ((colorSpace != null) &&
-            (ret.getProperty(BrokenLinkProvider.BROKEN_LINK_PROPERTY) == null))
+            (!BrokenLinkProvider.hasBrokenLinkProperty(ret)))
             ret = new ProfileRable(ret, colorSpace);
 
         return ret;