org.apache.fop.image

Class ImageFactory


public final class ImageFactory
extends java.lang.Object

Create FopImage objects (with a configuration file - not yet implemented).
Author:
Eric SCHAEFFER

Field Summary

protected static Log
log
logging instance

Constructor Summary

ImageFactory()
Main constructor for the ImageFactory.

Method Summary

void
clearCaches()
Forces all the image caches to be cleared.
FopImage
getImage(String url, FOUserAgent context)
Get the image from the cache or load.
static String
getURL(String href)
Get the url string from a wrapped url.
FopImage
loadImage(String href, FOUserAgent ua)
Create an FopImage objects.
void
releaseImage(String url, FOUserAgent context)
Release an image from the cache.
void
removeContext(FOUserAgent context)
Release the context and all images in the context.

Field Details

log

protected static Log log
logging instance

Constructor Details

ImageFactory

public ImageFactory()
Main constructor for the ImageFactory.

Method Details

clearCaches

public void clearCaches()
Forces all the image caches to be cleared. This should normally only be used in testing environments. If you happen to think that you need to call this yourself in a production environment, please notify the development team so we can look into the issue. A call like this shouldn't be necessary anymore like it may have been with FOP 0.20.5.

getImage

public FopImage getImage(String url,
                         FOUserAgent context)
Get the image from the cache or load. If this returns null then the image could not be loaded due to an error. Messages should be logged. Before calling this the getURL(url) must be used.
Parameters:
url - the url for the image
context - the user agent context
Returns:
the fop image instance

getURL

public static String getURL(String href)
Get the url string from a wrapped url.
Parameters:
href - the input wrapped url
Returns:
the raw url

loadImage

public FopImage loadImage(String href,
                          FOUserAgent ua)
Create an FopImage objects.
Parameters:
href - the url for the image
ua - the user agent context
Returns:
the fop image instance

releaseImage

public void releaseImage(String url,
                         FOUserAgent context)
Release an image from the cache. This can be used if the renderer has its own cache of the image. The image should then be put into the weak cache.
Parameters:
url - the url for the image
context - the user agent context

removeContext

public void removeContext(FOUserAgent context)
Release the context and all images in the context.
Parameters:
context - the context to remove

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.