本文整理汇总了Java中java.awt.image.DataBufferUShort.getOffsets方法的典型用法代码示例。如果您正苦于以下问题:Java DataBufferUShort.getOffsets方法的具体用法?Java DataBufferUShort.getOffsets怎么用?Java DataBufferUShort.getOffsets使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.image.DataBufferUShort
的用法示例。
在下文中一共展示了DataBufferUShort.getOffsets方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ShortBandedRaster
import java.awt.image.DataBufferUShort; //导入方法依赖的package包/类
/**
* Constructs a ShortBandedRaster with the given SampleModel,
* DataBuffer, and parent. DataBuffer must be a DataBufferUShort and
* SampleModel must be of type BandedSampleModel.
* When translated into the base Raster's
* coordinate system, aRegion must be contained by the base Raster.
* Origin is the coordinate in the new Raster's coordinate system of
* the origin of the base Raster. (The base Raster is the Raster's
* ancestor which has no parent.)
*
* Note that this constructor should generally be called by other
* constructors or create methods, it should not be used directly.
* @param sampleModel The SampleModel that specifies the layout.
* @param dataBuffer The DataBufferUShort that contains the image data.
* @param aRegion The Rectangle that specifies the image area.
* @param origin The Point that specifies the origin.
* @param parent The parent (if any) of this raster.
*/
public ShortBandedRaster(SampleModel sampleModel,
DataBuffer dataBuffer,
Rectangle aRegion,
Point origin,
ShortBandedRaster parent) {
super(sampleModel, dataBuffer, aRegion, origin, parent);
this.maxX = minX + width;
this.maxY = minY + height;
if (!(dataBuffer instanceof DataBufferUShort)) {
throw new RasterFormatException("ShortBandedRaster must have " +
"ushort DataBuffers");
}
DataBufferUShort dbus = (DataBufferUShort)dataBuffer;
if (sampleModel instanceof BandedSampleModel) {
BandedSampleModel bsm = (BandedSampleModel)sampleModel;
this.scanlineStride = bsm.getScanlineStride();
int bankIndices[] = bsm.getBankIndices();
int bandOffsets[] = bsm.getBandOffsets();
int dOffsets[] = dbus.getOffsets();
dataOffsets = new int[bankIndices.length];
data = new short[bankIndices.length][];
int xOffset = aRegion.x - origin.x;
int yOffset = aRegion.y - origin.y;
for (int i = 0; i < bankIndices.length; i++) {
data[i] = stealData(dbus, bankIndices[i]);
dataOffsets[i] = dOffsets[bankIndices[i]] +
xOffset + yOffset*scanlineStride + bandOffsets[i];
}
} else {
throw new RasterFormatException("ShortBandedRasters must have "+
"BandedSampleModels");
}
verify();
}
示例2: ShortBandedRaster
import java.awt.image.DataBufferUShort; //导入方法依赖的package包/类
/**
* Constructs a ShortBandedRaster with the given SampleModel,
* DataBuffer, and parent. DataBuffer must be a DataBufferUShort and
* SampleModel must be of type BandedSampleModel.
* When translated into the base Raster's
* coordinate system, aRegion must be contained by the base Raster.
* Origin is the coordinate in the new Raster's coordinate system of
* the origin of the base Raster. (The base Raster is the Raster's
* ancestor which has no parent.)
*
* Note that this constructor should generally be called by other
* constructors or create methods, it should not be used directly.
* @param sampleModel The SampleModel that specifies the layout.
* @param dataBuffer The DataBufferUShort that contains the image data.
* @param aRegion The Rectangle that specifies the image area.
* @param origin The Point that specifies the origin.
* @param parent The parent (if any) of this raster.
*/
public ShortBandedRaster(SampleModel sampleModel,
DataBufferUShort dataBuffer,
Rectangle aRegion,
Point origin,
ShortBandedRaster parent)
{
super(sampleModel, dataBuffer, aRegion, origin, parent);
this.maxX = minX + width;
this.maxY = minY + height;
if (sampleModel instanceof BandedSampleModel) {
BandedSampleModel bsm = (BandedSampleModel)sampleModel;
this.scanlineStride = bsm.getScanlineStride();
int bankIndices[] = bsm.getBankIndices();
int bandOffsets[] = bsm.getBandOffsets();
int dOffsets[] = dataBuffer.getOffsets();
dataOffsets = new int[bankIndices.length];
data = new short[bankIndices.length][];
int xOffset = aRegion.x - origin.x;
int yOffset = aRegion.y - origin.y;
for (int i = 0; i < bankIndices.length; i++) {
data[i] = stealData(dataBuffer, bankIndices[i]);
dataOffsets[i] = dOffsets[bankIndices[i]] +
xOffset + yOffset*scanlineStride + bandOffsets[i];
}
} else {
throw new RasterFormatException("ShortBandedRasters must have "+
"BandedSampleModels");
}
verify();
}
示例3: ShortBandedRaster
import java.awt.image.DataBufferUShort; //导入方法依赖的package包/类
/**
* Constructs a ShortBandedRaster with the given SampleModel,
* DataBuffer, and parent. DataBuffer must be a DataBufferUShort and
* SampleModel must be of type BandedSampleModel.
* When translated into the base Raster's
* coordinate system, aRegion must be contained by the base Raster.
* Origin is the coordinate in the new Raster's coordinate system of
* the origin of the base Raster. (The base Raster is the Raster's
* ancestor which has no parent.)
*
* Note that this constructor should generally be called by other
* constructors or create methods, it should not be used directly.
* @param sampleModel The SampleModel that specifies the layout.
* @param dataBuffer The DataBufferUShort that contains the image data.
* @param aRegion The Rectangle that specifies the image area.
* @param origin The Point that specifies the origin.
* @param parent The parent (if any) of this raster.
*/
public ShortBandedRaster(SampleModel sampleModel,
DataBuffer dataBuffer,
Rectangle aRegion,
Point origin,
ShortBandedRaster parent) {
super(sampleModel, dataBuffer, aRegion, origin, parent);
this.maxX = minX + width;
this.maxY = minY + height;
if (!(dataBuffer instanceof DataBufferUShort)) {
throw new RasterFormatException("ShortBandedRaster must have " +
"ushort DataBuffers");
}
DataBufferUShort dbus = (DataBufferUShort)dataBuffer;
if (sampleModel instanceof BandedSampleModel) {
BandedSampleModel bsm = (BandedSampleModel)sampleModel;
this.scanlineStride = bsm.getScanlineStride();
int bankIndices[] = bsm.getBankIndices();
int bandOffsets[] = bsm.getBandOffsets();
int dOffsets[] = dbus.getOffsets();
dataOffsets = new int[bankIndices.length];
data = new short[bankIndices.length][];
int xOffset = aRegion.x - origin.x;
int yOffset = aRegion.y - origin.y;
for (int i = 0; i < bankIndices.length; i++) {
data[i] = stealData(dbus, bankIndices[i]);
dataOffsets[i] = dOffsets[bankIndices[i]] +
xOffset + yOffset*scanlineStride + bandOffsets[i];
}
} else {
throw new RasterFormatException("ShortBandedRasters must have "+
"BandedSampleModels");
}
verify(false);
}
示例4: clone
import java.awt.image.DataBufferUShort; //导入方法依赖的package包/类
public static DataBufferUShort clone(DataBufferUShort dataBuffer) {
return new DataBufferUShort(clone(dataBuffer.getBankData()), dataBuffer.getSize(), dataBuffer.getOffsets());
}