TargetAspectRatio

public class TargetAspectRatio


Workaround to get corrected target aspect ratio.

Summary

Constants

static final @NonNull int

16:9 standard aspect ratio.

static final @NonNull int

4:3 standard aspect ratio.

static final @NonNull int

The same aspect ratio as the maximum JPEG resolution.

static final @NonNull int

No correction is needed.

Public methods

@TargetAspectRatio.Ratio @NonNull int
get(
    @NonNull ImageOutputConfig imageOutputConfig,
    @NonNull String cameraId,
    @NonNull CameraCharacteristicsCompat cameraCharacteristicsCompat
)

Gets corrected target aspect ratio based on device and camera quirks.

Constants

RATIO_16_9

@NonNull
public static final @NonNull int RATIO_16_9

16:9 standard aspect ratio.

RATIO_4_3

@NonNull
public static final @NonNull int RATIO_4_3

4:3 standard aspect ratio.

RATIO_MAX_JPEG

@NonNull
public static final @NonNull int RATIO_MAX_JPEG

The same aspect ratio as the maximum JPEG resolution.

RATIO_ORIGINAL

@NonNull
public static final @NonNull int RATIO_ORIGINAL

No correction is needed.

Public methods

get

@TargetAspectRatio.Ratio
@NonNull
public @TargetAspectRatio.Ratio int get(
    @NonNull ImageOutputConfig imageOutputConfig,
    @NonNull String cameraId,
    @NonNull CameraCharacteristicsCompat cameraCharacteristicsCompat
)

Gets corrected target aspect ratio based on device and camera quirks.