Class ImageLoaderImageIO

java.lang.Object
org.apache.xmlgraphics.image.loader.impl.AbstractImageLoader
org.apache.xmlgraphics.image.loader.impl.imageio.ImageLoaderImageIO
All Implemented Interfaces:
ImageLoader

public class ImageLoaderImageIO extends AbstractImageLoader
An ImageLoader implementation based on ImageIO for loading bitmap images.
  • Field Details

    • log

      protected static final org.apache.commons.logging.Log log
      logger
    • targetFlavor

      private ImageFlavor targetFlavor
    • PNG_METADATA_NODE

      private static final String PNG_METADATA_NODE
      See Also:
    • JPEG_METADATA_NODE

      private static final String JPEG_METADATA_NODE
      See Also:
    • PROVIDERS_IGNORING_ICC

      private static final Set PROVIDERS_IGNORING_ICC
  • Constructor Details

    • ImageLoaderImageIO

      public ImageLoaderImageIO(ImageFlavor targetFlavor)
      Main constructor.
      Parameters:
      targetFlavor - the target flavor
  • Method Details

    • getTargetFlavor

      public ImageFlavor getTargetFlavor()
      Returns the image flavor that is returned by this ImageLoader implementation.
      Returns:
      the target image flavor
    • loadImage

      public Image loadImage(ImageInfo info, Map hints, ImageSessionContext session) throws ImageException, IOException
      Loads and returns an image.
      Parameters:
      info - the image info object indicating the image
      hints - a Map of hints that can be used by implementations to customize the loading process (may be null).
      session - the session context
      Returns:
      the fully loaded image
      Throws:
      ImageException - if an error occurs while loading the image
      IOException - if an I/O error occurs while loading the image
    • getParam

      private ImageReadParam getParam(ImageReader reader, Map hints) throws IOException
      Throws:
      IOException
    • checkProviderIgnoresICC

      private boolean checkProviderIgnoresICC(IIOServiceProvider provider)
      Checks if the provider ignores the ICC color profile. This method will assume providers work correctly, and return false if the provider is unknown. This ensures backward-compatibility.
      Parameters:
      provider - the ImageIO Provider
      Returns:
      true if we know the provider to be broken and ignore ICC profiles.
    • tryToExctractICCProfile

      private ICC_Profile tryToExctractICCProfile(IIOMetadata iiometa)
      Extract ICC Profile from ImageIO Metadata. This method currently only supports PNG and JPEG metadata.
      Parameters:
      iiometa - The ImageIO Metadata
      Returns:
      an ICC Profile or null.
    • tryToExctractICCProfileFromPNGMetadataNode

      private ICC_Profile tryToExctractICCProfileFromPNGMetadataNode(Element pngNode)
    • tryToExctractICCProfileFromJPEGMetadataNode

      private ICC_Profile tryToExctractICCProfileFromJPEGMetadataNode(Element jpgNode)
    • getFallbackBufferedImage

      private BufferedImage getFallbackBufferedImage(ImageReader reader, int pageIndex, ImageReadParam param) throws IOException
      Throws:
      IOException