Class ImageHandlerRegistry
java.lang.Object
org.apache.fop.render.ImageHandlerRegistry
This class holds references to various image handlers. It also
supports automatic discovery of additional handlers available through
the class path.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Comparator<ImageHandler> private List<ImageHandler> List containing the same handlers as above but ordered by priorityprivate intprivate Map<Class<? extends org.apache.xmlgraphics.image.loader.Image>, ImageHandler> Map containing image handlers for variousImagesubclasses.private static org.apache.commons.logging.Logthe logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHandler(String classname) Add an PDFImageHandler.voidaddHandler(ImageHandler handler) Add an image handler.private voidDiscovers ImageHandler implementations through the classpath and dynamically registers them.getHandler(RenderingContext targetContext, org.apache.xmlgraphics.image.loader.Image image) Returns anImageHandlerwhich handles an specific image type given the MIME type of the image.org.apache.xmlgraphics.image.loader.ImageFlavor[]getSupportedFlavors(RenderingContext context, org.apache.xmlgraphics.image.loader.Image image) Returns the ordered array of supported image flavors.
-
Field Details
-
log
private static org.apache.commons.logging.Log logthe logger -
HANDLER_COMPARATOR
-
handlers
Map containing image handlers for variousImagesubclasses. -
handlerList
List containing the same handlers as above but ordered by priority -
handlerRegistrations
private int handlerRegistrations
-
-
Constructor Details
-
ImageHandlerRegistry
public ImageHandlerRegistry()Default constructor.
-
-
Method Details
-
addHandler
Add an PDFImageHandler. The handler itself is inspected to find out what it supports.- Parameters:
classname- the fully qualified class name
-
addHandler
Add an image handler. The handler itself is inspected to find out what it supports.- Parameters:
handler- the ImageHandler instance
-
getHandler
public ImageHandler getHandler(RenderingContext targetContext, org.apache.xmlgraphics.image.loader.Image image) Returns anImageHandlerwhich handles an specific image type given the MIME type of the image.- Parameters:
targetContext- the target rendering context that is used for identifying compatibilityimage- the Image to be handled- Returns:
- the image handler responsible for handling the image or null if none is available
-
getSupportedFlavors
public org.apache.xmlgraphics.image.loader.ImageFlavor[] getSupportedFlavors(RenderingContext context, org.apache.xmlgraphics.image.loader.Image image) Returns the ordered array of supported image flavors. The array needs to be ordered by priority so the image loader framework can return the preferred image type.- Parameters:
context- the rendering context- Returns:
- the array of image flavors
-
discoverHandlers
private void discoverHandlers()Discovers ImageHandler implementations through the classpath and dynamically registers them.
-