Class FitXYStrategy


  • public class FitXYStrategy
    extends PreviewScalingStrategy
    Scales the size so that it fits exactly. Aspect ratio is NOT preserved.
    • Constructor Detail

      • FitXYStrategy

        public FitXYStrategy()
    • Method Detail

      • getScore

        protected float getScore​(Size size,
                                 Size desired)
        Get a score for our size. Based on heuristics for penalizing scaling and cropping. 1.0 is perfect (exact match). 0.0 means we can't use it at all.
        Overrides:
        getScore in class PreviewScalingStrategy
        Parameters:
        size - the camera preview size (that can be scaled)
        desired - the viewfinder size
        Returns:
        the score
      • scalePreview

        public Rect scalePreview​(Size previewSize,
                                 Size viewfinderSize)
        Scale the preview to match the viewfinder exactly.
        Specified by:
        scalePreview in class PreviewScalingStrategy
        Parameters:
        previewSize - the size of the preview (camera), in current display orientation
        viewfinderSize - the size of the viewfinder (display), in current display orientation
        Returns:
        a rect placing the preview