class TransformationInfo


Transformation information associated with the preview output.

This information can be used to transform the Surface of a Viewfinder to be suitable to be displayed.

Summary

Constants

const Float

A crop value specifying no crop should be applied.

Public companion properties

TransformationInfo

A TransformationInfo with default values.

Public constructors

TransformationInfo(
    sourceRotation: Int,
    isSourceMirroredHorizontally: Boolean,
    isSourceMirroredVertically: Boolean,
    cropRectLeft: Float,
    cropRectTop: Float,
    cropRectRight: Float,
    cropRectBottom: Float
)

Public functions

open operator Boolean
equals(other: Any?)
open Int

Public properties

Float

Bottom offset of the cropRect in pixels

Float

Left offset of the cropRect in pixels.

Float

Right offset of the cropRect in pixels

Float

Top offset of the cropRect in pixels

Boolean

Indicates whether the source has been mirrored horizontally.

Boolean

Indicates whether the source has been mirrored vertically.

Int

Rotation of the source, relative to the device's natural rotation, in degrees.

Constants

CROP_NONE

const val CROP_NONEFloat

A crop value specifying no crop should be applied.

When used as a value for TransformationInfo.cropRectLeft, TransformationInfo.cropRectTop, TransformationInfo.cropRectRight, or TransformationInfo.cropRectBottom, the crop rect dimension will be equivalent to the resolution of the untransformed surface.

Public companion properties

DEFAULT

val DEFAULTTransformationInfo

A TransformationInfo with default values.

This transformation info instance has no source rotation, no mirroring, and no crop rectangle.

Public constructors

TransformationInfo

Added in 1.5.0-beta01
TransformationInfo(
    sourceRotation: Int = 0,
    isSourceMirroredHorizontally: Boolean = false,
    isSourceMirroredVertically: Boolean = false,
    cropRectLeft: Float = CROP_NONE,
    cropRectTop: Float = CROP_NONE,
    cropRectRight: Float = CROP_NONE,
    cropRectBottom: Float = CROP_NONE
)

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

Public properties

cropRectBottom

Added in 1.5.0-beta01
val cropRectBottomFloat

Bottom offset of the cropRect in pixels

The offset is in the coordinates of the original surface, before rotation or mirroring.

If not set, this value will default to CROP_NONE, which is equivalent to an offset of the height of the surface.

cropRectLeft

Added in 1.5.0-beta01
val cropRectLeftFloat

Left offset of the cropRect in pixels.

The offset is in the coordinates of the original surface, before rotation or mirroring.

If not set, this value will default to CROP_NONE, which is equivalent to an offset of 0.

cropRectRight

Added in 1.5.0-beta01
val cropRectRightFloat

Right offset of the cropRect in pixels

The offset is in the coordinates of the original surface, before rotation or mirroring.

If not set, this value will default to CROP_NONE, which is equivalent to an offset of the width of the surface.

cropRectTop

Added in 1.5.0-beta01
val cropRectTopFloat

Top offset of the cropRect in pixels

The offset is in the coordinates of the original surface, before rotation or mirroring.

If not set, this value will default to CROP_NONE, which is equivalent to an offset of 0.

isSourceMirroredHorizontally

Added in 1.5.0-beta01
val isSourceMirroredHorizontallyBoolean

Indicates whether the source has been mirrored horizontally.

This is common if the source comes from a camera that is front-facing.

It is not common for both isSourceMirroredHorizontally and isSourceMirroredVertically to be set to true. This is equivalent to sourceRotation being rotated by an additional 180 degrees.

isSourceMirroredVertically

Added in 1.5.0-beta01
val isSourceMirroredVerticallyBoolean

Indicates whether the source has been mirrored vertically.

It is not common for a camera source to be mirror vertically, and typically isSourceMirroredHorizontally will be the appropriate property.

It is not common for both isSourceMirroredHorizontally and isSourceMirroredVertically to be set to true. This is equivalent to sourceRotation being rotated by an additional 180 degrees.

See also
MIRROR_MODE_V

sourceRotation

Added in 1.5.0-beta01
val sourceRotationInt

Rotation of the source, relative to the device's natural rotation, in degrees.