Instance Method

captureDevicePointConverted(fromLayerPoint:)

Converts a point from layer coordinates to the coordinate space of the capture device.

Declaration

func captureDevicePointConverted(fromLayerPoint pointInLayer: CGPoint) -> CGPoint

Parameters

pointInLayer

A point in the coordinate system of this layer object. The coordinates of this point represent pixel values.

Return Value

A scalar point whose coordinates are relative to the coordinate system of the capture device that is providing input to the layer.

Discussion

The coordinates in the point structure returned by this method are in the range 0.0 to 1.0. The point (0.0, 0.0) corresponds to the top left corner of the unrotated picture and the point (1.0, 1.0) represents the bottom right corner of the unrotated picture.

The conversion performed by this method takes the layer’s frame size and the receiver’s videoGravity property into consideration.

See Also

Converting Between Coordinate Systems

func layerPointConverted(fromCaptureDevicePoint: CGPoint) -> CGPoint

Converts a point from the coordinate space of the capture device to the coordinate space of the layer.

func transformedMetadataObject(for: AVMetadataObject) -> AVMetadataObject?

Converts a metadata object’s visual properties to layer coordinates.

func metadataOutputRectConverted(fromLayerRect: CGRect) -> CGRect

Converts a rectangle in the preview layer’s coordinate system to one in the coordinate system used for metadata outputs.

func layerRectConverted(fromMetadataOutputRect: CGRect) -> CGRect

Converts a rectangle in the coordinate system used for metadata outputs to one in the preview layer’s coordinate system.