com.jinsight.svg
Class SVGImageFactory

java.lang.Object
  |
  +--java.awt.image.ImageFilter
        |
        +--com.jinsight.svg.SVGImageFactory
All Implemented Interfaces:
java.lang.Cloneable, java.awt.image.ImageConsumer

public class SVGImageFactory
extends java.awt.image.ImageFilter

An image filter which adds a URL to the properties of an Image object. The SVG language refers to images using 'href' attributes in the XLink namespace, as in <image xlink:href="foo.png"/>. Optionally, the image bytes can be encoded into a sequence of characters using the base64 algorithm and passed to the xlink:href attribute.
When any of the SVGGraphics.drawImage methods is invoked, the SVGGraphics object checks if the Image object has a valid 'URL' property and if affirmative the 'xlink:href' attribute of the <image> element specifies a URL. Otherwise, the bytes of the Image object are encoded using the base64 algorithm and are passed to the 'xlink:href' attribute.

The SVGImageFactory class can be used as follows:
Image image=Toolkit.getDefaultToolkit().getImage("foo.png");
SVGImageFactory sif=new SVGImageFactory(image,"file://localhost/images/foo.png");
Image img=sif.getImage();

A call to drawImage(img,0,0,100,100,null) results in the following SVG encoded line:
<image x="0" y="0" width="100" height="100" xlink:href="file://localhost/images/foo.png"/>

See Also:
SVGGraphics

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
SVGImageFactory(java.awt.Image srcImage, java.lang.String imageURL)
          Constructor of the SVGImageFactory class.
 
Method Summary
 java.awt.Image getImage()
          Returns a new Image object with the 'URL' property set.
 void setProperties(java.util.Hashtable props)
          Overrides method of the superclass.
 
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

SVGImageFactory

public SVGImageFactory(java.awt.Image srcImage,
                       java.lang.String imageURL)
Constructor of the SVGImageFactory class.
Parameters:
srcImage - The Image object to be assigned the 'URL' property.
imageURL - The URL of the Image object.
Method Detail

getImage

public java.awt.Image getImage()
Returns a new Image object with the 'URL' property set.
Returns:
an Image object.

setProperties

public void setProperties(java.util.Hashtable props)
Overrides method of the superclass. This method must not be called directly. It is invoked by a image producer to deliver the properties of the source image.
Overrides:
setProperties in class java.awt.image.ImageFilter
Parameters:
props - A non-null Hashtable of properties.