org.apache.xmlgraphics.image.loader.spi

## Interface ImageLoaderFactory

- All Known Implementing Classes:
    AbstractImageLoaderFactory, ImageLoaderFactoryEPS, ImageLoaderFactoryImageIO, ImageLoaderFactoryInternalTIFF, ImageLoaderFactoryPNG, ImageLoaderFactoryRaw, ImageLoaderFactoryRawCCITTFax

      public interface ImageLoaderFactory

  This interface is implemented to provide information about an ImageLoader and to create new instances. A separate factory allows implementation to dynamically detect if the underlying libraries are available in the classpath so the caller can skip this implementation if it's not functional.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `ImageFlavor[]` | `getSupportedFlavors(java.lang.String mime)` Returns an array of ImageFlavors that are supported by this implementation for a given MIME type.
    `java.lang.String[]` | `getSupportedMIMETypes()` Returns an array of MIME types supported by this implementation.
    `int` | `getUsagePenalty(java.lang.String mime, ImageFlavor flavor)` Deprecated. Redundancy with `ImageLoader.getUsagePenalty()`
    `boolean` | `isAvailable()` Indicates whether the underlying libraries needed by the implementation are available.
    `boolean` | `isSupported(ImageInfo imageInfo)` Indicates whether the given image (represented by an `ImageInfo` object) is supported by the loader.
    `ImageLoader` | `newImageLoader(ImageFlavor targetFlavor)` Creates and returns a new ImageLoader instance.

- - ### Method Detail

    - #### getSupportedMIMETypes

          java.lang.String[] getSupportedMIMETypes()

      Returns an array of MIME types supported by this implementation.
      Returns:
        the MIME type array

    - #### getSupportedFlavors

          ImageFlavor[] getSupportedFlavors(java.lang.String mime)

      Returns an array of ImageFlavors that are supported by this implementation for a given MIME type.
      Parameters:
        `mime` - the MIME type
      Returns:
        the ImageFlavor array

    - #### isSupported

          boolean isSupported(ImageInfo imageInfo)

      Indicates whether the given image (represented by an `ImageInfo` object) is supported by the loader. By default, implementations return true assuming all images of the supported MIME types can be processed correctly. In some cases, however, an ImageLoader may only support a subset of a format because it offers an optimized way to embed the image in the target format (for example: CCITT compressed TIFF files in PDF and PostScript). For this to work, the preloader must register some information in the ImageInfo's custom objects so the factory can identify if an image may or may not be supported.
      Parameters:
        `imageInfo` - the image info object
      Returns:
        true if the image is supported by the loaders generated by this factory

    - #### newImageLoader

          ImageLoader newImageLoader(ImageFlavor targetFlavor)

      Creates and returns a new ImageLoader instance.
      Parameters:
        `targetFlavor` - the target image flavor to produce
      Returns:
        a new ImageLoader instance

    - #### getUsagePenalty

          int getUsagePenalty(java.lang.String mime,
                              ImageFlavor flavor)

      Deprecated. Redundancy with `ImageLoader.getUsagePenalty()`
      Returns the usage penalty for a particular ImageLoader. This is used to select the best ImageLoader implementation for loading an image.
      Parameters:
        `mime` - the MIME type
        `flavor` - the target image flavor
      Returns:
        the usage penalty (must be a non-negative integer)

    - #### isAvailable

          boolean isAvailable()

      Indicates whether the underlying libraries needed by the implementation are available.
      Returns:
        true if the implementation is functional.

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