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:41:53 UTC

svn commit: r230428 - in /xmlgraphics/batik/branches/svg11/sources/org/apache/batik: bridge/ ext/awt/image/spi/

Author: deweese
Date: Fri Aug  5 03:41:39 2005
New Revision: 230428

URL: http://svn.apache.org/viewcvs?rev=230428&view=rev
Log:
1) Fixed raster images under JDK 1.5.0

Modified:
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/CursorManager.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/SVGImageElementBridge.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/BrokenLinkProvider.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java
    xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java

Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/CursorManager.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/CursorManager.java?rev=230428&r1=230427&r2=230428&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/CursorManager.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/CursorManager.java Fri Aug  5 03:41:39 2005
@@ -504,8 +504,7 @@
             }
 
             // Check if we got a broken image
-            if (filter.getProperty
-                (BrokenLinkProvider.BROKEN_LINK_PROPERTY) != null) {
+            if (BrokenLinkProvider.hasBrokenLinkProperty(filter)) {
                 return null;
             } 
             

Modified: xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/SVGImageElementBridge.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/SVGImageElementBridge.java?rev=230428&r1=230427&r2=230428&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/SVGImageElementBridge.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/bridge/SVGImageElementBridge.java Fri Aug  5 03:41:39 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/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/BrokenLinkProvider.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/BrokenLinkProvider.java?rev=230428&r1=230427&r2=230428&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/BrokenLinkProvider.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/BrokenLinkProvider.java Fri Aug  5 03:41:39 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/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java?rev=230428&r1=230427&r2=230428&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/DefaultBrokenLinkProvider.java Fri Aug  5 03:41:39 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/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java
URL: http://svn.apache.org/viewcvs/xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java?rev=230428&r1=230427&r2=230428&view=diff
==============================================================================
--- xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java (original)
+++ xmlgraphics/batik/branches/svg11/sources/org/apache/batik/ext/awt/image/spi/ImageTagRegistry.java Fri Aug  5 03:41:39 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;
                 }
@@ -203,7 +202,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 +229,7 @@
         Iterator i = entries.iterator();
         while (i.hasNext()) {
             RegistryEntry re = (RegistryEntry)i.next();
+            
             if (! (re instanceof StreamRegistryEntry))
                 continue;
             StreamRegistryEntry sre = (StreamRegistryEntry)re;
@@ -249,7 +249,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;