# 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)

*** ** * ** ***


```
abstract class MeteringPointFactory
```

<br />

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

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/DisplayOrientedMeteringPointFactory` | A `https://developer.android.com/reference/kotlin/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/kotlin/androidx/camera/core/MeteringPoint` which can then be used to construct a `https://developer.android.com/reference/kotlin/androidx/camera/core/FocusMeteringAction` to start a focus and metering action. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceOrientedMeteringPointFactory` | A `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPointFactory` that can create `https://developer.android.com/reference/kotlin/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/kotlin/androidx/camera/core/MeteringPoint`.

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

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

## Summary

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPoint` | `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPointFactory#createPoint(float,float)(x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Creates a `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPoint` by x, y. |
| `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPoint` | `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPointFactory#createPoint(float,float,float)(x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Creates a `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPoint` by x, y, size. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPointFactory#getDefaultPointSize()()` Returns default point size. |

## Public functions

### createPoint

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

```
fun createPoint(x: Float, y: Float): MeteringPoint
```

Creates a `https://developer.android.com/reference/kotlin/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/kotlin/androidx/camera/core/MeteringPointFactory` implementation, such as `https://developer.android.com/reference/kotlin/androidx/camera/core/DisplayOrientedMeteringPointFactory` or `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceOrientedMeteringPointFactory`.

| Parameters |
|---|---|
| `x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | x to be converted. |
| `y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | y to be converted. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPoint` | A `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPoint` that is converted into normalized surface (x, y). |

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

### createPoint

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

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

Creates a `https://developer.android.com/reference/kotlin/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/kotlin/androidx/camera/core/MeteringPointFactory` implementation, such as `https://developer.android.com/reference/kotlin/androidx/camera/core/DisplayOrientedMeteringPointFactory` or `https://developer.android.com/reference/kotlin/androidx/camera/core/SurfaceOrientedMeteringPointFactory`.

| Parameters |
|---|---|
| `x: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | x to be converted. |
| `y: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | y to be converted. |
| `size: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | 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://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPoint` | A `https://developer.android.com/reference/kotlin/androidx/camera/core/MeteringPoint` that is converted into normalized surface (x, y). |

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

### getDefaultPointSize

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