public void setSubset( int dstX, int dstY, int width, int height, int dstBand, RasterData srcRaster, int srcBand, int srcX, int srcY ) { // clamp to maximum possible size // int subWidth = min( this.rasterWidth - dstX, width, srcRaster.getWidth() ); // int subHeight = min( this.rasterHeight - dstY, height, srcRaster.getHeight() ); int subWidth = clampSize( getColumns(), dstX, srcRaster.getColumns(), srcX, width ); int subHeight = clampSize( getRows(), dstY, srcRaster.getRows(), srcY, height ); if ( subHeight <= 0 || subWidth <= 0 ) { return; } byte[] tmp = new byte[dataInfo.dataSize]; for ( int y = 0; y < subHeight; y++ ) { for ( int x = 0; x < subWidth; x++ ) { srcRaster.getSample( x + srcX, y + srcY, srcBand, tmp ); setSample( dstX + x, dstY + y, dstBand, tmp ); } } }
public void setSubset( int dstX, int dstY, int width, int height, RasterData srcRaster, int srcX, int srcY ) { // clamp to maximum possible size // int subWidth = min( this.rasterWidth - dstX, width, srcRaster.getWidth() ); // int subHeight = min( this.rasterHeight - dstY, height, srcRaster.getHeight() ); int subWidth = clampSize( getColumns(), dstX, srcRaster.getColumns(), srcX, width ); int subHeight = clampSize( getRows(), dstY, srcRaster.getRows(), srcY, height ); if ( subHeight <= 0 || subWidth <= 0 ) { return; } byte[] tmp = new byte[dataInfo.dataSize]; for ( int y = 0; y < subHeight; ++y ) { for ( int x = 0; x < subWidth; ++x ) { for ( int band = 0; band < this.getView().dataInfo.bands; band++ ) { srcRaster.getSample( x + srcX, y + srcY, band, tmp ); setSample( dstX + x, dstY + y, band, tmp ); } } } }