FileDocCategorySizeDatePackage
ImageTypeSpecifier.javaAPI DocAndroid 1.5 API11336Wed May 06 22:41:54 BST 2009javax.imageio

ImageTypeSpecifier

public class ImageTypeSpecifier extends Object
The ImageTypeSpecifier class performs conversion operations on the SampleModel and the ColorModel of an image.
since
Android 1.0

Fields Summary
protected ColorModel
colorModel
The ColorModel of this ImageTypeSpecifier.
protected SampleModel
sampleModel
The SampleModel of this ImageTypeSpecifier.
Constructors Summary
public ImageTypeSpecifier(ColorModel colorModel, SampleModel sampleModel)
Instantiates a new ImageTypeSpecifier with the specified ColorModel and SampleModel objects.

param
colorModel the ColorModel.
param
sampleModel the SampleModel.

        if (colorModel == null) {
            throw new IllegalArgumentException("color model should not be NULL");
        }
        if (sampleModel == null) {
            throw new IllegalArgumentException("sample model should not be NULL");
        }
        if (!colorModel.isCompatibleSampleModel(sampleModel)) {
            throw new IllegalArgumentException("color and sample models are not compatible");
        }

        this.colorModel = colorModel;
        this.sampleModel = sampleModel;
    
public ImageTypeSpecifier(RenderedImage renderedImage)
Instantiates a new ImageTypeSpecifier using the specified RenderedImage.

param
renderedImage the RenderedImage.

        if (renderedImage == null) {
            throw new IllegalArgumentException("image should not be NULL");
        }
        this.colorModel = renderedImage.getColorModel();
        this.sampleModel = renderedImage.getSampleModel();
    
Methods Summary
public static javax.imageio.ImageTypeSpecifiercreateBanded(java.awt.color.ColorSpace colorSpace, int[] bankIndices, int[] bandOffsets, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied)
Creates a ImageTypeSpecifier for a image with a BandedSampleModel and a ComponentColorModel.

param
colorSpace the ColorSpace.
param
bankIndices the bank indices.
param
bandOffsets the band offsets.
param
dataType the data type.
param
hasAlpha the parameter indicates a presence of alpha channel.
param
isAlphaPremultiplied the parameter indicates whether or not color channel is alpha pre-multiplied.
return
the image type specifier

        throw new UnsupportedOperationException("Not supported yet");
    
public java.awt.image.BufferedImagecreateBufferedImage(int width, int height)
Creates the BufferedImage with the specified width and height and the ColorMadel and SampleModel which are specified by this ImageTypeSpecifier.

param
width the width of the BufferedImage.
param
height the height of the BufferedImage.
return
the BufferedImage.

        throw new UnsupportedOperationException("Not supported yet");
    
public static javax.imageio.ImageTypeSpecifiercreateFromBufferedImageType(int bufferedImageType)
Creates the ImageTypeSpecifier from the specified buffered image type.

param
bufferedImageType the buffered image type.
return
the ImageTypeSpecifier.

        throw new UnsupportedOperationException("Not supported yet");
    
public static javax.imageio.ImageTypeSpecifiercreateFromRenderedImage(java.awt.image.RenderedImage image)
Creates the ImageTypeSpecifier from the specified RenderedImage.

param
image the RenderedImage.
return
the ImageTypeSpecifier.

        if (null == image) {
            throw new IllegalArgumentException("image should not be NULL");
        }
        return new ImageTypeSpecifier(image);
    
public static javax.imageio.ImageTypeSpecifiercreateGrayscale(int bits, int dataType, boolean isSigned)
Creates a ImageTypeSpecifier for a grayscale image.

param
bits the number of bits per gray value.
param
dataType the data type.
param
isSigned a signed flag.
return
the ImageTypeSpecifier.

        throw new UnsupportedOperationException("Not supported yet");
    
public static javax.imageio.ImageTypeSpecifiercreateGrayscale(int bits, int dataType, boolean isSigned, boolean isAlphaPremultiplied)
Creates a ImageTypeSpecifier for a grayscale image.

param
bits the number of bits per gray value.
param
dataType the data type.
param
isSigned a signed flag.
param
isAlphaPremultiplied the parameter indicates if color channel is pre-multiplied by alpha, or not.
return
the ImageTypeSpecifier.

        throw new UnsupportedOperationException("Not supported yet");
    
public static javax.imageio.ImageTypeSpecifiercreateIndexed(byte[] redLUT, byte[] greenLUT, byte[] blueLUT, byte[] alphaLUT, int bits, int dataType)
Creates a ImageTypeSpecifier with the indexed image format.

param
redLUT the red values of indices.
param
greenLUT the green values of indices.
param
blueLUT the blue values of indices.
param
alphaLUT the alpha values of indices.
param
bits the bits number for each index.
param
dataType the data type.
return
the ImageTypeSpecifier.

        throw new UnsupportedOperationException("Not supported yet");
    
public static javax.imageio.ImageTypeSpecifiercreateInterleaved(java.awt.color.ColorSpace colorSpace, int[] bandOffsets, int dataType, boolean hasAlpha, boolean isAlphaPremultiplied)
Creates an ImageTypeSpecifier with specified ComponentColorModel and a PixelInterleavedSampleModel.

param
colorSpace the ColorSpace.
param
bandOffsets the band offsets.
param
dataType the data type.
param
hasAlpha the parameter indicates if alpha channel is needed.
param
isAlphaPremultiplied the parameter indicates if the color channel is pre-multiplied by alpha.
return
the ImageTypeSpecifier.

        throw new UnsupportedOperationException("Not supported yet");
    
public static javax.imageio.ImageTypeSpecifiercreatePacked(java.awt.color.ColorSpace colorSpace, int redMask, int greenMask, int blueMask, int alphaMask, int transferType, boolean isAlphaPremultiplied)
Creates an ImageTypeSpecifier with the specified DirectColorModel and a packed SampleModel.

param
colorSpace the ColorSpace.
param
redMask the red mask.
param
greenMask the green mask.
param
blueMask the blue mask.
param
alphaMask the alpha mask.
param
transferType the transfer type.
param
isAlphaPremultiplied the parameter indicates if the color channel is pre-multiplied by alpha.
return
the ImageTypeSpecifier.

        throw new UnsupportedOperationException("Not supported yet");
    
public booleanequals(java.lang.Object o)
Compares this ImageTypeSpecifier object with the specified object.

param
o the Object to be compared.
return
true, if the object is an ImageTypeSpecifier with the same data as this ImageTypeSpecifier, false otherwise.

        boolean rt = false;
        if (o instanceof ImageTypeSpecifier) {
            ImageTypeSpecifier ts = (ImageTypeSpecifier)o;
            rt = colorModel.equals(ts.colorModel) && sampleModel.equals(ts.sampleModel);
        }
        return rt;
    
public intgetBitsPerBand(int band)
Gets the number of bits per the specified band.

param
band the index of band.
return
the number of bits per the specified band.

        if (band < 0 || band >= getNumBands()) {
            throw new IllegalArgumentException();
        }
        return sampleModel.getSampleSize(band);
    
public intgetBufferedImageType()
Gets the BufferedImage type.

return
the BufferedImage type.

        throw new UnsupportedOperationException("Not supported yet");
    
public java.awt.image.ColorModelgetColorModel()
Gets the ColorModel associated with this ImageTypeSpecifier.

return
the ColorModel associated with this ImageTypeSpecifier.

        return colorModel;
    
public intgetNumBands()
Gets the number of bands.

return
the number of bands.

        return sampleModel.getNumBands();
    
public intgetNumComponents()
Gets the number of components.

return
the number of components.

        return colorModel.getNumComponents();
    
public java.awt.image.SampleModelgetSampleModel()
Gets the SampleModel associated with this ImageTypeSpecifier.

return
the SampleModel associated with this ImageTypeSpecifier.

        return sampleModel;
    
public java.awt.image.SampleModelgetSampleModel(int width, int height)
Gets a compatible SampleModel with the specified width and height.

param
width the width.
param
height the height.
return
the SampleModel.

        if ((long)width * height > Integer.MAX_VALUE) {
            throw new IllegalArgumentException("width * height > Integer.MAX_VALUE");
        }
        return sampleModel.createCompatibleSampleModel(width, height);