Class ImageHandler
java.lang.Object
ro.sync.exml.workspace.api.images.handlers.ImageHandler
- Direct Known Subclasses:
BinaryImageHandler
,EditImageHandler
Base class for all the image handlers.
- Since:
- 18
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
canHandleFileType
(String extension) Checks if the handler can "deal with" a certain type of XML application, or other image.abstract void
Clear the individual cache the image handler might store internally.abstract Image
getImage
(ImageContentProvider contentProvider, ImageRenderingContext renderingContext) Get an image for the corresponding URL.abstract ImageLayoutInformation
getImageLayoutInformation
(ImageContentProvider contentProvider, ImageRenderingContext renderingContext) Get the size of the image.
-
Constructor Details
-
ImageHandler
public ImageHandler()
-
-
Method Details
-
getImage
public abstract Image getImage(ImageContentProvider contentProvider, ImageRenderingContext renderingContext) throws IOException Get an image for the corresponding URL.- Parameters:
contentProvider
- Provides access to the image contents. If the image is embedded in the content, the content provider is an instance ofEmbeddedImageContentProvider
renderingContext
- The rendering context. Nevernull
. Should contain the font of the parent element where the equation/graphic resides. Can be ignored for raster graphics.- Returns:
- the image, never null.
- Throws:
IOException
- When the image could not be loaded.
-
canHandleFileType
Checks if the handler can "deal with" a certain type of XML application, or other image.- Parameters:
extension
- The extension of the file, or the type of the XML content to be rendered. The implementation should accept the string in a case insensitive manner. Examples: "mathml", "SVG", "svg"..- Returns:
- True if the extension is known by the handler.
-
getImageLayoutInformation
public abstract ImageLayoutInformation getImageLayoutInformation(ImageContentProvider contentProvider, ImageRenderingContext renderingContext) throws IOException Get the size of the image. Ideally the handler should compute it as fast as possible, without loading the entire image in memory.- Parameters:
contentProvider
- Provides access to the image contents. If the image is embedded in the content, the content provider is an instance ofEmbeddedImageContentProvider
renderingContext
- The rendering context. Should contain the font of the parent element where the equation/graphic resides. Can be ignored for raster graphics.- Returns:
- The size of the image. Never null.
- Throws:
IOException
- When the image size could not be determined.
-
clearCache
public abstract void clearCache()Clear the individual cache the image handler might store internally.
-