public final 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

static final float

A crop value specifying no crop should be applied.

Public fields

static final @NonNull TransformationInfo

A TransformationInfo with default values.

Public constructors

TransformationInfo(
    int sourceRotation,
    boolean isSourceMirroredHorizontally,
    boolean isSourceMirroredVertically,
    float cropRectLeft,
    float cropRectTop,
    float cropRectRight,
    float cropRectBottom
)

Public methods

boolean
equals(Object other)
final float

Bottom offset of the cropRect in pixels

final float

Left offset of the cropRect in pixels.

final float

Right offset of the cropRect in pixels

final float

Top offset of the cropRect in pixels

final int

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

int
final boolean

Indicates whether the source has been mirrored horizontally.

final boolean

Indicates whether the source has been mirrored vertically.

Constants

CROP_NONE

public static final float CROP_NONE

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 fields

DEFAULT

public static final @NonNull TransformationInfo DEFAULT

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
public TransformationInfo(
    int sourceRotation,
    boolean isSourceMirroredHorizontally,
    boolean isSourceMirroredVertically,
    float cropRectLeft,
    float cropRectTop,
    float cropRectRight,
    float cropRectBottom
)

Public methods

equals

public boolean equals(Object other)

getCropRectBottom

Added in 1.5.0-beta01
public final float getCropRectBottom()

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.

getCropRectLeft

Added in 1.5.0-beta01
public final float getCropRectLeft()

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.

getCropRectRight

Added in 1.5.0-beta01
public final float getCropRectRight()

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.

getCropRectTop

Added in 1.5.0-beta01
public final float getCropRectTop()

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.

getSourceRotation

Added in 1.5.0-beta01
public final int getSourceRotation()

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

hashCode

public int hashCode()

isSourceMirroredHorizontally

Added in 1.5.0-beta01
public final boolean isSourceMirroredHorizontally()

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
public final boolean isSourceMirroredVertically()

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