Class RMImageData
- java.lang.Object
- 
- com.inductiveautomation.rm.graphics.RMImageData
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable
 
 public class RMImageData extends java.lang.Object implements java.lang.CloneableThis class manages image data. Each instance holds the raw image data and provides methods to return attributes of the decoded image.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfaceRMImageData.ImageReaderAn interface for classes that can handle image reading for RMImageData.
 - 
Field SummaryFields Modifier and Type Field Description static RMImageDataEMPTY
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedRMImageData(WebURL url)protectedRMImageData(java.lang.Object aSource, int aPageIndex)Returns an image data for a given source and page index.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleancanRead(java.lang.String anExt)Returns whether given extension is supported.RMImageDataclone()Standard clone implementation.protected byte[]createBytes()Creates bytes from the image (loaded from the source).protected voidcreateBytesDecoded()Creates decoded image bytes for the image.protected java.awt.image.BufferedImagecreateImage()Creates a buffered image for image data.booleanequals(java.lang.Object anObj)Standard equals implementation.intgetAlphaColorIndex()Color map support: returns the index of the transparent color in a color map image.intgetBitsPerPixel()Returns the number of bits per pixel (derived from bits per sample and samples per pixel).intgetBitsPerSample()Returns the number of bits per sample (eg, 24 bit RGB image is 8 bits per sample).byte[]getBytes()Returns the original bytes for the image (loaded from the source).byte[]getBytesDecoded()Returns the decoded image bytes for the image.intgetBytesPerRow()Returns the number of bytes per row (derived from width and bits per pixel).byte[]getColorMap()Color map support: returns the bytes of color map from a color map image.intgetHeight()Returns the number of pixels vertically.java.awt.image.BufferedImagegetImage()Returns the buffered image for image data.static RMImageDatagetImageData(java.lang.Object aSource)Returns an image data loaded from aSource.static RMImageDatagetImageData(java.lang.Object aSource, int aPageIndex)Returns an image data loaded from aSource.static RMImageDatagetImageDataBypassCache(java.lang.Object aSource, int aPageIndex)doublegetImageHeight()Returns the actual display height of the image in printer's points using the image DPI if available.doublegetImageWidth()Returns the actual display width of the image in printer's points using the image DPI if available.java.lang.StringgetName()Returns the name for the image (assigned from our hashCode).RMImageDatagetPage(int aPage)Returns the image data for a successive page.intgetPageCount()Returns the total number of pages for the image.intgetPageIndex()Returns the page index for the image.RMImageData.ImageReadergetReader()Returns the reader used to load the image.intgetSamplesPerPixel()Returns the number of samples per pixel (RGB=3, RGBA=4, GrayScale=1, etc.).java.lang.ObjectgetSource()Returns the original source for the image (byte[], File, InputStream or whatever).WebURLgetSourceURL()Returns the source URL, if loaded from URL.java.lang.StringgetType()Returns the type for the image (one of gif, jpg, png, pdf, etc.).intgetWidth()Returns the number of pixels horizontally.booleanhasAlpha()Color map support: returns whether color map image has a transparent color.booleanhasColorMap()Returns whether image uses a color map.booleanisColor()Returns whether the image is non-grayscale.booleanisValid()Returns whether the image was loaded successfully.voidpaint(RMShapePainter aPntr, double x, double y, double w, double h)Draws image data in given rect.protected voidrefresh()Refreshes data from source.protected voidsetSource(java.lang.Object aSource, int aPageIndex)Sets the source.
 
- 
- 
- 
Field Detail- 
EMPTYpublic static RMImageData EMPTY 
 
- 
 - 
Constructor Detail- 
RMImageDataprotected RMImageData(WebURL url) 
 - 
RMImageDataprotected RMImageData(java.lang.Object aSource, int aPageIndex)Returns an image data for a given source and page index. Source can be an image or something that can provide bytes. Page index only applicable for multi-page image types, like PDF.
 
- 
 - 
Method Detail- 
getImageDatapublic static RMImageData getImageData(java.lang.Object aSource) Returns an image data loaded from aSource.
 - 
getImageDatapublic static RMImageData getImageData(java.lang.Object aSource, int aPageIndex) Returns an image data loaded from aSource. If image type supports multiple pages, page index can be specified.
 - 
getImageDataBypassCachepublic static RMImageData getImageDataBypassCache(java.lang.Object aSource, int aPageIndex) 
 - 
getSourcepublic java.lang.Object getSource() Returns the original source for the image (byte[], File, InputStream or whatever).
 - 
setSourceprotected void setSource(java.lang.Object aSource, int aPageIndex)Sets the source.
 - 
getSourceURLpublic WebURL getSourceURL() Returns the source URL, if loaded from URL.
 - 
refreshprotected void refresh() Refreshes data from source.
 - 
getImagepublic java.awt.image.BufferedImage getImage() Returns the buffered image for image data.
 - 
createImageprotected java.awt.image.BufferedImage createImage() Creates a buffered image for image data.
 - 
getBytespublic byte[] getBytes() Returns the original bytes for the image (loaded from the source).
 - 
createBytesprotected byte[] createBytes() Creates bytes from the image (loaded from the source).
 - 
getBytesDecodedpublic byte[] getBytesDecoded() Returns the decoded image bytes for the image.
 - 
createBytesDecodedprotected void createBytesDecoded() Creates decoded image bytes for the image.
 - 
getNamepublic java.lang.String getName() Returns the name for the image (assigned from our hashCode).
 - 
getTypepublic java.lang.String getType() Returns the type for the image (one of gif, jpg, png, pdf, etc.).
 - 
getPageIndexpublic int getPageIndex() Returns the page index for the image.
 - 
getPageCountpublic int getPageCount() Returns the total number of pages for the image.
 - 
getWidthpublic int getWidth() Returns the number of pixels horizontally.
 - 
getHeightpublic int getHeight() Returns the number of pixels vertically.
 - 
getImageWidthpublic double getImageWidth() Returns the actual display width of the image in printer's points using the image DPI if available.
 - 
getImageHeightpublic double getImageHeight() Returns the actual display height of the image in printer's points using the image DPI if available.
 - 
isColorpublic boolean isColor() Returns whether the image is non-grayscale.
 - 
getSamplesPerPixelpublic int getSamplesPerPixel() Returns the number of samples per pixel (RGB=3, RGBA=4, GrayScale=1, etc.).
 - 
getBitsPerSamplepublic int getBitsPerSample() Returns the number of bits per sample (eg, 24 bit RGB image is 8 bits per sample).
 - 
getBitsPerPixelpublic int getBitsPerPixel() Returns the number of bits per pixel (derived from bits per sample and samples per pixel).
 - 
getBytesPerRowpublic int getBytesPerRow() Returns the number of bytes per row (derived from width and bits per pixel).
 - 
hasAlphapublic boolean hasAlpha() Color map support: returns whether color map image has a transparent color.
 - 
getAlphaColorIndexpublic int getAlphaColorIndex() Color map support: returns the index of the transparent color in a color map image.
 - 
hasColorMappublic boolean hasColorMap() Returns whether image uses a color map.
 - 
getColorMappublic byte[] getColorMap() Color map support: returns the bytes of color map from a color map image.
 - 
getPagepublic RMImageData getPage(int aPage) Returns the image data for a successive page.
 - 
getReaderpublic RMImageData.ImageReader getReader() Returns the reader used to load the image.
 - 
isValidpublic boolean isValid() Returns whether the image was loaded successfully.
 - 
equalspublic boolean equals(java.lang.Object anObj) Standard equals implementation.- Overrides:
- equalsin class- java.lang.Object
 
 - 
clonepublic RMImageData clone() Standard clone implementation.- Overrides:
- clonein class- java.lang.Object
 
 - 
canReadpublic static boolean canRead(java.lang.String anExt) Returns whether given extension is supported.
 - 
paintpublic void paint(RMShapePainter aPntr, double x, double y, double w, double h) Draws image data in given rect.
 
- 
 
-