Method from javax.imageio.ImageTypeSpecifier Detail: |
public static ImageTypeSpecifier createBanded(ColorSpace colorSpace,
int[] bankIndices,
int[] bandOffsets,
int dataType,
boolean hasAlpha,
boolean isAlphaPremultiplied) {
return new ImageTypeSpecifier.Banded(colorSpace,
bankIndices,
bandOffsets,
dataType,
hasAlpha,
isAlphaPremultiplied);
}
Returns a specifier for a banded image format that will use a
ComponentColorModel and a
BandedSampleModel to store each channel in a
separate array. |
public BufferedImage createBufferedImage(int width,
int height) {
try {
SampleModel sampleModel = getSampleModel(width, height);
WritableRaster raster =
Raster.createWritableRaster(sampleModel,
new Point(0, 0));
return new BufferedImage(colorModel, raster,
colorModel.isAlphaPremultiplied(),
new Hashtable());
} catch (NegativeArraySizeException e) {
// Exception most likely thrown from a DataBuffer constructor
throw new IllegalArgumentException
("Array size > Integer.MAX_VALUE!");
}
}
Creates a BufferedImage with a given width and
height according to the specification embodied in this object. |
static ColorModel createComponentCM(ColorSpace colorSpace,
int numBands,
int dataType,
boolean hasAlpha,
boolean isAlphaPremultiplied) {
int transparency =
hasAlpha ? Transparency.TRANSLUCENT : Transparency.OPAQUE;
int[] numBits = new int[numBands];
int bits = DataBuffer.getDataTypeSize(dataType);
for (int i = 0; i < numBands; i++) {
numBits[i] = bits;
}
return new ComponentColorModel(colorSpace,
numBits,
hasAlpha,
isAlphaPremultiplied,
transparency,
dataType);
}
|
public static ImageTypeSpecifier createFromBufferedImageType(int bufferedImageType) {
if (bufferedImageType >= BufferedImage.TYPE_INT_RGB &&
bufferedImageType < = BufferedImage.TYPE_BYTE_INDEXED) {
return getSpecifier(bufferedImageType);
} else if (bufferedImageType == BufferedImage.TYPE_CUSTOM) {
throw new IllegalArgumentException("Cannot create from TYPE_CUSTOM!");
} else {
throw new IllegalArgumentException("Invalid BufferedImage type!");
}
}
Returns an ImageTypeSpecifier that encodes
one of the standard BufferedImage types
(other than TYPE_CUSTOM ). |
public static ImageTypeSpecifier createFromRenderedImage(RenderedImage image) {
if (image == null) {
throw new IllegalArgumentException("image == null!");
}
if (image instanceof BufferedImage) {
int bufferedImageType = ((BufferedImage)image).getType();
if (bufferedImageType != BufferedImage.TYPE_CUSTOM) {
return getSpecifier(bufferedImageType);
}
}
return new ImageTypeSpecifier(image);
}
Returns an ImageTypeSpecifier that encodes the
layout of a RenderedImage (which may be a
BufferedImage ). |
public static ImageTypeSpecifier createGrayscale(int bits,
int dataType,
boolean isSigned) {
return new ImageTypeSpecifier.Grayscale(bits,
dataType,
isSigned,
false,
false);
}
Returns a specifier for a grayscale image format that will pack
pixels of the given bit depth into array elements of
the specified data type. |
public static ImageTypeSpecifier createGrayscale(int bits,
int dataType,
boolean isSigned,
boolean isAlphaPremultiplied) {
return new ImageTypeSpecifier.Grayscale(bits,
dataType,
isSigned,
true,
isAlphaPremultiplied);
}
Returns a specifier for a grayscale plus alpha image format
that will pack pixels of the given bit depth into array
elements of the specified data type. |
public static ImageTypeSpecifier createIndexed(byte[] redLUT,
byte[] greenLUT,
byte[] blueLUT,
byte[] alphaLUT,
int bits,
int dataType) {
return new ImageTypeSpecifier.Indexed(redLUT,
greenLUT,
blueLUT,
alphaLUT,
bits,
dataType);
}
Returns a specifier for an indexed-color image format that will pack
index values of the given bit depth into array elements of
the specified data type. |
public static ImageTypeSpecifier createInterleaved(ColorSpace colorSpace,
int[] bandOffsets,
int dataType,
boolean hasAlpha,
boolean isAlphaPremultiplied) {
return new ImageTypeSpecifier.Interleaved(colorSpace,
bandOffsets,
dataType,
hasAlpha,
isAlphaPremultiplied);
}
Returns a specifier for an interleaved image format that will
use a ComponentColorModel and a
PixelInterleavedSampleModel to store each pixel
component in a separate byte, short, or int. |
public static ImageTypeSpecifier createPacked(ColorSpace colorSpace,
int redMask,
int greenMask,
int blueMask,
int alphaMask,
int transferType,
boolean isAlphaPremultiplied) {
return new ImageTypeSpecifier.Packed(colorSpace,
redMask,
greenMask,
blueMask,
alphaMask, // 0 if no alpha
transferType,
isAlphaPremultiplied);
}
Returns a specifier for a packed image format that will use a
DirectColorModel and a packed
SampleModel to store each pixel packed into in a
single byte, short, or int. |
public boolean equals(Object o) {
if ((o == null) || !(o instanceof ImageTypeSpecifier)) {
return false;
}
ImageTypeSpecifier that = (ImageTypeSpecifier)o;
return (colorModel.equals(that.colorModel)) &&
(sampleModel.equals(that.sampleModel));
}
Returns true if the given Object is
an ImageTypeSpecifier and has a
SampleModel and ColorModel that are
equal to those of this object. |
public int getBitsPerBand(int band) {
if (band < 0 | band >= getNumBands()) {
throw new IllegalArgumentException("band out of range!");
}
return sampleModel.getSampleSize(band);
}
Return the number of bits used to represent samples of the given band. |
public int getBufferedImageType() {
BufferedImage bi = createBufferedImage(1, 1);
return bi.getType();
}
Returns an int containing one of the enumerated constant values
describing image formats from BufferedImage . |
public ColorModel getColorModel() {
return colorModel;
}
Returns the ColorModel specified by this object. |
public int getNumBands() {
return sampleModel.getNumBands();
}
Return the number of bands
specified by this object. This is the same value as returned by
SampleModel.getNumBands |
public int getNumComponents() {
return colorModel.getNumComponents();
}
Return the number of color components
specified by this object. This is the same value as returned by
ColorModel.getNumComponents |
public SampleModel getSampleModel() {
return sampleModel;
}
Returns a SampleModel based on the settings
encapsulated within this object. The width and height of the
SampleModel will be set to arbitrary values. |
public SampleModel getSampleModel(int width,
int height) {
if ((long)width*height > Integer.MAX_VALUE) {
throw new IllegalArgumentException
("width*height > Integer.MAX_VALUE!");
}
return sampleModel.createCompatibleSampleModel(width, height);
}
Returns a SampleModel based on the settings
encapsulated within this object. The width and height of the
SampleModel will be set to the supplied values. |
public int hashCode() {
return (9 * colorModel.hashCode()) + (14 * sampleModel.hashCode());
}
Returns the hash code for this ImageTypeSpecifier. |