Class DisplayConfiguration


  • public class DisplayConfiguration
    extends Object
    • Constructor Detail

      • DisplayConfiguration

        public DisplayConfiguration​(int rotation)
      • DisplayConfiguration

        public DisplayConfiguration​(int rotation,
                                    Size viewfinderSize)
    • Method Detail

      • getRotation

        public int getRotation()
      • getViewfinderSize

        public Size getViewfinderSize()
      • setPreviewScalingStrategy

        public void setPreviewScalingStrategy​(PreviewScalingStrategy previewScalingStrategy)
      • getDesiredPreviewSize

        public Size getDesiredPreviewSize​(boolean rotate)
        Parameters:
        rotate - true to rotate the preview size
        Returns:
        desired preview size in natural camera orientation.
      • getBestPreviewSize

        public Size getBestPreviewSize​(List<Size> sizes,
                                       boolean isRotated)
        Choose the best preview size, based on our display size. We prefer: 1. no scaling 2. least downscaling 3. least upscaling We do not care much about aspect ratio, since we just crop away extra pixels. We only choose the size to minimize scaling. In the future we may consider choosing the biggest possible preview size, to maximize the resolution we have for decoding. We need more testing to see whether or not that is feasible.
        Parameters:
        sizes - supported preview sizes, containing at least one size. Sizes are in natural camera orientation.
        isRotated - true if the camera is rotated perpendicular to the current display orientation
        Returns:
        the best preview size, never null
      • scalePreview

        public Rect scalePreview​(Size previewSize)
        Scale the preview to cover the viewfinder, then center it. Aspect ratio is preserved.
        Parameters:
        previewSize - the size of the preview (camera), in current display orientation
        Returns:
        a rect placing the preview