PixelInterleavedSampleModelpublic class PixelInterleavedSampleModel extends ComponentSampleModel The PixelInterleavedSampleModel class represents image data as represented as
interleaved pixels and for which each sample of a pixel takes one data
element of the DataBuffer. |
Constructors Summary |
---|
public PixelInterleavedSampleModel(int dataType, int w, int h, int pixelStride, int scanlineStride, int[] bandOffsets)Instantiates a new PixelInterleavedSampleModel with the specified
parameters.
super(dataType, w, h, pixelStride, scanlineStride, bandOffsets);
int maxOffset = bandOffsets[0];
int minOffset = bandOffsets[0];
for (int i = 1; i < bandOffsets.length; i++) {
if (bandOffsets[i] > maxOffset) {
maxOffset = bandOffsets[i];
}
if (bandOffsets[i] < minOffset) {
minOffset = bandOffsets[i];
}
}
maxOffset -= minOffset;
if (maxOffset > scanlineStride) {
// awt.241=Any offset between bands is greater than the Scanline
// stride
throw new IllegalArgumentException(Messages.getString("awt.241")); //$NON-NLS-1$
}
if (maxOffset > pixelStride) {
// awt.242=Pixel stride is less than any offset between bands
throw new IllegalArgumentException(Messages.getString("awt.242")); //$NON-NLS-1$
}
if (pixelStride * w > scanlineStride) {
// awt.243=Product of Pixel stride and w is greater than Scanline
// stride
throw new IllegalArgumentException(Messages.getString("awt.243")); //$NON-NLS-1$
}
|
Methods Summary |
---|
public java.awt.image.SampleModel | createCompatibleSampleModel(int w, int h)
int newOffsets[];
int minOffset = bandOffsets[0];
for (int i = 1; i < numBands; i++) {
if (bandOffsets[i] < minOffset) {
minOffset = bandOffsets[i];
}
}
if (minOffset > 0) {
newOffsets = new int[numBands];
for (int i = 0; i < numBands; i++) {
newOffsets[i] = bandOffsets[i] - minOffset;
}
} else {
newOffsets = bandOffsets;
}
return new PixelInterleavedSampleModel(dataType, w, h, pixelStride, pixelStride * w,
newOffsets);
| public java.awt.image.SampleModel | createSubsetSampleModel(int[] bands)
int newOffsets[] = new int[bands.length];
for (int i = 0; i < bands.length; i++) {
newOffsets[i] = bandOffsets[bands[i]];
}
return new PixelInterleavedSampleModel(dataType, width, height, pixelStride,
scanlineStride, newOffsets);
| public int | hashCode()
int hash = super.hashCode();
int tmp = hash >>> 8;
hash <<= 8;
hash |= tmp;
return hash ^ 0x66;
|
|