Class FitXYStrategy
- java.lang.Object
-
- com.journeyapps.barcodescanner.camera.PreviewScalingStrategy
-
- com.journeyapps.barcodescanner.camera.FitXYStrategy
-
public class FitXYStrategy extends PreviewScalingStrategy
Scales the size so that it fits exactly. Aspect ratio is NOT preserved.
-
-
Constructor Summary
Constructors Constructor Description FitXYStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected floatgetScore(Size size, Size desired)Get a score for our size.RectscalePreview(Size previewSize, Size viewfinderSize)Scale the preview to match the viewfinder exactly.-
Methods inherited from class com.journeyapps.barcodescanner.camera.PreviewScalingStrategy
getBestPreviewOrder, getBestPreviewSize
-
-
-
-
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:
getScorein classPreviewScalingStrategy- 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:
scalePreviewin classPreviewScalingStrategy- Parameters:
previewSize- the size of the preview (camera), in current display orientationviewfinderSize- the size of the viewfinder (display), in current display orientation- Returns:
- a rect placing the preview
-
-