Class TLcdRenderedImageTile

java.lang.Object
com.luciad.format.raster.TLcdRenderedImageTile
All Implemented Interfaces:
ILcdSubtiledTile, ILcdTile, ILcdDisposable, AutoCloseable

public class TLcdRenderedImageTile extends Object implements ILcdSubtiledTile, ILcdDisposable
This ILcdTile provides a simple wrapper for a RenderedImage.

This class is thread-safe for concurrent read-only access of its contents.

  • Constructor Details

    • TLcdRenderedImageTile

      public TLcdRenderedImageTile(RenderedImage aRenderedImage)
      Creates a new TLcdRenderedImageTile that wraps the given RenderedImage.
    • TLcdRenderedImageTile

      public TLcdRenderedImageTile(RenderedImage aRenderedImage, ColorModel aColorModel)
      Creates a new TLcdRenderedImageTile that wraps the given RenderedImage, overriding its ColorModel with the given ColorModel.
  • Method Details

    • setClassTraceOn

      public static void setClassTraceOn(boolean aClassTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for all instances of this class. If the argument is true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
      Parameters:
      aClassTraceOn - if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
    • setTraceOn

      public void setTraceOn(boolean aTraceOn)
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Enables tracing for this class instance. Calling this method with either true or false as argument automatically turns off tracing for all other class instances for which setTraceOn has not been called. If the argument is false then only the informative, warning and error log messages are recorded.
      Parameters:
      aTraceOn - if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
    • isTraceOn

      public boolean isTraceOn()
      Deprecated.
      This method has been deprecated. It is recommended to use the standard Java logging framework directly.
      Returns true if tracing is enabled for this class.
      Returns:
      true if tracing is enabled for this class, false otherwise.
    • getRenderedImage

      public RenderedImage getRenderedImage()
      Returns the RenderedImage of this tile.
    • findSuitableTransparentColorIndex

      public int findSuitableTransparentColorIndex()
      Finds the index of a color that is transparent or that can be made transparent because it is a duplicate. This can be useful if the RenderedImage has an IndexColorModel that doesn't have a transparent color of its own. The index can then be used to force the corresponding color to be transparent, assuming that the index is not actually used in the image anyway.
      See Also:
    • setForcedTransparentColorIndex

      public void setForcedTransparentColorIndex(int aForcedTransparentColorIndex)
      Sets the index of a color that should be made transparent. This can be useful if the RenderedImage has an IndexColorModel that doesn't have a transparent color of its own.
    • getForcedTransparentColorIndex

      public int getForcedTransparentColorIndex()
      Returns the index of a color that are made transparent.
    • dispose

      public void dispose()
      Disposes of this tile and its contained RenderedImage. It also closes the referenced InputStream, if any.
      Specified by:
      dispose in interface ILcdDisposable
    • getWidth

      public int getWidth()
      Description copied from interface: ILcdTile
      Returns the width of the tile, expressed in pixels.
      Specified by:
      getWidth in interface ILcdTile
    • getHeight

      public int getHeight()
      Description copied from interface: ILcdTile
      Returns the height of the tile, expressed in pixels.
      Specified by:
      getHeight in interface ILcdTile
    • getSubTileWidth

      public int getSubTileWidth()
      Description copied from interface: ILcdSubtiledTile
      Returns the width of a subtile in pixels. May be equal to the width of the parent tile (as returned by the getWidth() method), in which case the tile is not subdivided.
      Specified by:
      getSubTileWidth in interface ILcdSubtiledTile
    • getSubTileHeight

      public int getSubTileHeight()
      Description copied from interface: ILcdSubtiledTile
      Returns the height of a subtile in pixels. May be equal to the height of the parent tile (as returned by the getHeight() method), in which case the tile is not subdivided.
      Specified by:
      getSubTileHeight in interface ILcdSubtiledTile
    • getType

      public int getType()
      Description copied from interface: ILcdTile
      Returns the internal storage type of the tile values.
      Specified by:
      getType in interface ILcdTile
      Returns:
      one of BYTE, SHORT, or INT.
    • getPixelSize

      public int getPixelSize()
      Description copied from interface: ILcdTile
      Returns the pixel size of the tile values, expressed in bits.
      Specified by:
      getPixelSize in interface ILcdTile
    • setColorModel

      public void setColorModel(ColorModel aColorModel)
    • getColorModel

      public ColorModel getColorModel()
      Description copied from interface: ILcdTile
      Returns the optional color model of the tile.
      Specified by:
      getColorModel in interface ILcdTile
      Returns:
      the color model, or null if the raster doesn't have an explicit color model.
    • retrieveValue

      public int retrieveValue(int aX, int aY)
      Description copied from interface: ILcdTile
      Retrieves the tile value at the specified location.
      Specified by:
      retrieveValue in interface ILcdTile
      Parameters:
      aX - the x ordinate of the value, expressed in tile coordinates.
      aY - the y ordinate of the value, expressed in tile coordinates.
      Returns:
      the integer tile value at the specified location.
    • isAllDefault

      public boolean isAllDefault()
      Description copied from interface: ILcdTile
      Returns whether all values in the tile are equal to a default value.
      Specified by:
      isAllDefault in interface ILcdTile
    • setAllDefault

      public void setAllDefault(boolean aAllDefault)
    • createImage

      public Image createImage()
      Description copied from interface: ILcdTile
      Creates an image of the entire tile, using the tile's own color model.
      Specified by:
      createImage in interface ILcdTile
    • createImage

      public Image createImage(ColorModel aColorModel)
      Description copied from interface: ILcdTile
      Creates an image of the entire tile, using the given color model.
      Specified by:
      createImage in interface ILcdTile
      Parameters:
      aColorModel - the color model to be used for the image. The color model should be compatible with the pixel values of the tile.
    • createImage

      public Image createImage(int aX, int aY, int aWidth, int aHeight)
      Description copied from interface: ILcdTile
      Creates an image of the specified rectangular area of the tile, using the tile's own color model.
      Specified by:
      createImage in interface ILcdTile
      Parameters:
      aX - the x ordinate of the area, expressed in tile coordinates.
      aY - the y ordinate of the area, expressed in tile coordinates.
      aWidth - the width of the area, expressed in tile coordinates.
      aHeight - the height of the area, expressed in tile coordinates.
    • createImage

      public Image createImage(int aX, int aY, int aWidth, int aHeight, ColorModel aColorModel)
      Description copied from interface: ILcdTile
      Creates an image of the specified rectangular area of the tile, using the given color model.
      Specified by:
      createImage in interface ILcdTile
      Parameters:
      aX - the x ordinate of the area, expressed in tile coordinates.
      aY - the y ordinate of the area, expressed in tile coordinates.
      aWidth - the width of the area, expressed in tile coordinates.
      aHeight - the height of the area, expressed in tile coordinates.
      aColorModel - the color model to be used for the image. The color model should be compatible with the pixel values of the tile.