From f570248cdd511b0f94ecb81d690e46ec6928cd80 Mon Sep 17 00:00:00 2001 From: zhujiayi Date: Sat, 16 Aug 2025 16:06:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=AA=E5=B1=8F=E6=96=B0=E5=A2=9E=E6=9D=83?= =?UTF-8?q?=E9=99=90=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jiayi Zhu --- api/@ohos.screenshot.d.ts | 72 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/api/@ohos.screenshot.d.ts b/api/@ohos.screenshot.d.ts index c8748b6620..d83783606a 100644 --- a/api/@ohos.screenshot.d.ts +++ b/api/@ohos.screenshot.d.ts @@ -58,6 +58,21 @@ declare namespace screenshot { * @systemapi Hide this for inner system use. * @since 11 */ + /** + * Takes a screenshot and saves it as a PixelMap object. + * + * @permission ohos.permission.CAPTURE_SCREEN or ohos.permission.CUSTOM_SCREEN_RECORDING + * @param { ScreenshotOptions } options - Screenshot options, which consist of screenRect, imageSize, and rotation. You need to set these parameters + * @param { AsyncCallback } callback - Callback used to return a PixelMap object. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @throws { BusinessError } 1400001 - Invalid display or screen. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 + */ function save(options: ScreenshotOptions, callback: AsyncCallback): void; /** @@ -77,6 +92,23 @@ declare namespace screenshot { * @systemapi Hide this for inner system use. * @since 20 */ + /** + * Screen capture, supporting HDR screenshots when there is HDR content. + * + * @permission ohos.permission.CAPTURE_SCREEN or ohos.permission.CUSTOM_SCREEN_RECORDING + * @param { HdrScreenshotOptions } [options] - Screenshot parameters. + * @returns { Promise> } Promise used to return a PixelMap array. When HDR content is available, + * return two PixelMap objects: the first one as SDR and the second one as HDR. When no HDR content is available, only return one SDR PixelMap object. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. + * @throws { BusinessError } 1400001 - Invalid display or screen. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @throws { BusinessError } 1400004 - Parameter error. Possible cause: 1.Invalid parameter range. + * @syscap SystemCapability.Window.SessionManager + * @systemapi Hide this for inner system use. + * @since 22 + */ function saveHdrPicture(options?: HdrScreenshotOptions): Promise>; /** @@ -90,6 +122,17 @@ declare namespace screenshot { * @systemapi Hide this for inner system use. * @since 7 */ + /** + * Takes a screenshot and saves it as a PixelMap object. + * + * @permission ohos.permission.CAPTURE_SCREEN or ohos.permission.CUSTOM_SCREEN_RECORDING + * @param { AsyncCallback } callback Callback used to return a PixelMap object. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 + */ function save(callback: AsyncCallback): void; /** @@ -106,6 +149,20 @@ declare namespace screenshot { * @systemapi Hide this for inner system use. * @since 7 */ + /** + * Takes a screenshot and saves it as a PixelMap object. + * + * @permission ohos.permission.CAPTURE_SCREEN or ohos.permission.CUSTOM_SCREEN_RECORDING + * @param { ScreenshotOptions } options Screenshot options, which consist of screenRect, imageSize, and rotation. You need to set these parameters + * @returns { Promise } Promise used to return a PixelMap object. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + *
2.Incorrect parameter types. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @systemapi Hide this for inner system use. + * @since 22 + */ function save(options?: ScreenshotOptions): Promise; /** @@ -123,6 +180,21 @@ declare namespace screenshot { * @atomicservice * @since 14 */ + /** + * Takes a capture and return as a PixelMap object. + * + * @permission ohos.permission.CUSTOM_SCREEN_CAPTURE or ohos.permission.CUSTOM_SCREEN_RECORDING + * @param { options } which consist of CaptureOption. + * @returns { Promise } Promise used to return a PixelMap object. + * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported on this device. + * @throws { BusinessError } 1400003 - This display manager service works abnormally. + * @syscap SystemCapability.WindowManager.WindowManager.Core + * @atomicservice + * @since 22 + */ function capture(options?: CaptureOption): Promise; /** -- Gitee