openharmony 鸿蒙 arkts-apis-camera-Macro

2026-08-25 浏览 (1)

Interface (Macro)

Macro inherits from MacroQuery.

It provides the API to enable macro photography.

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 19.

Modules to Import

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

enableMacro19+

enableMacro(enabled: boolean): void

Enables or disables macro photography.

NOTE

Before calling this API, call isMacroSupported to check whether the current device supports macro photography.

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

System capability: SystemCapability.Multimedia.Camera.Core

Parameters

NameTypeMandatoryDescription
enabledbooleanYesWhether to enable macro photography. true to enable, false otherwise.

Error codes

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

IDError Message
7400102Operation not allowed.
7400103Session not config.

Example

function enableMacro(photoSession: camera.PhotoSession): void {
  let isSupported: boolean = photoSession.isMacroSupported();
  if (isSupported) {
    photoSession.enableMacro(true);
  }
}

你可能感兴趣的鸿蒙文章

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/Q96kljYq