MeteringPointFactory

@RequiresApi(value = 21)
public 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 methods

final @NonNull MeteringPoint
createPoint(float x, float y)

Creates a MeteringPoint by x, y.

final @NonNull MeteringPoint
createPoint(float x, float y, float size)

Creates a MeteringPoint by x, y, size.

static float

Returns default point size.

Public methods

createPoint

Added in 1.0.0
public final @NonNull MeteringPoint createPoint(float x, float y)

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
float x

x to be converted.

float y

y to be converted.

Returns
@NonNull MeteringPoint

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

createPoint

Added in 1.0.0
public final @NonNull MeteringPoint createPoint(float x, float y, float size)

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
float x

x to be converted.

float y

y to be converted.

float size

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
@NonNull MeteringPoint

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

getDefaultPointSize

Added in 1.0.0
public static float getDefaultPointSize()

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