resizeRegion

fun Size.resizeRegion(originalRegion: Rect, newRegion: Rect, newSize: Size): Map<Rect, Rect>

This method allows relocating and resizing a portion of a Size. It returns the required translations required to achieve this relocation. This is useful for zooming in on sections of an image.

For example, given a size 5x5 and an original region (2, 2, 3, 3):

| | | _ | | || | | | |______|

If the newRegion is (1, 1, 4, 4) and the newSize is 6x6, the result will look like this:

| ___ | | | | | | | | | | || | | | |_____|

Nine individual translations will be returned for the affected regions. The returned Rects will look like this:

|||| | | | | | | | | |||| | | | | ||||