# MeteringPointFactory

Artifact: [androidx.camera:camera-core](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/core/MeteringPointFactory.java+class:androidx.camera.core.MeteringPointFactory) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

*** ** * ** ***


```
public abstract class MeteringPointFactory
```

<br />

Known direct subclasses [DisplayOrientedMeteringPointFactory](https://developer.android.com/reference/androidx/camera/core/DisplayOrientedMeteringPointFactory), [SurfaceOrientedMeteringPointFactory](https://developer.android.com/reference/androidx/camera/core/SurfaceOrientedMeteringPointFactory)

|---|---|
| `https://developer.android.com/reference/androidx/camera/core/DisplayOrientedMeteringPointFactory` | A `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory` that can convert a `https://developer.android.com/reference/android/view/View.html` (x, y) into a `https://developer.android.com/reference/androidx/camera/core/MeteringPoint` which can then be used to construct a `https://developer.android.com/reference/androidx/camera/core/FocusMeteringAction` to start a focus and metering action. |
| `https://developer.android.com/reference/androidx/camera/core/SurfaceOrientedMeteringPointFactory` | A `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory` that can create `https://developer.android.com/reference/androidx/camera/core/MeteringPoint` by surface oriented x, y on an area defined by (0, 0) - (width, height). |

*** ** * ** ***

A factory to create a `https://developer.android.com/reference/androidx/camera/core/MeteringPoint`.

Users can call `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory#createPoint(float,float)` to create a `https://developer.android.com/reference/androidx/camera/core/MeteringPoint` with x, y, default size. There is also another variant, `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory#createPoint(float,float,float)` for apps that want to also specify size.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/MeteringPoint` |   |
| `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory#createPoint(float,float)` |   |
| `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory#createPoint(float,float,float)` |   |

## Summary

| ### Public methods |
|---|---|
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/MeteringPoint` | `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory#createPoint(float,float)(float x, float y)` Creates a `https://developer.android.com/reference/androidx/camera/core/MeteringPoint` by x, y. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/MeteringPoint` | `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory#createPoint(float,float,float)(float x, float y, float size)` Creates a `https://developer.android.com/reference/androidx/camera/core/MeteringPoint` by x, y, size. |
| `static float` | `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory#getDefaultPointSize()()` Returns default point size. |

## Public methods

### createPoint

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

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

Creates a `https://developer.android.com/reference/androidx/camera/core/MeteringPoint` by x, y.

The (x, y) is a position from the area defined by the specific `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory` implementation, such as `https://developer.android.com/reference/androidx/camera/core/DisplayOrientedMeteringPointFactory` or `https://developer.android.com/reference/androidx/camera/core/SurfaceOrientedMeteringPointFactory`.

| Parameters |
|---|---|
| `float x` | x to be converted. |
| `float y` | y to be converted. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/MeteringPoint` | A `https://developer.android.com/reference/androidx/camera/core/MeteringPoint` that is converted into normalized surface (x, y). |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/DisplayOrientedMeteringPointFactory` |   |
| `https://developer.android.com/reference/androidx/camera/core/SurfaceOrientedMeteringPointFactory` |   |

### createPoint

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

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

Creates a `https://developer.android.com/reference/androidx/camera/core/MeteringPoint` by x, y, size.

The (x, y) is a position from the area defined by the specific `https://developer.android.com/reference/androidx/camera/core/MeteringPointFactory` implementation, such as `https://developer.android.com/reference/androidx/camera/core/DisplayOrientedMeteringPointFactory` or `https://developer.android.com/reference/androidx/camera/core/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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/MeteringPoint` | A `https://developer.android.com/reference/androidx/camera/core/MeteringPoint` that is converted into normalized surface (x, y). |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/DisplayOrientedMeteringPointFactory` |   |
| `https://developer.android.com/reference/androidx/camera/core/SurfaceOrientedMeteringPointFactory` |   |

### getDefaultPointSize

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#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 |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/MeteringPoint#getSize()` |   |