Returns a conservative estimate of the region of a specified source that is required in order to compute the pixels of a given destination rectangle. The computation may as appropriate clip the mapped
Rectangle
to the actual bounds of the source or may treat the source as having infinite extent. It is therefore the responsibility of the invoking object to constrain the region in accordance with its needs. Returning an empty
Rectangle
should indicate that the data of the source image in question are not required for the computation of the specified destination region. If the entire source image might be required to compute this destination region, then
getSourceImage(sourceIndex).getBounds()
should be returned.
To illustrate the issue of whether the source should be thought to have infinite extent, consider the case wherein computing a destination pixel requires multiple source pixels of context. At the source image boundary, these pixels might only be available if the source data were extrapolated, e.g., using a {@link BorderExtender}. If such an extender were available, destination pixels could be computed even if they mapped to a region on the source boundary so in this case the source could be considered to have infinite extent. If no such extender were available, only destination pixels with source context contained within the source image bounds could be considered so that it might be preferable to clip the rectangle to the source bounds.
@param destRect The
Rectangle
in destination coordinates.
@param sourceIndex The index of the source image.
@return A non-
null
Rectangle
indicatingthe required source region.
@throws IllegalArgumentException If the source index isnegative or greater than that of the last source.
@throws IllegalArgumentException If
destRect
is
null
.