determineViewFinderCrop

fun determineViewFinderCrop(cameraPreviewImageSize: Size, previewBounds: Rect, viewFinder: Rect): Rect

Determine how to crop the preview image from the camera based on the view finder's position in the preview bounds.

Note: This algorithm makes some assumptions:

  1. the previewBounds and the cameraPreviewImageSize are centered relative to each other.

  2. the previewBounds circumscribes the cameraPreviewImageSize. I.E. they share at least one field of view, and the cameraPreviewImageSize fields of view are smaller than or the same size as the previewBounds

  3. the previewBounds and the cameraPreviewImageSize have the same orientation