public java.nio.ByteBuffer ReadRaster_Direct(int xoff, int yoff, int xsize, int ysize, int buf_xsize, int buf_ysize, int buf_type) { long buf_size = buf_xsize * buf_ysize * (gdal.GetDataTypeSize(buf_type) / 8); if ((int)buf_size != buf_size) throw new OutOfMemoryError(); java.nio.ByteBuffer nioBuffer = java.nio.ByteBuffer.allocateDirect((int)buf_size); int ret = ReadRaster_Direct(xoff, yoff, xsize, ysize, buf_xsize, buf_ysize, buf_type, nioBuffer); if (ret == gdalconstConstants.CE_None) return nioBuffer; else return null; }
public java.nio.ByteBuffer ReadRaster_Direct(final int xoff, final int yoff, final int xsize, final int ysize, final int buf_xsize, final int buf_ysize, final int buf_type) { final long buf_size = buf_xsize * buf_ysize * (gdal.GetDataTypeSize(buf_type) / 8); if ((int)buf_size != buf_size) { throw new OutOfMemoryError(); } final java.nio.ByteBuffer nioBuffer = java.nio.ByteBuffer.allocateDirect((int)buf_size); final int ret = ReadRaster_Direct(xoff, yoff, xsize, ysize, buf_xsize, buf_ysize, buf_type, nioBuffer); if (ret == gdalconstConstants.CE_None) { return nioBuffer; } else { return null; } }
int pixels = imageWidth * imageHeight; int gdalBufferDataType = this.band.getDataType(); int bufferSize = pixels * gdal.GetDataTypeSize(gdalBufferDataType); ByteBuffer data = ByteBuffer.allocateDirect(bufferSize); data.order(ByteOrder.nativeOrder()); BufferedImage image = null; if (this.band.GetRasterColorInterpretation() == gdalconstConstants.GCI_PaletteIndex) { ColorModel cm = this.band.GetRasterColorTable().getIndexColorModel(gdal.GetDataTypeSize(gdalBufferDataType)); image = new BufferedImage(cm, writableRaster, false, null); } else if (imageDataBuffer instanceof DataBufferByte || imageDataBuffer instanceof DataBufferUShort) {
typeSizeInBytes = gdal.GetDataTypeSize(bufferType) / 8; bufferSize = nBands * pixels * typeSizeInBytes;
if ( BufferedImage.TYPE_BYTE_INDEXED == dataType ) { ColorTable ct = band.GetRasterColorTable(); IndexColorModel cm = ct.getIndexColorModel( gdal.GetDataTypeSize( bufType ) ); img = new BufferedImage( xSize, ySize, dataType, cm ); } else {
typeSizeInBytes = gdal.GetDataTypeSize(bufferType) / 8; bufferSize = nBands * pixels * typeSizeInBytes;
* gdal.GetDataTypeSize(bandDataType) / 8; colorModel = rasterColorTable.getIndexColorModel(gdal.GetDataTypeSize(bandDataType)); image = new BufferedImage(colorModel, raster, false, null); } else {
final int threshold = getMaxMemorySizeForGDALMemoryDataset(); final int neededMemory = width * height * nBands * gdal.GetDataTypeSize(dataType) / 8;
final int threshold = getMaxMemorySizeForGDALMemoryDataset(); final int neededMemory = width * height * nBands * gdal.GetDataTypeSize(dataType) / 8;
* (gdal.GetDataTypeSize(rband.getDataType()) / 8); try { ct = rband.GetRasterColorTable(); IndexColorModel icm = ct.getIndexColorModel(gdal.GetDataTypeSize(buf_type)); setColorModel(icm); } finally {
* (gdal.GetDataTypeSize(rband.getDataType()) / 8); try { ct = rband.GetRasterColorTable(); IndexColorModel icm = ct.getIndexColorModel(gdal.GetDataTypeSize(buf_type)); setColorModel(icm); } finally {
final int nBands, final int dataType, int xSubsamplingFactor, int ySubsamplingFactor) { final int typeSizeInBytes = gdal.GetDataTypeSize(dataType) / 8;
final int nBands, final int dataType, int xSubsamplingFactor, int ySubsamplingFactor) { final int typeSizeInBytes = gdal.GetDataTypeSize(dataType) / 8;