Class ImageInfo

java.lang.Object
org.apache.xmlgraphics.image.loader.ImageInfo

public class ImageInfo extends Object
Represents an image that may not have been fully loaded. Usually, the loading only goes as far as necessary to know the intrinsic size of the image. The image will only fully loaded later when the image needs to be presented in a particular format so the consuming component can actually process it. The "preloading" is done so a layout engine can work with the image without having to fully load it (in memory).
  • Field Details

    • ORIGINAL_IMAGE

      public static final Object ORIGINAL_IMAGE
      Key to register the "original object" among the custom objects of an ImageInfo instance.
      See Also:
    • HAS_MORE_IMAGES

      public static final Object HAS_MORE_IMAGES
      Key to register information about additional (sub-)images in the image file after the selected one. Valid values for this key is either a positive Integer or the constant Boolean.TRUE or Boolean.FALSE. A value of TRUE indicates that there are more subimages available but the exact number of additional images has not been determined for performance reasons.
  • Constructor Details

    • ImageInfo

      public ImageInfo(String originalURI, String mimeType)
      Main constructor.
      Parameters:
      originalURI - the original URI that was specified by the user (not the resolved URI!)
      mimeType - the MIME type of the image
  • Method Details

    • getOriginalURI

      public String getOriginalURI()
      Returns the original URI of the image.
      Returns:
      the original URI
    • getMimeType

      public String getMimeType()
      Returns the image's MIME type.
      Returns:
      the MIME type
    • getSize

      public ImageSize getSize()
      Returns the image's intrinsic size.
      Returns:
      the image size
    • setSize

      public void setSize(ImageSize size)
      Sets the image's intrinsic size.
      Parameters:
      size - the size
    • getCustomObjects

      public Map getCustomObjects()
      Returns a Map of custom objects associated with this instance.
      Returns:
      the Map of custom objects
    • getOriginalImage

      public Image getOriginalImage()
      Returns the original Image instance if such an Image instance is created while building this ImageInfo object. Some images cannot be "preloaded". They have to be fully loaded in order to determine the intrinsic image size. This method allows access to that fully loaded image so no additional re-loading has to be done later.

      This method is short for: (Image)this.customObjects.get(ORIGINAL_IMAGE);

      Returns:
      the original Image instance or null if none is set
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object