openharmony 鸿蒙 arkts-apis-camera-Aperture

2026-08-25 浏览 (1)

Interface (Aperture)

Aperture inherits from ApertureQuery.

Describes a physical aperture object.

NOTE

  • The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
  • The initial APIs of this interface are supported since API version 24.

Modules to Import

import { camera } from '@kit.CameraKit';

getPhysicalAperture24+

getPhysicalAperture(): number

Obtains the physical aperture in use.

Atomic service API: This API can be used in atomic services since API version 24.

System capability: SystemCapability.Multimedia.Camera.Core

Returns

TypeDescription
numberPhysical aperture in use.

Error Codes

For details about the error codes, see Camera Error Codes.

Error CodeError Message
7400102Operation not allowed, the inputDevice or the session is abnormal.
7400103Session not config.

Example

import { BusinessError } from '@kit.BasicServicesKit';

function getPhysicalAperture(photoSession: camera.PhotoSession): number {
  let aperture = 0.0;
  try {
    aperture = photoSession.getPhysicalAperture();
  } catch (error) {
    // If the operation fails, error.code is returned and processed.
    let err = error as BusinessError;
    console.error(`The getPhysicalAperture call failed. error code: ${err.code}`);
  }
  return aperture;
}

setPhysicalAperture24+

setPhysicalAperture(aperture: number): void

Sets a physical aperture.

Atomic service API: This API can be used in atomic services since API version 24.

System capability: SystemCapability.Multimedia.Camera.Core

Parameters

ParameterTypeMandatoryDescription
aperturenumberYesPhysical aperture.

Error Codes

For details about the error codes, see Camera Error Codes.

Error CodeError Message
7400102Operation not allowed, the inputDevice or the session is abnormal.
7400103Session not config.

Example

import { BusinessError } from '@kit.BasicServicesKit';

function setPhysicalAperture(photoSession: camera.PhotoSession, aperture: number): void {
  try {
    photoSession.setPhysicalAperture(aperture);
  } catch (error) {
    // If the operation fails, error.code is returned and processed.
    let err = error as BusinessError;
    console.error(`The setPhysicalAperture call failed. error code: ${err.code}`);
  }
}

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-oh-camera-capturesession-callbacks

openharmony 鸿蒙 arkts-apis-camera-OIS

openharmony 鸿蒙 capi-oh-camera-camera-devicequeryinfo

openharmony 鸿蒙 capi-oh-camera-camera-frameraterange

openharmony 鸿蒙 capi-oh-camera-camera-outputcapability

openharmony 鸿蒙 arkts-apis-camera-Photo

openharmony 鸿蒙 capi-oh-camera-camera-profile

openharmony 鸿蒙 capi-oh-camera-camera-manager

openharmony 鸿蒙 capi-oh-camera-previewoutput-callbacks

openharmony 鸿蒙 arkts-apis-camera-ManualExposureQuery

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/wE7yuraT