ScreenCoordinateTransform

class ScreenCoordinateTransform(val screenSize: Size, val previewSize: Size, val videoGravity: VideoGravity = VideoGravity.RESIZE_ASPECT)

Converts between composition pixels and preview-local pixels using centered videoGravity.

Use the preview's actual pixel size, not dp. Create a new transform when either size or the gravity changes. Points outside the displayed content are not clamped; toScreen can return negative coordinates in letterbox bars. Invalid sizes or non-finite input return null.

Constructors

Link copied to clipboard
constructor(screenSize: Size, previewSize: Size, videoGravity: VideoGravity = VideoGravity.RESIZE_ASPECT)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun toPreview(point: PointF): PointF?

Maps a composition point to preview-local coordinates without clipping.

fun toPreview(bounds: RectF): RectF?

Maps a composition rectangle to preview-local coordinates without clipping.

Link copied to clipboard
fun toScreen(point: PointF): PointF?

Maps a preview-local point to composition coordinates without clamping.