MeteringPointFactory

@RequiresApi(value = 21)
abstract class MeteringPointFactory

Known direct subclasses
DisplayOrientedMeteringPointFactory

A MeteringPointFactory that can convert a View (x, y) into a MeteringPoint which can then be used to construct a FocusMeteringAction to start a focus and metering action.

SurfaceOrientedMeteringPointFactory

A MeteringPointFactory that can create MeteringPoint by surface oriented x, y on an area defined by (0, 0) - (width, height).


A factory to create a MeteringPoint.

Users can call createPoint to create a MeteringPoint with x, y, default size. There is also another variant, createPoint for apps that want to also specify size.

Summary

Public functions

MeteringPoint

Creates a MeteringPoint by x, y.

MeteringPoint
createPoint(x: Float, y: Float, size: Float)

Creates a MeteringPoint by x, y, size.

java-static Float

Returns default point size.

Public functions

createPoint

Added in 1.0.0
fun createPoint(x: Float, y: Float): MeteringPoint

Creates a MeteringPoint by x, y.

The (x, y) is a position from the area defined by the specific MeteringPointFactory implementation, such as DisplayOrientedMeteringPointFactory or SurfaceOrientedMeteringPointFactory.

Parameters
x: Float

x to be converted.

y: Float

y to be converted.

Returns
MeteringPoint

A MeteringPoint that is converted into normalized surface (x, y).

createPoint

Added in 1.0.0
fun createPoint(x: Float, y: Float, size: Float): MeteringPoint

Creates a MeteringPoint by x, y, size.

The (x, y) is a position from the area defined by the specific MeteringPointFactory implementation, such as DisplayOrientedMeteringPointFactory or SurfaceOrientedMeteringPointFactory.

Parameters
x: Float

x to be converted.

y: Float

y to be converted.

size: Float

size of the MeteringPoint width and height(ranging from 0 to 1). It is the (normalized) percentage of the sensor width/height (or crop region width/height if crop region is set).

Returns
MeteringPoint

A MeteringPoint that is converted into normalized surface (x, y).

getDefaultPointSize

Added in 1.0.0
java-static fun getDefaultPointSize(): Float

Returns default point size. It is the default size of the MeteringPoint width and height (ranging from 0 to 1) which is a (normalized) percentage of the sensor width/height (or crop region width/height if crop region is set).

See also
getSize