Class BandSelectImage

All Implemented Interfaces:
RenderedImage, Disposable

final class BandSelectImage extends SourceAlignedImage
Selects or reorder bands from a source image. This operation avoid copying sample values; it works by modifying the sample model and color model.
Since:
1.1
Version:
1.3
  • Field Details

    • INHERITED_PROPERTIES

      private static final Set<String> INHERITED_PROPERTIES
      Properties to inherit from the source image, after bands reduction if applicable.
      See Also:
    • bands

      private final int[] bands
      The selected bands.
  • Constructor Details

    • BandSelectImage

      private BandSelectImage(RenderedImage source, ColorModel cm, int[] bands)
      Creates a new "band select" operation for the given source. It is caller responsibility to verify the validity of given bands indices.
      Parameters:
      source - the image in which to select bands.
      cm - the color model to associate to this image.
      bands - the bands to select. Should be a clone of user-specified argument (this constructor retains the given array reference as-is, without cloning).
  • Method Details

    • create

      static RenderedImage create(RenderedImage source, int[] bands)
      Creates a new "band select" operation for the given source.
      Parameters:
      source - the image in which to select bands.
      bands - the bands to select.
    • getPropertyNames

      public String[] getPropertyNames()
      Returns the names of all recognized properties, or null if this image has no properties.
      Specified by:
      getPropertyNames in interface RenderedImage
      Overrides:
      getPropertyNames in class PlanarImage
      Returns:
      names of all recognized properties, or null if none.
    • getProperty

      public Object getProperty(String key)
      Gets a property from this image.
      Specified by:
      getProperty in interface RenderedImage
      Overrides:
      getProperty in class PlanarImage
      Parameters:
      key - the name of the property to get.
      Returns:
      the property value, or Image.UndefinedProperty if none.
    • getProperty

      private static Object getProperty(RenderedImage source, String key, int[] bands)
      Gets a property from the given image, reducing the number of dimensions if needed. It is caller responsibility to verify that the given key is one of the keys enumerated in INHERITED_PROPERTIES.
    • computeTile

      protected Raster computeTile(int tileX, int tileY, WritableRaster previous)
      Creates a raster sharing the same data buffer than the source image but showing only a subset of the bands.
      Specified by:
      computeTile in class ComputedImage
      Parameters:
      tileX - the column index of the tile to compute.
      tileY - the row index of the tile to compute.
      previous - ignored.
      Returns:
      computed tile for the given indices. May be the previous tile after update but cannot be null.
    • hashCode

      public int hashCode()
      Returns a hash code value for this image.
      Overrides:
      hashCode in class SourceAlignedImage
    • equals

      public boolean equals(Object object)
      Compares the given object with this image for equality.
      Overrides:
      equals in class SourceAlignedImage