Class RMImageData

java.lang.Object
com.reportmill.base.RMObject
com.reportmill.graphics.RMImageData
All Implemented Interfaces:
RMArchiver.Archiving, Cloneable

public class RMImageData extends RMObject
This class manages image data. Each instance holds the raw image data and provides methods to return attributes of the decoded image.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    An interface for classes that can handle image reading for RMImageData.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Returns an empty RMImageData (useless except for legacy unarchival).
    RMImageData(Image anImage)
    Returns an image reader for an image.
    RMImageData(Object aSource, int pageNumber)
    Returns an image data for a given source (and page number, if image type supports it).
  • Method Summary

    Modifier and Type
    Method
    Description
    awt()
    Return AWT version of imageData.
    static boolean
    canRead(String anExt)
    Returns whether given extension is supported.
    boolean
    equals(Object anObj)
    Standard equals implementation.
    int
    Color map support: returns the index of the transparent color in a color map image.
    int
    Returns the number of bits per pixel (derived from bits per sample and samples per pixel).
    int
    Returns the number of bits per sample (eg, 24 bit RGB image is 8 bits per sample).
    byte[]
    Returns the original bytes for the image (loaded from the source).
    byte[]
    Returns the decoded image bytes for the image.
    int
    Returns the number of bytes per row (derived from width and bits per pixel).
    byte[]
    Color map support: returns the bytes of color map from a color map image.
    int
    Returns the number of pixels vertically.
    float
    Returns the actual display height of the image in printer's points using the image DPI if available.
    getImageData(Object aSource, int page)
    Returns an image data loaded from aSource.
    Returns an RMShape representation of image data (for vector image type like PDF).
    Returns the name for the image (assigned from our hashCode).
    getPage(int aPage)
    Returns the image data for a successive page.
    int
    Returns the total number of pages for the image.
    int
    Returns the page number for the image.
    Returns the reader used to load the image.
    int
    Returns the number of samples per pixel (RGB=3, RGBA=4, GrayScale=1, etc.).
    Returns the original source for the image (byte[], File, InputStream or whatever).
    Returns the type for the image (one of gif, jpg, png, pdf, etc.).
    int
    Returns the number of pixels horizontally.
    float
    Returns the actual display width of the image in printer's points using the image DPI if available.
    boolean
    Color map support: returns whether color map image has a transparent color.
    boolean
    Returns whether image uses a color map.
    Legacy unarchival.
    boolean
    Returns whether the image is non-grayscale.
    boolean
    Returns whether the image was loaded successfully.

    Methods inherited from class com.reportmill.base.RMObject

    clone, copy, didChange, didUndo, getAnimAttribute, getClassNameShort, undoClone, undoCopy, undoEquals

    Methods inherited from class java.lang.Object

    finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RMImageData

      public RMImageData()
      Returns an empty RMImageData (useless except for legacy unarchival).
    • RMImageData

      public RMImageData(Object aSource, int pageNumber)
      Returns an image data for a given source (and page number, if image type supports it).
    • RMImageData

      public RMImageData(Image anImage)
      Returns an image reader for an image.
  • Method Details

    • getImageData

      public static RMImageData getImageData(Object aSource, int page)
      Returns an image data loaded from aSource. If image type supports multiple pages, page number can be specified.
    • canRead

      public static boolean canRead(String anExt)
      Returns whether given extension is supported.
    • getSource

      public Object getSource()
      Returns the original source for the image (byte[], File, InputStream or whatever).
    • getBytes

      public byte[] getBytes()
      Returns the original bytes for the image (loaded from the source).
    • getBytesDecoded

      public byte[] getBytesDecoded()
      Returns the decoded image bytes for the image.
    • getName

      public String getName()
      Returns the name for the image (assigned from our hashCode).
    • getType

      public String getType()
      Returns the type for the image (one of gif, jpg, png, pdf, etc.).
    • getPageNumber

      public int getPageNumber()
      Returns the page number for the image.
    • getPageCount

      public int getPageCount()
      Returns the total number of pages for the image.
    • getWidth

      public int getWidth()
      Returns the number of pixels horizontally.
    • getHeight

      public int getHeight()
      Returns the number of pixels vertically.
    • getWidth2D

      public float getWidth2D()
      Returns the actual display width of the image in printer's points using the image DPI if available.
    • getHeight2D

      public float getHeight2D()
      Returns the actual display height of the image in printer's points using the image DPI if available.
    • isColor

      public boolean isColor()
      Returns whether the image is non-grayscale.
    • getSamplesPerPixel

      public int getSamplesPerPixel()
      Returns the number of samples per pixel (RGB=3, RGBA=4, GrayScale=1, etc.).
    • getBitsPerSample

      public int getBitsPerSample()
      Returns the number of bits per sample (eg, 24 bit RGB image is 8 bits per sample).
    • getBitsPerPixel

      public int getBitsPerPixel()
      Returns the number of bits per pixel (derived from bits per sample and samples per pixel).
    • getBytesPerRow

      public int getBytesPerRow()
      Returns the number of bytes per row (derived from width and bits per pixel).
    • hasAlpha

      public boolean hasAlpha()
      Color map support: returns whether color map image has a transparent color.
    • getAlphaColorIndex

      public int getAlphaColorIndex()
      Color map support: returns the index of the transparent color in a color map image.
    • hasColorMap

      public boolean hasColorMap()
      Returns whether image uses a color map.
    • getColorMap

      public byte[] getColorMap()
      Color map support: returns the bytes of color map from a color map image.
    • getPage

      public RMImageData getPage(int aPage)
      Returns the image data for a successive page.
    • getImageShape

      public RMShape getImageShape()
      Returns an RMShape representation of image data (for vector image type like PDF).
    • getReader

      public RMImageData.ImageReader getReader()
      Returns the reader used to load the image.
    • isValid

      public boolean isValid()
      Returns whether the image was loaded successfully.
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • awt

      public Image awt()
      Return AWT version of imageData.
    • initWithArchiver

      public Object initWithArchiver(RMArchiver anArchiver)
      Legacy unarchival.
      Specified by:
      initWithArchiver in interface RMArchiver.Archiving
      Overrides:
      initWithArchiver in class RMObject