getMeteringAreas method

Future<List<CameraArea>?> getMeteringAreas()

Gets the current metering areas.

Camera driver uses these areas to decide exposure.

Before using this API or setMeteringAreas, apps should call getMaxNumMeteringAreas to know the maximum number of metering areas first. If the value is 0, metering area is not supported.

Each metering area is a rectangle with specified weight. The direction is relative to the sensor orientation, that is, what the sensor sees. The direction is not affected by the rotation or mirroring of Camera.setDisplayOrientation. Coordinates of the rectangle range from -1000 to 1000. (-1000, -1000) is the upper left point. (1000, 1000) is the lower right point. The width and height of metering areas cannot be 0 or negative.

The weight must range from 1 to 1000, and represents a weight for every pixel in the area. This means that a large metering area with the same weight as a smaller area will have more effect in the metering result. Metering areas can partially overlap and the driver will add the weights in the overlap region.

A special case of a null metering area list means the driver is free to meter as it chooses. For example, the driver may use more signals to select metering areas and change them dynamically. Apps can set the metering area list to null if they want the driver to completely control metering.

Metering areas are relative to the current field of view (getZoom). No matter what the zoom level is, (-1000,-1000) represents the top of the currently visible camera frame. The metering area cannot be set to be outside the current field of view, even when using zoom.

No matter what metering areas are, the final exposure are compensated by setExposureCompensation.

Implementation

Future<List<CameraArea>?> getMeteringAreas() async {
  final List<Object?>? areas =
      await _channel.$getMeteringAreas(this) as List<Object?>?;
  return areas?.cast<CameraArea>();
}