public class ImageManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static org.apache.commons.logging.Log |
log
logger
|
Constructor and Description |
---|
ImageManager(ImageContext context)
Main constructor.
|
ImageManager(ImageImplRegistry registry,
ImageContext context)
Constructor for testing purposes.
|
Modifier and Type | Method and Description |
---|---|
ImageProviderPipeline |
choosePipeline(ImageProviderPipeline[] candidates)
Chooses the best
ImageProviderPipeline from a set of candidates. |
Image |
convertImage(Image image,
ImageFlavor[] flavors)
Converts an image with no hints.
|
Image |
convertImage(Image image,
ImageFlavor[] flavors,
java.util.Map hints)
Converts an image.
|
ImageCache |
getCache()
Returns the ImageCache in use by the ImageManager.
|
Image |
getImage(ImageInfo info,
ImageFlavor[] flavors,
ImageSessionContext session)
Loads an image with no hints.
|
Image |
getImage(ImageInfo info,
ImageFlavor[] flavors,
java.util.Map hints,
ImageSessionContext session)
Loads an image.
|
Image |
getImage(ImageInfo info,
ImageFlavor flavor,
ImageSessionContext session)
Loads an image with no hints.
|
Image |
getImage(ImageInfo info,
ImageFlavor flavor,
java.util.Map hints,
ImageSessionContext session)
Loads an image.
|
ImageContext |
getImageContext()
Returns the ImageContext in use by the ImageManager.
|
ImageInfo |
getImageInfo(java.lang.String uri,
ImageSessionContext session)
Returns an ImageInfo object containing its intrinsic size for a given URI.
|
PipelineFactory |
getPipelineFactory()
Returns the PipelineFactory in use by the ImageManager.
|
ImageImplRegistry |
getRegistry()
Returns the ImageImplRegistry in use by the ImageManager.
|
ImageInfo |
preloadImage(java.lang.String uri,
ImageSessionContext session)
Preloads an image, i.e.
|
ImageInfo |
preloadImage(java.lang.String uri,
javax.xml.transform.Source src)
Preloads an image, i.e.
|
public ImageManager(ImageContext context)
context
- the session-independent context informationpublic ImageManager(ImageImplRegistry registry, ImageContext context)
registry
- the implementation registry with all plug-inscontext
- the session-independent context informationpublic ImageImplRegistry getRegistry()
public ImageContext getImageContext()
public ImageCache getCache()
public PipelineFactory getPipelineFactory()
public ImageInfo getImageInfo(java.lang.String uri, ImageSessionContext session) throws ImageException, java.io.IOException
uri
- the URI of the imagesession
- the session context through which to resolve the URI if the image is not in
the cacheImageException
- If no suitable ImagePreloader can be found to load the image or
if an error occurred while preloading the image.java.io.IOException
- If an I/O error occurs while preloading the imagepublic ImageInfo preloadImage(java.lang.String uri, ImageSessionContext session) throws ImageException, java.io.IOException
ImageInfo.getOriginalImage()
).
The reason for the preloading: Apache FOP, for example, only needs the image's intrinsic size during layout. Only when the document is rendered to the final format does FOP need to load the full image. Like this a lot of memory can be saved.
uri
- the original URI of the imagesession
- the session context through which to resolve the URIImageException
- If no suitable ImagePreloader can be found to load the image or
if an error occurred while preloading the image.java.io.IOException
- If an I/O error occurs while preloading the imagepublic ImageInfo preloadImage(java.lang.String uri, javax.xml.transform.Source src) throws ImageException, java.io.IOException
ImageInfo.getOriginalImage()
).
The reason for the preloading: Apache FOP, for example, only needs the image's intrinsic size during layout. Only when the document is rendered to the final format does FOP need to load the full image. Like this a lot of memory can be saved.
uri
- the original URI of the imagesrc
- the Source object to load the image fromImageException
- If no suitable ImagePreloader can be found to load the image or
if an error occurred while preloading the image.java.io.IOException
- If an I/O error occurs while preloading the imagepublic Image getImage(ImageInfo info, ImageFlavor flavor, java.util.Map hints, ImageSessionContext session) throws ImageException, java.io.IOException
Optionally, it is possible to pass in Map of hints. These hints may be used by ImageLoaders
and ImageConverters to act on the image. See ImageProcessingHints
for common hints
used by the bundled implementations. You can, of course, define your own hints.
info
- the ImageInfo instance for the image (obtained by
getImageInfo(String, ImageSessionContext)
)flavor
- the requested image flavor.hints
- a Map of hints to any of the background components or nullsession
- the session contextImageException
- If no suitable loader/converter combination is available to fulfill
the request or if an error occurred while loading the image.java.io.IOException
- If an I/O error occurspublic Image getImage(ImageInfo info, ImageFlavor[] flavors, java.util.Map hints, ImageSessionContext session) throws ImageException, java.io.IOException
Optionally, it is possible to pass in Map of hints. These hints may be used by ImageLoaders
and ImageConverters to act on the image. See ImageProcessingHints
for common hints
used by the bundled implementations. You can, of course, define your own hints.
info
- the ImageInfo instance for the image (obtained by
getImageInfo(String, ImageSessionContext)
)flavors
- the requested image flavors (in preferred order).hints
- a Map of hints to any of the background components or nullsession
- the session contextImageException
- If no suitable loader/converter combination is available to fulfill
the request or if an error occurred while loading the image.java.io.IOException
- If an I/O error occurspublic Image getImage(ImageInfo info, ImageFlavor flavor, ImageSessionContext session) throws ImageException, java.io.IOException
getImage(ImageInfo, ImageFlavor, Map, ImageSessionContext)
for more
information.info
- the ImageInfo instance for the image (obtained by
getImageInfo(String, ImageSessionContext)
)flavor
- the requested image flavor.session
- the session contextImageException
- If no suitable loader/converter combination is available to fulfill
the request or if an error occurred while loading the image.java.io.IOException
- If an I/O error occurspublic Image getImage(ImageInfo info, ImageFlavor[] flavors, ImageSessionContext session) throws ImageException, java.io.IOException
getImage(ImageInfo, ImageFlavor[], Map, ImageSessionContext)
for more
information.info
- the ImageInfo instance for the image (obtained by
getImageInfo(String, ImageSessionContext)
)flavors
- the requested image flavors (in preferred order).session
- the session contextImageException
- If no suitable loader/converter combination is available to fulfill
the request or if an error occurred while loading the image.java.io.IOException
- If an I/O error occurspublic Image convertImage(Image image, ImageFlavor[] flavors, java.util.Map hints) throws ImageException, java.io.IOException
Optionally, it is possible to pass in Map of hints. These hints may be used by
ImageConverters to act on the image. See ImageProcessingHints
for common hints
used by the bundled implementations. You can, of course, define your own hints.
image
- the image to convertflavors
- the requested image flavors (in preferred order).hints
- a Map of hints to any of the background components or nullImageException
- If no suitable loader/converter combination is available to fulfill
the request or if an error occurred while loading the image.java.io.IOException
- If an I/O error occurspublic Image convertImage(Image image, ImageFlavor[] flavors) throws ImageException, java.io.IOException
convertImage(Image, ImageFlavor[], Map)
for more
information.image
- the image to convertflavors
- the requested image flavors (in preferred order).ImageException
- If no suitable loader/converter combination is available to fulfill
the request or if an error occurred while loading the image.java.io.IOException
- If an I/O error occurspublic ImageProviderPipeline choosePipeline(ImageProviderPipeline[] candidates)
ImageProviderPipeline
from a set of candidates.candidates
- the candidatesCopyright 1999-2012 The Apache Software Foundation. All Rights Reserved.