fun createWritableChild( x: Int, y: Int, width: Int, height: Int, x0: Int, y0: Int, bandList: IntArray? ): java.awt.image.WritableRaster? { if (x < this.minX) { throw java.awt.image.RasterFormatException("x lies outside the raster") } if (y < this.minY) { throw java.awt.image.RasterFormatException("y lies outside the raster") } if (x + width < x || x + width > this.minX + width) { throw java.awt.image.RasterFormatException("(x + width) is outside of Raster") } if (y + height < y || y + height > this.minY + height) { throw java.awt.image.RasterFormatException("(y + height) is outside of Raster") } val sm: java.awt.image.SampleModel if (bandList != null) sm = sampleModel.createSubsetSampleModel(bandList) else sm = sampleModel val deltaX = x0 - x val deltaY = y0 - y return sun.awt.image.ShortInterleavedRaster( sm, dataBuffer, java.awt.Rectangle(x0, y0, width, height), Point(sampleModelTranslateX + deltaX, sampleModelTranslateY + deltaY), this ) }
Creates a Writable subRaster given a region of the Raster . The x and y coordinates specify the horizontal and vertical offsets from the upper-left corner of this Raster to the upper-left corner of the subRaster . A subset of the bands of the parent Raster may be specified . If this is null , then all the bands are present in the subRaster . A translation to the subRaster may also be specified . Note that the subRaster will reference the same DataBuffers as the parent Raster , but using different offsets .