incubator-flex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cframp...@apache.org
Subject svn commit: r1402274 [31/31] - in /incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext: ./ awt/ awt/color/ awt/font/ awt/g2d/ awt/geom/ awt/image/ awt/image/codec/ awt/image/codec/jpeg/ awt/image/codec/p...
Date Thu, 25 Oct 2012 19:01:49 GMT
Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ErrorConstants.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ErrorConstants.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ErrorConstants.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ErrorConstants.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,84 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image.spi;
+
+/**
+ * The built in error codes.
+ *
+ * @author <a href="mailto:thomas.deweese@kodak.com">Thomas DeWeese</a>
+ * @version $Id: ErrorConstants.java 478276 2006-11-22 18:33:37Z dvholten $
+ */
+public interface ErrorConstants {
+
+    /**
+     * The error messages bundle class name.
+     */
+    String RESOURCES =
+        "org.apache.flex.forks.batik.ext.awt.image.spi.resources.Messages";
+
+
+    /**
+     * The error code when a stream is unreadable (corrupt or unsupported).
+     */
+    String ERR_STREAM_UNREADABLE
+        = "stream.unreadable";
+
+    /**
+     * The error code when a url of a particular format is unreadable
+     * (corrupt).
+     * <pre>
+     * {0} = the format that couldn't be read.
+     * </pre>
+     */
+    String ERR_STREAM_FORMAT_UNREADABLE
+        = "stream.format.unreadable";
+
+    /**
+     * The error code when the data in the  url is uninterpretable by this
+     * software (meaning it's corrupt or an unsupported format of some sort).
+     * <pre>
+     * {0} = the ParsedURL that couldn't be read.
+     * </pre>
+     */
+    String ERR_URL_UNINTERPRETABLE
+        = "url.uninterpretable";
+
+    /**
+     * The error code when a url is unreachable (ussually bad URL,
+     * or server is down).
+     * <pre>
+     * {0} = the ParsedURL that couldn't be read.
+     * </pre>
+     */
+    String ERR_URL_UNREACHABLE
+        = "url.unreachable";
+
+
+    /**
+     * The error code when a url of a particular format is unreadable
+     * (corrupt).
+     * <pre>
+     * {0} = the format that couldn't be read.
+     * {1} = the ParsedURL for file.
+     * </pre>
+     */
+    String ERR_URL_FORMAT_UNREADABLE
+        = "url.format.unreadable";
+
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ErrorConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageTagRegistry.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageTagRegistry.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageTagRegistry.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageTagRegistry.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,372 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image.spi;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StreamCorruptedException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+
+import org.apache.flex.forks.batik.ext.awt.color.ICCColorSpaceExt;
+import org.apache.flex.forks.batik.ext.awt.image.URLImageCache;
+import org.apache.flex.forks.batik.ext.awt.image.renderable.Filter;
+import org.apache.flex.forks.batik.ext.awt.image.renderable.ProfileRable;
+import org.apache.flex.forks.batik.util.ParsedURL;
+import org.apache.flex.forks.batik.util.Service;
+
+/**
+ * This class handles the registered Image tag handlers.  These are
+ * instances of RegistryEntry in this package.
+ *
+ * @author <a href="mailto:Thomas.DeWeeese@Kodak.com">Thomas DeWeese</a>
+ * @version $Id: ImageTagRegistry.java 478276 2006-11-22 18:33:37Z dvholten $
+ */
+public class ImageTagRegistry implements ErrorConstants {
+
+    List entries    = new LinkedList();
+    List extensions = null;
+    List mimeTypes  = null;
+
+    URLImageCache rawCache;
+    URLImageCache imgCache;
+
+    public ImageTagRegistry() {
+        this(null, null);
+    }
+
+    public ImageTagRegistry(URLImageCache rawCache, URLImageCache imgCache) {
+        if (rawCache == null)
+            rawCache = new URLImageCache();
+        if (imgCache == null)
+            imgCache = new URLImageCache();
+
+        this.rawCache= rawCache;
+        this.imgCache= imgCache;
+    }
+
+    /** Removes all decoded raster images from the cache.
+     *  All Images will be reloaded from the original source
+     *  if decoded again.
+     */
+    public void flushCache() {
+        rawCache.flush();
+        imgCache.flush();
+    }
+
+    /** Removes the given URL from the cache.  Only the Image
+     *  associated with that URL will be removed from the cache.
+     */
+    public void flushImage(ParsedURL purl) {
+        rawCache.clear(purl);
+        imgCache.clear(purl);
+    }
+
+    public Filter checkCache(ParsedURL purl, ICCColorSpaceExt colorSpace) {
+        // I just realized that this whole thing could
+        boolean needRawData = (colorSpace != null);
+
+        Filter      ret        = null;
+        URLImageCache cache;
+        if (needRawData) cache = rawCache;
+        else             cache = imgCache;
+
+        ret = cache.request(purl);
+        if (ret == null) {
+            cache.clear(purl);
+            return null;
+        }
+
+        // System.out.println("Image came from cache" + purl);
+        if (colorSpace != null)
+            ret = new ProfileRable(ret, colorSpace);
+        return ret;
+    }
+
+    public Filter readURL(ParsedURL purl) {
+        return readURL(null, purl, null, true, true);
+    }
+
+    public Filter readURL(ParsedURL purl, ICCColorSpaceExt colorSpace) {
+        return readURL(null, purl, colorSpace, true, true);
+    }
+
+    public Filter readURL(InputStream is, ParsedURL purl,
+                          ICCColorSpaceExt colorSpace,
+                          boolean allowOpenStream,
+                          boolean returnBrokenLink) {
+        if ((is != null) && !is.markSupported())
+            // Doesn't support mark so wrap with
+            // BufferedInputStream that does.
+            is = new BufferedInputStream(is);
+
+        // I just realized that this whole thing could
+        boolean needRawData = (colorSpace != null);
+
+        Filter      ret     = null;
+        URLImageCache cache = null;
+
+        if (purl != null) {
+            if (needRawData) cache = rawCache;
+            else             cache = imgCache;
+
+            ret = cache.request(purl);
+            if (ret != null) {
+                // System.out.println("Image came from cache" + purl);
+                if (colorSpace != null)
+                    ret = new ProfileRable(ret, colorSpace);
+                return ret;
+            }
+        }
+        // System.out.println("Image didn't come from cache: " + purl);
+
+        boolean     openFailed = false;
+        List mimeTypes = getRegisteredMimeTypes();
+
+        Iterator i;
+        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;
+                }
+                continue;
+            }
+
+            if (re instanceof StreamRegistryEntry) {
+                StreamRegistryEntry sre = (StreamRegistryEntry)re;
+                // Quick out last time the open didn't work for this
+                // URL so don't try again...
+                if (openFailed) continue;
+
+                try {
+                    if (is == null) {
+                        // Haven't opened the stream yet let's try.
+                        if ((purl == null) || !allowOpenStream)
+                            break;  // No purl nothing we can do...
+                        try {
+                            is = purl.openStream(mimeTypes.iterator());
+                        } catch(IOException ioe) {
+                            // Couldn't open the stream, go to next entry.
+                            openFailed = true;
+                            continue;
+                        }
+
+                        if (!is.markSupported())
+                            // Doesn't support mark so wrap with
+                            // BufferedInputStream that does.
+                            is = new BufferedInputStream(is);
+                    }
+
+                    if (sre.isCompatibleStream(is)) {
+                        ret = sre.handleStream(is, purl, needRawData);
+                        if (ret != null) break;
+                    }
+                } catch (StreamCorruptedException sce) {
+                    // Stream is messed up so setup to reopen it..
+                    is = null;
+                }
+                continue;
+            }
+        }
+
+        if (cache != null)
+            cache.put(purl, ret);
+
+        if (ret == null) {
+            if (!returnBrokenLink)
+                return null;
+            if (openFailed)
+                // Technially it's possible that it's an unknown
+                // 'protocol that caused the open to fail but probably
+                // it's a bad URL...
+                return getBrokenLinkImage(this, ERR_URL_UNREACHABLE, null);
+
+            // We were able to get to the data we just couldn't
+            // make sense of it...
+            return getBrokenLinkImage(this, ERR_URL_UNINTERPRETABLE, null);
+        }
+
+        if (BrokenLinkProvider.hasBrokenLinkProperty(ret)) {
+            // Don't Return Broken link image unless requested
+            return (returnBrokenLink)?ret:null;
+        }
+
+        if (colorSpace != null)
+            ret = new ProfileRable(ret, colorSpace);
+
+        return ret;
+    }
+
+    public Filter readStream(InputStream is) {
+        return readStream(is, null);
+    }
+
+    public Filter readStream(InputStream is, ICCColorSpaceExt colorSpace) {
+        if (!is.markSupported())
+            // Doesn't support mark so wrap with BufferedInputStream that does.
+            is = new BufferedInputStream(is);
+
+        boolean needRawData = (colorSpace != null);
+
+        Filter ret = null;
+
+        Iterator i = entries.iterator();
+        while (i.hasNext()) {
+            RegistryEntry re = (RegistryEntry)i.next();
+
+            if (! (re instanceof StreamRegistryEntry))
+                continue;
+            StreamRegistryEntry sre = (StreamRegistryEntry)re;
+
+            try {
+                if (sre.isCompatibleStream(is)) {
+                    ret = sre.handleStream(is, null, needRawData);
+
+                    if (ret != null) break;
+                }
+            } catch (StreamCorruptedException sce) {
+                break;
+            }
+        }
+
+        if (ret == null)
+            return getBrokenLinkImage(this, ERR_STREAM_UNREADABLE, null);
+
+        if ((colorSpace != null) &&
+            (!BrokenLinkProvider.hasBrokenLinkProperty(ret)))
+            ret = new ProfileRable(ret, colorSpace);
+
+        return ret;
+    }
+
+    public synchronized void register(RegistryEntry newRE) {
+        float priority = newRE.getPriority();
+
+        ListIterator li;
+        li = entries.listIterator();
+        while (li.hasNext()) {
+            RegistryEntry re = (RegistryEntry)li.next();
+            if (re.getPriority() > priority) {
+                li.previous();
+                li.add(newRE);
+                return;
+            }
+        }
+        li.add(newRE);
+        extensions = null;
+        mimeTypes = null;
+    }
+
+    /**
+     * Returns a List that contains String of all the extensions that
+     * can be handleded by the various registered image format
+     * handlers.
+     */
+    public synchronized List getRegisteredExtensions() {
+        if (extensions != null)
+            return extensions;
+
+        extensions = new LinkedList();
+        Iterator iter = entries.iterator();
+        while(iter.hasNext()) {
+            RegistryEntry re = (RegistryEntry)iter.next();
+            extensions.addAll(re.getStandardExtensions());
+        }
+        extensions = Collections.unmodifiableList(extensions);
+        return extensions;
+    }
+
+    /**
+     * Returns a List that contains String of all the mime types that
+     * can be handleded by the various registered image format
+     * handlers.
+     */
+    public synchronized List getRegisteredMimeTypes() {
+        if (mimeTypes != null)
+            return mimeTypes;
+
+        mimeTypes = new LinkedList();
+        Iterator iter = entries.iterator();
+        while(iter.hasNext()) {
+            RegistryEntry re = (RegistryEntry)iter.next();
+            mimeTypes.addAll(re.getMimeTypes());
+        }
+        mimeTypes = Collections.unmodifiableList(mimeTypes);
+        return mimeTypes;
+    }
+
+    static ImageTagRegistry registry = null;
+
+    public static synchronized ImageTagRegistry getRegistry() {
+        if (registry != null)
+            return registry;
+
+        registry = new ImageTagRegistry();
+
+        //registry.register(new PNGRegistryEntry());
+        //registry.register(new TIFFRegistryEntry());
+        //registry.register(new JPEGRegistryEntry());
+        registry.register(new JDKRegistryEntry());
+
+        Iterator iter = Service.providers(RegistryEntry.class);
+        while (iter.hasNext()) {
+            RegistryEntry re = (RegistryEntry)iter.next();
+            // System.out.println("RE: " + re);
+            registry.register(re);
+        }
+
+        return registry;
+    }
+
+    static BrokenLinkProvider defaultProvider
+        = new DefaultBrokenLinkProvider();
+
+    static BrokenLinkProvider brokenLinkProvider = null;
+
+    public static synchronized Filter
+        getBrokenLinkImage(Object base, String code, Object [] params) {
+        Filter ret = null;
+        if (brokenLinkProvider != null)
+            ret = brokenLinkProvider.getBrokenLinkImage(base, code, params);
+
+        if (ret == null)
+            ret = defaultProvider.getBrokenLinkImage(base, code, params);
+
+        return ret;
+    }
+
+
+    public static synchronized void
+        setBrokenLinkProvider(BrokenLinkProvider provider) {
+        brokenLinkProvider = provider;
+    }
+}
+

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageTagRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriter.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriter.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriter.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriter.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,41 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image.spi;
+
+import java.awt.image.RenderedImage;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Interface which allows image library independent image writing.
+ *
+ * @version $Id: ImageWriter.java 478276 2006-11-22 18:33:37Z dvholten $
+ */
+public interface ImageWriter {
+
+    void writeImage(RenderedImage image, OutputStream out)
+            throws IOException;
+
+    void writeImage(RenderedImage image, OutputStream out,
+            ImageWriterParams params)
+            throws IOException;
+
+    String getMIMEType();
+
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriterParams.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriterParams.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriterParams.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriterParams.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,94 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image.spi;
+
+/**
+ * Parameters for the encoder which is accessed through the
+ * ImageWriter interface.
+ *
+ * @version $Id: ImageWriterParams.java 582434 2007-10-06 02:11:51Z cam $
+ */
+public class ImageWriterParams {
+    
+    private Integer resolution;
+    private Float jpegQuality;
+    private Boolean jpegForceBaseline;
+    private String compressionMethod;
+    
+    /**
+     * Default constructor.
+     */
+    public ImageWriterParams() {
+        //nop
+    }
+
+    /**
+     * @return the image resolution in dpi, or null if undefined
+     */
+    public Integer getResolution() {
+        return this.resolution;
+    }
+    
+    /**
+     * @return the quality value for encoding a JPEG image 
+     *          (0.0-1.0), or null if undefined
+     */
+    public Float getJPEGQuality() {
+        return this.jpegQuality;
+    }
+    
+    /**
+     * @return true if the baseline quantization table is forced, 
+     *          or null if undefined.
+     */
+    public Boolean getJPEGForceBaseline() {
+        return this.jpegForceBaseline;
+    }
+    
+    /** @return the compression method for encoding the image */
+    public String getCompressionMethod() {
+        return this.compressionMethod;
+    }
+    
+    /**
+     * Sets the target resolution of the bitmap image to be written.
+     * @param dpi the resolution in dpi
+     */
+    public void setResolution(int dpi) {
+        this.resolution = new Integer(dpi);
+    }
+    
+    /**
+     * Sets the quality setting for encoding JPEG images.
+     * @param quality the quality setting (0.0-1.0)
+     * @param forceBaseline force baseline quantization table
+     */
+    public void setJPEGQuality(float quality, boolean forceBaseline) {
+        this.jpegQuality = new Float(quality);
+        this.jpegForceBaseline = forceBaseline?Boolean.TRUE:Boolean.FALSE;
+    }
+    
+    /**
+     * Set the compression method that shall be used to encode the image.
+     * @param method the compression method
+     */
+    public void setCompressionMethod(String method) {
+        this.compressionMethod = method;
+    }
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriterParams.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriterRegistry.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriterRegistry.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriterRegistry.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriterRegistry.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,74 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image.spi;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.flex.forks.batik.util.Service;
+
+/**
+ *
+ * @version $Id: ImageWriterRegistry.java 501495 2007-01-30 18:00:36Z dvholten $
+ */
+public class ImageWriterRegistry {
+
+    private static volatile ImageWriterRegistry instance;
+
+    private final Map imageWriterMap = new HashMap();
+
+    private ImageWriterRegistry() {
+        setup();
+    }
+
+    public static ImageWriterRegistry getInstance() {
+        if (instance == null) {
+            synchronized( ImageWriterRegistry.class ){
+                if ( instance == null ){
+                    instance = new ImageWriterRegistry();
+                }
+            }
+        }
+        return instance;
+    }
+
+    private void setup() {
+        Iterator iter = Service.providers(ImageWriter.class);
+        while (iter.hasNext()) {
+            ImageWriter writer = (ImageWriter)iter.next();
+            // System.out.println("RE: " + writer);
+            register(writer);
+        }
+    }
+
+    public void register(ImageWriter writer) {
+        imageWriterMap.put(writer.getMIMEType(), writer);
+    }
+
+    /**
+     * get the ImageWriter registered for mime, or null.
+     * @param mime used for lookup
+     * @return the registered ImageWriter (maybe null)
+     */
+    public ImageWriter getWriterFor(String mime) {
+        return (ImageWriter)imageWriterMap.get(mime);
+    }
+
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/ImageWriterRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/JDKRegistryEntry.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/JDKRegistryEntry.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/JDKRegistryEntry.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/JDKRegistryEntry.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,280 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image.spi;
+
+import java.awt.Graphics2D;
+import java.awt.Image;
+import java.awt.Toolkit;
+import java.awt.geom.Rectangle2D;
+import java.awt.image.BufferedImage;
+import java.awt.image.ImageObserver;
+import java.awt.image.RenderedImage;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+
+import org.apache.flex.forks.batik.ext.awt.image.GraphicsUtil;
+import org.apache.flex.forks.batik.ext.awt.image.renderable.DeferRable;
+import org.apache.flex.forks.batik.ext.awt.image.renderable.Filter;
+import org.apache.flex.forks.batik.ext.awt.image.renderable.RedRable;
+import org.apache.flex.forks.batik.util.ParsedURL;
+
+/**
+ * This Image tag registy entry is setup to wrap the core JDK
+ * Image stream tools.
+ *
+ * @version $Id: JDKRegistryEntry.java 501094 2007-01-29 16:35:37Z deweese $
+ */
+public class JDKRegistryEntry extends AbstractRegistryEntry
+    implements URLRegistryEntry {
+
+    /**
+     * The priority of this entry.
+     * This entry should in most cases be the last entry.
+     * but if one wishes one could set a priority higher and be called
+     * afterwords
+     */
+    public static final float PRIORITY =
+        1000*MagicNumberRegistryEntry.PRIORITY;
+
+    public JDKRegistryEntry() {
+        super ("JDK", PRIORITY, new String[0], new String [] {"image/gif"});
+    }
+
+    /**
+     * Check if the Stream references an image that can be handled by
+     * this format handler.  The input stream passed in should be
+     * assumed to support mark and reset.
+     *
+     * If this method throws a StreamCorruptedException then the
+     * InputStream will be closed and a new one opened (if possible).
+     *
+     * This method should only throw a StreamCorruptedException if it
+     * is unable to restore the state of the InputStream
+     * (i.e. mark/reset fails basically).
+     */
+    public boolean isCompatibleURL(ParsedURL purl) {
+        try {
+            new URL(purl.toString());
+        } catch (MalformedURLException mue) {
+            // No sense in trying it if we can't build a URL out of it.
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Decode the URL into a RenderableImage
+     *
+     * @param purl URL of the image.
+     * @param needRawData If true the image returned should not have
+     *                    any default color correction the file may
+     *                    specify applied.
+     */
+    public Filter handleURL(ParsedURL purl, boolean needRawData) {
+
+        final URL url;
+        try {
+            url = new URL(purl.toString());
+        } catch (MalformedURLException mue) {
+            return null;
+        }
+
+        final DeferRable  dr  = new DeferRable();
+        final String      errCode;
+        final Object []   errParam;
+        if (purl != null) {
+            errCode  = ERR_URL_FORMAT_UNREADABLE;
+            errParam = new Object[] {"JDK", url};
+        } else {
+            errCode  = ERR_STREAM_FORMAT_UNREADABLE;
+            errParam = new Object[] {"JDK"};
+        }
+
+        Thread t = new Thread() {
+                public void run() {
+                    Filter filt = null;
+                    try {
+                        Toolkit tk = Toolkit.getDefaultToolkit();
+                        Image img = tk.createImage(url);
+
+                        if (img != null) {
+                            RenderedImage ri = loadImage(img, dr);
+                            if (ri != null) {
+                                filt = new RedRable(GraphicsUtil.wrap(ri));
+                            }
+                        }
+                    } catch (ThreadDeath td) {
+                        filt = ImageTagRegistry.getBrokenLinkImage
+                            (JDKRegistryEntry.this, errCode, errParam);
+                        dr.setSource(filt);
+                        throw td;
+                    } catch (Throwable t) { }
+                    if (filt == null)
+                        filt = ImageTagRegistry.getBrokenLinkImage
+                            (JDKRegistryEntry.this, errCode, errParam);
+
+                    dr.setSource(filt);
+                }
+            };
+        t.start();
+        return dr;
+    }
+
+    // Stuff for Image Loading.
+    public RenderedImage loadImage(Image img, final DeferRable  dr) {
+        // In some cases the image will be a
+        // BufferedImage (subclass of RenderedImage).
+        if (img instanceof RenderedImage)
+            return (RenderedImage)img;
+
+        MyImgObs observer = new MyImgObs();
+        Toolkit.getDefaultToolkit().prepareImage(img, -1, -1, observer);
+        observer.waitTilWidthHeightDone();
+        if (observer.imageError)
+            return null;
+        int width  = observer.width;
+        int height = observer.height;
+        dr.setBounds(new Rectangle2D.Double(0, 0, width, height));
+
+        // Build the image to draw into.
+        BufferedImage bi = new BufferedImage
+            (width, height, BufferedImage.TYPE_INT_ARGB);
+        Graphics2D g2d = bi.createGraphics();
+
+        // Wait till the image is fully loaded.
+        observer.waitTilImageDone();
+        if (observer.imageError)
+            return null;
+        dr.setProperties(new HashMap());
+
+        g2d.drawImage(img, 0, 0, null);
+        g2d.dispose();
+
+        return bi;
+    }
+
+
+    public static class MyImgObs implements ImageObserver {
+        boolean widthDone = false;
+        boolean heightDone = false;
+        boolean imageDone = false;
+        int width = -1;
+        int height = -1;
+        boolean imageError = false;
+
+        int IMG_BITS = ALLBITS|ERROR|ABORT;
+
+        public void clear() {
+            width=-1;
+            height=-1;
+            widthDone = false;
+            heightDone = false;
+            imageDone       = false;
+        }
+
+        public boolean imageUpdate(Image img, int infoflags,
+                                   int x, int y, int width, int height) {
+            synchronized (this) {
+                boolean notify = false;
+
+                if ((infoflags & WIDTH)   != 0) this.width  = width;
+                if ((infoflags & HEIGHT)  != 0) this.height = height;
+
+                if ((infoflags & ALLBITS) != 0) {
+                    this.width  = width;
+                    this.height = height;
+                }
+
+                if ((infoflags & IMG_BITS) != 0) {
+                    if ((!widthDone) || (!heightDone) || (!imageDone)) {
+                        widthDone  = true;
+                        heightDone = true;
+                        imageDone  = true;
+                        notify     = true;
+                    }
+                    if ((infoflags & ERROR) != 0) {
+                        imageError = true;
+                    }
+                }
+
+
+                if ((!widthDone) && (this.width != -1)) {
+                    notify = true;
+                    widthDone = true;
+                }
+                if ((!heightDone) && (this.height != -1)) {
+                    notify = true;
+                    heightDone = true;
+                }
+
+                if (notify)
+                    notifyAll();
+            }
+            return true;
+        }
+
+        public synchronized void waitTilWidthHeightDone() {
+            while ((!widthDone) || (!heightDone)) {
+                try {
+                    // Wait for someone to set xxxDone
+                    wait();
+                }
+                catch(InterruptedException ie) {
+                    // Loop around again see if src is set now...
+                }
+            }
+        }
+        public synchronized void waitTilWidthDone() {
+            while (!widthDone) {
+                try {
+                    // Wait for someone to set xxxDone
+                    wait();
+                }
+                catch(InterruptedException ie) {
+                    // Loop around again see if src is set now...
+                }
+            }
+        }
+        public synchronized void waitTilHeightDone() {
+            while (!heightDone) {
+                try {
+                    // Wait for someone to set xxxDone
+                    wait();
+                }
+                catch(InterruptedException ie) {
+                    // Loop around again see if src is set now...
+                }
+            }
+        }
+
+        public synchronized void waitTilImageDone() {
+            while (!imageDone) {
+                try {
+                    // Wait for someone to set xxxDone
+                    wait();
+                }
+                catch(InterruptedException ie) {
+                    // Loop around again see if src is set now...
+                }
+            }
+        }
+    }
+
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/JDKRegistryEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,296 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image.spi;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StreamCorruptedException;
+
+/**
+ * This Image tag registry entry is built around the notion of magic
+ * numbers.  These are strings of bytes that are at a well known
+ * location in the input stream (often the start).
+ *
+ * This base class can handle the compatiblity check based on a list
+ * of Magic Numbers that correspond to your format (Some formats have
+ * multiple magic numbers associated with them).
+ *
+ * @version $Id: MagicNumberRegistryEntry.java 498740 2007-01-22 18:35:57Z dvholten $
+ */
+public abstract class MagicNumberRegistryEntry
+    extends AbstractRegistryEntry
+    implements StreamRegistryEntry {
+
+    public static final float PRIORITY = 1000;
+
+    /**
+     * Inner class that represents one magic number. Simply consists
+     * of an offset in bytes from the start of the file, and a byte
+     * array that must match.
+     */
+    public static class MagicNumber {
+        int offset;
+        byte [] magicNumber;
+        byte [] buffer;
+
+        /**
+         *  Constructor.
+         * @param offset the location of the magic number in file.
+         * @param magicNumber the sequence of bytes that must match.
+         */
+        public MagicNumber(int offset, byte[]magicNumber) {
+            this.offset = offset;
+            this.magicNumber = (byte[])magicNumber.clone();
+            buffer = new byte[magicNumber.length];
+        }
+
+        /**
+         * Returns the maximum number of bytes that will be read for
+         * this magic number compairison.
+         */
+        int getReadlimit() {
+            return offset+magicNumber.length;
+        }
+
+        /**
+         * Performs the check of is.
+         */
+        boolean isMatch(InputStream is)
+            throws StreamCorruptedException {
+            int idx = 0;
+            is.mark(getReadlimit());
+            try {
+                // Skip to the offset location.
+                while (idx < offset) {
+                    int rn = (int)is.skip(offset-idx);
+                    if (rn == -1) return false;
+                    idx += rn;
+                }
+
+                idx = 0;
+                while (idx < buffer.length) {
+                    int rn = is.read(buffer, idx, buffer.length-idx);
+                    if (rn == -1) return false;
+                    idx += rn;
+                }
+
+                for (int i=0; i<magicNumber.length; i++) {
+                    if (magicNumber[i] != buffer[i])
+                        return false;
+                }
+            } catch (IOException ioe) {
+                return false;
+            } finally {
+                try {
+                    // Make sure we always put back what we have read.
+                    // If this throws an IOException then the current
+                    // stream should be closed an reopend by the registry.
+                    is.reset();
+                } catch (IOException ioe) {
+                    throw new StreamCorruptedException(ioe.getMessage());
+                }
+            }
+            return true;
+        }
+    }
+
+    /** The list of magic numbers associated with this entry */
+    MagicNumber [] magicNumbers;
+
+    /**
+     * Constructor, simplifies construction of entry when only
+     * one extension and one magic number is required.
+     * @param name        Format Name
+     * @param priority    the priority of the RegistryEntry
+     * @param ext         Standard extension
+     * @param mimeType    the supported MIME type
+     * @param offset      Offset of magic number
+     * @param magicNumber byte array to match.
+     */
+    public MagicNumberRegistryEntry(String name,
+                                    float priority,
+                                    String ext,
+                                    String mimeType,
+                                    int offset, byte[]magicNumber) {
+        super(name, priority, ext, mimeType);
+        magicNumbers    = new MagicNumber[1];
+        magicNumbers[0] = new MagicNumber(offset, magicNumber);
+    }
+
+    /**
+     * Constructor, simplifies construction of entry when only
+     * one extension and one magic number is required.
+     * @param name        Format Name
+     * @param ext         Standard extension
+     * @param mimeType    the supported MIME type
+     * @param offset      Offset of magic number
+     * @param magicNumber byte array to match.
+     */
+    public MagicNumberRegistryEntry(String name,
+                                    String ext,
+                                    String mimeType,
+                                    int offset, byte[] magicNumber) {
+        this(name, PRIORITY, ext, mimeType, offset, magicNumber);
+    }
+
+    /**
+     * Constructor, simplifies construction of entry when only
+     * one extension is required.
+     * @param name         Format Name
+     * @param priority     the priority of the RegistryEntry
+     * @param ext          Standard extension
+     * @param mimeType     the supported MIME type
+     * @param magicNumbers Array of magic numbers any of which can match.
+     */
+    public MagicNumberRegistryEntry(String name,
+                                    float priority,
+                                    String ext,
+                                    String mimeType,
+                                    MagicNumber[] magicNumbers) {
+        super(name, priority, ext, mimeType);
+        this.magicNumbers = magicNumbers;
+    }
+
+    /**
+     * Constructor, simplifies construction of entry when only
+     * one extension is required.
+     * @param name         Format Name
+     * @param ext          Standard extension
+     * @param mimeType     the supported MIME type
+     * @param magicNumbers Array of magic numbers any of which can match.
+     */
+    public MagicNumberRegistryEntry(String name,
+                                    String ext,
+                                    String mimeType,
+                                    MagicNumber[] magicNumbers) {
+        this(name, PRIORITY, ext, mimeType, magicNumbers);
+    }
+
+    /**
+     * Constructor, simplifies construction of entry when only
+     * one magic number is required.
+     * @param name Format Name
+     * @param priority the priority of the RegistryEntry
+     * @param exts Standard set of extensions
+     * @param mimeTypes array of supported MIME types
+     * @param offset Offset of magic number
+     * @param magicNumber byte array to match.
+     */
+    public MagicNumberRegistryEntry(String    name,
+                                    float     priority,
+                                    String [] exts,
+                                    String [] mimeTypes,
+                                    int offset, byte[]magicNumber) {
+        super(name, priority, exts, mimeTypes);
+        magicNumbers    = new MagicNumber[1];
+        magicNumbers[0] = new MagicNumber(offset, magicNumber);
+    }
+
+    /**
+     * Constructor, simplifies construction of entry when only
+     * one magic number is required.
+     * @param name Format Name
+     * @param exts Standard set of extensions
+     * @param mimeTypes array of supported MIME types
+     * @param offset Offset of magic number
+     * @param magicNumbers byte array to match.
+     */
+    public MagicNumberRegistryEntry(String    name,
+                                    String [] exts,
+                                    String [] mimeTypes,
+                                    int offset, byte[] magicNumbers) {
+        this(name, PRIORITY, exts, mimeTypes, offset, magicNumbers);
+    }
+
+    /**
+     * Constructor
+     * @param name Format Name
+     * @param priority the priority of the RegistryEntry
+     * @param exts Standard set of extensions
+     * @param mimeTypes array of supported MIME types
+     * @param magicNumbers array of magic numbers any of which can match.
+     */
+    public MagicNumberRegistryEntry(String    name,
+                                    float     priority,
+                                    String [] exts,
+                                    String [] mimeTypes,
+                                    MagicNumber [] magicNumbers) {
+        super(name, priority, exts, mimeTypes);
+        this.magicNumbers = magicNumbers;
+    }
+
+    /**
+     * Constructor
+     * @param name Format Name
+     * @param exts Standard set of extensions
+     * @param mimeTypes array of supported MIME types
+     * @param magicNumbers array of magic numbers any of which can match.
+     */
+    public MagicNumberRegistryEntry(String    name,
+                                    String [] exts,
+                                    String [] mimeTypes,
+                                    MagicNumber [] magicNumbers) {
+        this(name, PRIORITY, exts, mimeTypes, magicNumbers);
+    }
+
+    /**
+     * Constructor, allows for overriding the default priority of
+     * magic number entries.  This should be needed very rarely since
+     * magic number checks are fairly relyable and hence aren't usually
+     * sensative to order issues.
+     * @param name Format Name
+     * @param exts Standard set of extensions
+     * @param magicNumbers array of magic numbers any of which can match.
+     * @param priority     The priority of this entry (1000 is baseline)
+     */
+    public MagicNumberRegistryEntry(String         name,
+                                    String []      exts,
+                                    String []      mimeTypes,
+                                    MagicNumber [] magicNumbers,
+                                    float          priority) {
+        super(name, priority, exts, mimeTypes);
+        this.magicNumbers = magicNumbers;
+    }
+
+    /**
+     * Returns the maximume read ahead needed for all magic numbers.
+     */
+    public int getReadlimit() {
+        int maxbuf = 0;
+        for (int i=0; i<magicNumbers.length; i++) {
+            int req = magicNumbers[i].getReadlimit();
+            if (req > maxbuf) maxbuf = req;
+        }
+        return maxbuf;
+    }
+
+    /**
+     * Check if the stream contains an image that can be
+     * handled by this format handler
+     */
+    public boolean isCompatibleStream(InputStream is)
+        throws StreamCorruptedException {
+        for (int i=0; i<magicNumbers.length; i++) {
+            if (magicNumbers[i].isMatch(is))
+                return true;
+        }
+
+        return false;
+    }
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/MagicNumberRegistryEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/RegistryEntry.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/RegistryEntry.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/RegistryEntry.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/RegistryEntry.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,56 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image.spi;
+
+import java.util.List;
+
+/**
+ * The base interface for all image tag registry entries.  To be useful you
+ * probably need to implement on of the flavors of registry entries (such as
+ * StreamRegistryEntry or URLRegistryEntry).
+ *
+ * @version $Id: RegistryEntry.java 498740 2007-01-22 18:35:57Z dvholten $
+ */
+public interface RegistryEntry {
+
+    /**
+     * Return a List of the common extensions for this file format. The first
+     * entry in the list may be used as the default extension for writing files
+     * in this format (when we add support for writing that is).  This may also
+     * be used to build a selection expression for finding files of this type.
+     */
+    List getStandardExtensions();
+
+    /**
+     * Return a List of mime types for this file format.  The first entry in the
+     * list may be used as the default mime type.  */
+    List getMimeTypes();
+
+    /**
+     * Returns the name of the format. For example "JPEG", "PNG", ...
+     */
+    String getFormatName();
+
+    /**
+     * Returns a search priority for this entry.  For most formats this is not
+     * important, but in some cases it is important that some entries occure
+     * before or after others.
+     */
+    float  getPriority();
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/RegistryEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/StreamRegistryEntry.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/StreamRegistryEntry.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/StreamRegistryEntry.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/StreamRegistryEntry.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,79 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+
+ */
+package org.apache.flex.forks.batik.ext.awt.image.spi;
+
+import java.io.InputStream;
+import java.io.StreamCorruptedException;
+
+import org.apache.flex.forks.batik.ext.awt.image.renderable.Filter;
+import org.apache.flex.forks.batik.util.ParsedURL;
+
+/**
+ * This type of Image tag registy entry is used for most normal image
+ * file formats.  You are given a markable stream and an opportunity
+ * to check if it is "compatible" if you return true then you will
+ * likely be asked to provide the decoded image next.
+ * @see MagicNumberRegistryEntry
+ *
+ * @version $Id: StreamRegistryEntry.java 498740 2007-01-22 18:35:57Z dvholten $
+ */
+public interface StreamRegistryEntry extends RegistryEntry {
+
+    /**
+     * returns the number of bytes that need to be
+     * supported by mark on the InputStream for this
+     * to check the stream for compatibility.
+     */
+    int getReadlimit();
+
+    /**
+     * Check if the Stream references an image that can be handled by
+     * this format handler.  The input stream passed in should be
+     * assumed to support mark and reset.
+     *
+     * If this method throws a StreamCorruptedException then the
+     * InputStream will be closed and a new one opened (if possible).
+     *
+     * This method should only throw a StreamCorruptedException if it
+     * is unable to restore the state of the InputStream
+     * (i.e. mark/reset fails basically).
+     */
+    boolean isCompatibleStream(InputStream is)
+        throws StreamCorruptedException;
+
+    /**
+     * Decode the Stream into a Filter.  If the stream turns out not to
+     * be of a format this RegistryEntry can handle you should attempt
+     * to reset the stream, then return null.<P>
+     *
+     * This should only return a broken link image when the image is
+     * clearly of this format, but is unreadable for some reason.
+     *
+     * @param is The input stream that contains the image.
+     * @param origURL The original URL, if any, for documentation
+     *                purposes only.  This may be null.
+     * @param needRawData If true the image returned should not have
+     *                    any default color correction the file may
+     *                    specify applied.
+     */
+    Filter handleStream(InputStream is,
+                               ParsedURL   origURL,
+                               boolean     needRawData);
+}
+

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/StreamRegistryEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/URLRegistryEntry.java
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/URLRegistryEntry.java?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/URLRegistryEntry.java (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/URLRegistryEntry.java Thu Oct 25 19:01:43 2012
@@ -0,0 +1,69 @@
+/*
+
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You 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.
+
+*/
+
+package org.apache.flex.forks.batik.ext.awt.image.spi;
+
+import org.apache.flex.forks.batik.ext.awt.image.renderable.Filter;
+import org.apache.flex.forks.batik.util.ParsedURL;
+
+/**
+ * This type of Image tag registy entry is used for 'odd' URL types.
+ * Ussually this means that the URL uses a non-standard protocol.  In
+ * these cases you should be aware that in order for the construction
+ * of the URL object to succeed you must register a @see
+ * URLStreamHandler using one of the methods listed in
+ * @see java.net.URL#URL(java.lang.String, java.lang.String, int, java.lang.String)
+ *
+ * @version $Id: URLRegistryEntry.java 498740 2007-01-22 18:35:57Z dvholten $
+ */
+public interface URLRegistryEntry extends RegistryEntry {
+    /**
+     * Check if the URL references an image that can be
+     * handled by this format handler.  Generally speaking
+     * this should not open the URL.  The decision should
+     * be based on the structure of the URL (such as
+     * the protocol in use).<p>
+     *
+     * If you don't care about the structure of the URL and only about
+     * the contents of the URL you should register as a
+     * StreamRegistryEntry, so the URL "connection" will be made
+     * only once.
+     *
+     * @param url The URL to inspect.
+     */
+    boolean isCompatibleURL(ParsedURL url);
+
+    /**
+     * Decode the URL into a RenderableImage, here you should feel
+     * free to open the URL yourself.<P>
+     *
+     * This should only return a broken link image if the image
+     * is clearly of this format, but is unreadable for some reason.
+     * otherwise return null.<p>
+     *
+     * If all entries refuse the url or return null then the registry
+     * will automatically return a broken link image for you.
+     *
+     * @param url The url that reference the image.
+     * @param needRawData If true the image returned should not have
+     *                    any default color correction the file may
+     *                    specify applied.
+     */
+    Filter handleURL(ParsedURL url, boolean needRawData);
+}

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/image/spi/URLRegistryEntry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/package.html
URL: http://svn.apache.org/viewvc/incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/package.html?rev=1402274&view=auto
==============================================================================
--- incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/package.html (added)
+++ incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/package.html Thu Oct 25 19:01:43 2012
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+    <title>org.apache.batik.ext.awt</title>
+  </head>
+
+  <body>
+Contains extensions to the <tt>java.awt</tt> package. This package
+provides some new <tt>Paint</tt>s such as a linear or radial
+gradients.
+  </body>
+</html>

Propchange: incubator/flex/sdk/branches/develop/modules/thirdparty/batik/sources/org/apache/flex/forks/batik/ext/awt/package.html
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message