Class RGBInterlacedPixArray

Direct Known Subclasses:
ColourPackedPixArray, RGBByPlanePixArray

public class RGBInterlacedPixArray extends BytePixArray
A representation of an array of R,G,B interlaced 3-byte pixels. Note that all pixel values handled by this class are of the primitive byte class. However, it is up to the user to convert these to unsigned before the pixel values are used. This would typically be done using a statements like:

short r = (short) (pixel[3*i] & 0xFF);
short g = (short) (pixel[3*i+1] & 0xFF);
short b = (short) (pixel[3*i+2] & 0xFF);
  • Method Details

    • getHisto

      public int[] getHisto(int nbins) throws InvalidImageException
      Computes a brightness histogram of a RGBInterlacedPixArray. A brighness value is computed by taking the average of the R,G and B values, and multiplying it by the alpha value.
      Overrides:
      getHisto in class BytePixArray
      Parameters:
      nbins - the number of bins in the histogram.
      Returns:
      an int[] of nbins the first element is the number of pixels with the minimum brightness, and the last element is the number of pixels with the brightness (minimum + nbins - 1).
      Throws:
      InvalidImageException - if the histogram can't be computed.
    • getPutPix

      public Object getPutPix(Object pix, int[] pixIdx, PixelOp op) throws IllegalArgumentException
      Gets/puts a single pixel value from/to an an image. Returns a java.awt.Color cast to Object corresponding to the picture colour for the specified pixel.
      Overrides:
      getPutPix in class BytePixArray
      Parameters:
      pix - a pixel value for a put operation or null for a get operation.
      pixIdx - an array of length at least nDim with elements 0 to nDim-1 equal to the index in that image dimension.
      op - the type of operation (GET or PUT).
      Returns:
      a pixel value for a get operation or the supplied pixel for a put operation.
      Throws:
      IllegalArgumentException - if the supplied pixel value if of the wrong type.
    • writeAsColourPacked

      public long writeAsColourPacked(BufferedOutputStream s) throws IOException
      Parameters:
      s - the BufferedOutputStream to write to.
      Returns:
      the number of bytes written.
      Throws:
      IOException - if an I/O error occurs.