376 ArrayIndexOutOfBoundsException("Bank indices array is null");
377 }
378 if (bandOffsets == null) {
379 throw new
380 ArrayIndexOutOfBoundsException("Band offsets array is null");
381 }
382
383 // Figure out the #banks and the largest band offset
384 int maxBank = bankIndices[0];
385 int maxBandOff = bandOffsets[0];
386 for (int i = 1; i < bands; i++) {
387 if (bankIndices[i] > maxBank) {
388 maxBank = bankIndices[i];
389 }
390 if (bandOffsets[i] > maxBandOff) {
391 maxBandOff = bandOffsets[i];
392 }
393 }
394 int banks = maxBank + 1;
395 int size = maxBandOff +
396 scanlineStride * (h - 1) + // fisrt (h - 1) scans
397 w; // last scan
398
399 switch(dataType) {
400 case DataBuffer.TYPE_BYTE:
401 d = new DataBufferByte(size, banks);
402 break;
403
404 case DataBuffer.TYPE_USHORT:
405 d = new DataBufferUShort(size, banks);
406 break;
407
408 case DataBuffer.TYPE_INT:
409 d = new DataBufferInt(size, banks);
410 break;
411
412 default:
413 throw new IllegalArgumentException("Unsupported data type " +
414 dataType);
415 }
416
|
376 ArrayIndexOutOfBoundsException("Bank indices array is null");
377 }
378 if (bandOffsets == null) {
379 throw new
380 ArrayIndexOutOfBoundsException("Band offsets array is null");
381 }
382
383 // Figure out the #banks and the largest band offset
384 int maxBank = bankIndices[0];
385 int maxBandOff = bandOffsets[0];
386 for (int i = 1; i < bands; i++) {
387 if (bankIndices[i] > maxBank) {
388 maxBank = bankIndices[i];
389 }
390 if (bandOffsets[i] > maxBandOff) {
391 maxBandOff = bandOffsets[i];
392 }
393 }
394 int banks = maxBank + 1;
395 int size = maxBandOff +
396 scanlineStride * (h - 1) + // first (h - 1) scans
397 w; // last scan
398
399 switch(dataType) {
400 case DataBuffer.TYPE_BYTE:
401 d = new DataBufferByte(size, banks);
402 break;
403
404 case DataBuffer.TYPE_USHORT:
405 d = new DataBufferUShort(size, banks);
406 break;
407
408 case DataBuffer.TYPE_INT:
409 d = new DataBufferInt(size, banks);
410 break;
411
412 default:
413 throw new IllegalArgumentException("Unsupported data type " +
414 dataType);
415 }
416
|