The Android Developer Challenge is back! Submit your idea before December 2.

MeteringPointFactory

public abstract class MeteringPointFactory
extends Object

java.lang.Object
   ↳ androidx.camera.core.MeteringPointFactory


A Factory to create a MeteringPoint.

MeteringPointFactory implementations must extends this class and implement translatePoint(float x, float y). Users can call createPoint(float x, float y) to create a MeteringPoint with default areaSize and weight. There is a variation of createPoint that accepts areaSize and weight as well.

Summary

Constants

float DEFAULT_AREASIZE

float DEFAULT_WEIGHT

Fields

protected Rational mFOVAspectRatio

Public constructors

MeteringPointFactory()

Public methods

final MeteringPoint createPoint(float x, float y, float size, float weight)

Creates a MeteringPoint by x , y , areaSize and weight.

final MeteringPoint createPoint(float x, float y)

Creates a MeteringPoint by x, y.

Protected methods

abstract PointF translatePoint(float x, float y)

Translates a logical x/y into the normalized crop region x/y.

Inherited methods

Constants

DEFAULT_AREASIZE

public static final float DEFAULT_AREASIZE

Constant Value: 0.15

DEFAULT_WEIGHT

public static final float DEFAULT_WEIGHT

Constant Value: 1.0

Fields

mFOVAspectRatio

protected Rational mFOVAspectRatio

Public constructors

MeteringPointFactory

public MeteringPointFactory ()

Public methods

createPoint

public final MeteringPoint createPoint (float x, 
                float y, 
                float size, 
                float weight)

Creates a MeteringPoint by x , y , areaSize and weight.

The x/y is the position from the area defined by the width, height and the orientation in specific MeteringPointFactory implementation.

Parameters
x float: the logical x to be translated

y float: the logical y to be translated

size float: size of the point. The value is ranging from 0 to 1 meaning the percentage of crop region width/height.

weight float: weight of metering region ranging from 0 to 1.

Returns
MeteringPoint A MeteringPoint that is translated into normalized crop region x/y.

createPoint

public final MeteringPoint createPoint (float x, 
                float y)

Creates a MeteringPoint by x, y.

The x/y is the position from the area defined by the width, height and the orientation in specific MeteringPointFactory implementation.

Parameters
x float

y float

Returns
MeteringPoint

Protected methods

translatePoint

protected abstract PointF translatePoint (float x, 
                float y)

Translates a logical x/y into the normalized crop region x/y.

The logical x/y is with respect to related to the implementations. Implementations specify the logical width/height and define the orientation of the area. Some are sensor-oriented and some are display-oriented. The logical x/y is the position from the area defined by the width , height and the orientation. Implementation must implement this method for coordinates translation.

Parameters
x float: the logical x to be translated.

y float: the logical y to be translated.

Returns
PointF a PointF consisting of translated normalized crop region x/y,