Package io.scanbot.sdk.util.snap
Object Utils
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
Utils.AspectRatioComparator
Compares Camera.Size according to aspect ratio it represents regards to matching to some perfect desired target aspect ratio.
For example:
Collections.min(sizes, AspectRatioComparator(targetAspect))
will return the size whose aspect ratio is closest to target.
-
Method Summary
Modifier and Type Method Description final static Boolean
isFlashSupported(Camera.Parameters parameters)
final static Camera.Size
getLargestPictureSize(Camera.Parameters parameters)
Returns the biggest size for resulting image final static Camera.Size
getLargestSizeWithAspectRatioMatch(List<Camera.Size> sizes, Double targetAspect)
final static Camera.Size
findByWidthAndHeight(Camera.Parameters parameters, Integer width, Integer height)
final static Camera.Size
getBestAspectPictureSize(Integer displayOrientation, Integer width, Integer height, Camera.Parameters parameters, Double closeEnough)
final static Unit
enableContinuousFocus(Camera.Parameters parameters)
Sets focus mode to Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE or Camera.Parameters.FOCUS_MODE_AUTO if supported final static Unit
enableAutoFocus(Camera.Parameters parameters)
Sets focus mode to Camera.Parameters.FOCUS_MODE_AUTO if supported -
-
Method Detail
-
isFlashSupported
final static Boolean isFlashSupported(Camera.Parameters parameters)
- Parameters:
parameters
- Currently selected camera parameters
-
getLargestPictureSize
final static Camera.Size getLargestPictureSize(Camera.Parameters parameters)
Returns the biggest size for resulting image
-
getLargestSizeWithAspectRatioMatch
final static Camera.Size getLargestSizeWithAspectRatioMatch(List<Camera.Size> sizes, Double targetAspect)
-
findByWidthAndHeight
final static Camera.Size findByWidthAndHeight(Camera.Parameters parameters, Integer width, Integer height)
-
getBestAspectPictureSize
final static Camera.Size getBestAspectPictureSize(Integer displayOrientation, Integer width, Integer height, Camera.Parameters parameters, Double closeEnough)
- Parameters:
displayOrientation
- display orientation angle (0-270)width
- target display port widthheight
- target display port heightparameters
- Camera.Parameters to get supported sizes fromcloseEnough
- maximum deviation to stop searching for best size, pass 0 to go through all sizes
-
enableContinuousFocus
final static Unit enableContinuousFocus(Camera.Parameters parameters)
Sets focus mode to Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE or Camera.Parameters.FOCUS_MODE_AUTO if supported
- Parameters:
parameters
- target parameters to set focus mode to
-
enableAutoFocus
final static Unit enableAutoFocus(Camera.Parameters parameters)
Sets focus mode to Camera.Parameters.FOCUS_MODE_AUTO if supported
-
-
-
-