cwi.SVGGraphics
Class SVGImageFilter

java.lang.Object
  extended by java.awt.image.ImageFilter
      extended by cwi.SVGGraphics.SVGImageFilter
All Implemented Interfaces:
java.awt.image.ImageConsumer, java.lang.Cloneable

public class SVGImageFilter
extends java.awt.image.ImageFilter

A simple image filter, which adds a "url" property to the image object. Otherwise the image is not changed.

A possible and simple use of the filter is as follows:

     import java.awt.image.*;
     ...
     ImageFilter addProperty = new SVGImageFilter("The.URL.of.the.image");
     FilteredImageSource imageSource = new FilteredImageSource(oldImg.getSource(),addProperty); 
     Image newImg = Toolkit.getDefaultToolkit().createImage(imageSource);
 
The class also includes two static methods which simply include these lines, and can be used as a simple tool.

Version:
1.0
Author:
Ivan Herman

Field Summary
 
Fields inherited from class java.awt.image.ImageFilter
consumer
 
Fields inherited from interface java.awt.image.ImageConsumer
COMPLETESCANLINES, IMAGEABORTED, IMAGEERROR, RANDOMPIXELORDER, SINGLEFRAME, SINGLEFRAMEDONE, SINGLEPASS, STATICIMAGEDONE, TOPDOWNLEFTRIGHT
 
Constructor Summary
SVGImageFilter(java.lang.String s)
           
SVGImageFilter(java.net.URL s)
           
 
Method Summary
static java.awt.Image addURL(java.awt.Image img, java.lang.String s)
          Create a new image with a property with a key "url".
static java.awt.Image addURL(java.awt.Image img, java.net.URL s)
          Create a new image with a property with a key "url".
 void setProperties(java.util.Hashtable props)
          This is the inherited method from ImageFilter which sets the new property.
 
Methods inherited from class java.awt.image.ImageFilter
clone, getFilterInstance, imageComplete, resendTopDownLeftRight, setColorModel, setDimensions, setHints, setPixels, setPixels
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVGImageFilter

public SVGImageFilter(java.lang.String s)
Parameters:
s - the url to be stored with the image.

SVGImageFilter

public SVGImageFilter(java.net.URL s)
Parameters:
s - the url to be stored with the image. The stored property is the string s.toExternalForm().
Method Detail

setProperties

public void setProperties(java.util.Hashtable props)
This is the inherited method from ImageFilter which sets the new property.

Specified by:
setProperties in interface java.awt.image.ImageConsumer
Overrides:
setProperties in class java.awt.image.ImageFilter

addURL

public static java.awt.Image addURL(java.awt.Image img,
                                    java.lang.String s)
Create a new image with a property with a key "url".

Parameters:
s - the property to be stored.

addURL

public static java.awt.Image addURL(java.awt.Image img,
                                    java.net.URL s)
Create a new image with a property with a key "url".

Parameters:
s - the property to be stored. The stored property is the string s.toExternalForm().