Class DisplayConfiguration
- java.lang.Object
-
- com.journeyapps.barcodescanner.camera.DisplayConfiguration
-
public class DisplayConfiguration extends Object
-
-
Constructor Summary
Constructors Constructor Description DisplayConfiguration(int rotation)DisplayConfiguration(int rotation, Size viewfinderSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SizegetBestPreviewSize(List<Size> sizes, boolean isRotated)Choose the best preview size, based on our display size.SizegetDesiredPreviewSize(boolean rotate)PreviewScalingStrategygetPreviewScalingStrategy()intgetRotation()SizegetViewfinderSize()RectscalePreview(Size previewSize)Scale the preview to cover the viewfinder, then center it.voidsetPreviewScalingStrategy(PreviewScalingStrategy previewScalingStrategy)
-
-
-
Constructor Detail
-
DisplayConfiguration
public DisplayConfiguration(int rotation)
-
DisplayConfiguration
public DisplayConfiguration(int rotation, Size viewfinderSize)
-
-
Method Detail
-
getRotation
public int getRotation()
-
getViewfinderSize
public Size getViewfinderSize()
-
getPreviewScalingStrategy
public PreviewScalingStrategy getPreviewScalingStrategy()
-
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
-
-