@Override public byte[] getPixel( int x, int y, byte[] result ) { if ( getView().dataInfo.bands != dataInfo.bands ) { return super.getPixel( x, y, result ); } if ( result == null ) { result = new byte[dataInfo.noDataPixel.length]; } int pos = calculatePos( x, y ); if ( pos == -1 ) { System.arraycopy( dataInfo.noDataPixel, 0, result, 0, result.length ); } else { ByteBuffer data = getByteBuffer().asReadOnlyBuffer(); data.position( pos ); data.get( result, 0, dataInfo.noDataPixel.length ); } return result; }
for ( int y = 0; y < height; y++ ) { for ( int x = 0; x < width; x++ ) { raster.getPixel( x, y, buf ); outputRaster.setDataElements( x, y, mapToRGB( output, buf, view.bandInfo ) );