Class RGBInterlacedPixArray
java.lang.Object
com.xinapse.image.PixArray
com.xinapse.image.BytePixArray
com.xinapse.image.RGBInterlacedPixArray
- Direct Known Subclasses:
ColourPackedPixArray, RGBByPlanePixArray
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);
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionint[]getHisto(int nbins) Computes a brightness histogram of a RGBInterlacedPixArray.Gets/puts a single pixel value from/to an an image.longWrite thisRGBInterlacedPixArrayas aColourPackedPixArray.Methods inherited from class BytePixArray
getPutPix, getPutSlice, writeMethods inherited from class PixArray
__getPix, copyPix, getInstance, getInstance, getMinMax, newInstance
-
Method Details
-
getHisto
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:
getHistoin classBytePixArray- 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
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:
getPutPixin classBytePixArray- 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
Write thisRGBInterlacedPixArrayas aColourPackedPixArray.- Parameters:
s- theBufferedOutputStreamto write to.- Returns:
- the number of bytes written.
- Throws:
IOException- if an I/O error occurs.
-