From a8be92cee73a2a13bf7d9db0b259150956856c52 Mon Sep 17 00:00:00 2001 From: zhaona45 Date: Mon, 4 Aug 2025 10:24:37 +0800 Subject: [PATCH] =?UTF-8?q?image=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3null/u?= =?UTF-8?q?ndefined=E9=9D=99=E6=80=81=E5=8C=96=E6=98=BE=E7=A4=BA=E5=A3=B0?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhaona45 Change-Id: Ifd32ee0724e9c5ffb2353542167430ffdb64fdd8 --- api/@ohos.multimedia.image.d.ts | 529 ++++++++++++++++++++++++++++---- 1 file changed, 465 insertions(+), 64 deletions(-) diff --git a/api/@ohos.multimedia.image.d.ts b/api/@ohos.multimedia.image.d.ts index e9e9f36629..b8057705f6 100644 --- a/api/@ohos.multimedia.image.d.ts +++ b/api/@ohos.multimedia.image.d.ts @@ -5348,11 +5348,23 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise; + /** + * Obtains the hdr pixel map. This method uses a promise to return the PixelMap object. + * + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @throws { BusinessError } 7600901 - Inner unknown error. Please check the logs for detailed information. + * @throws { BusinessError } 7600201 - Unsupported operation. e.g.,1. The picture does not has a gainmap. + * 2. MainPixelMap's allocator type is not DMA. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 20 + * @arkts 1.2 + */ + getHdrComposedPixelmap(): Promise; + /** * Obtains the gain map pixel map. * @returns { PixelMap | null } Returns the pixel map if the operation is successful; returns null otherwise. @@ -7590,10 +7741,24 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise; + + /** + * Obtains the metadata of main picture. + * + * @param { MetadataType } metadataType The type of metadata. + * @returns { Promise } Return the metadata of main picture. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 7600202 - Unsupported metadata. Possible causes: 1. Unsupported metadata type. 2. The + * metadata type does not match the auxiliary picture type. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 20 + * @arkts 1.2 */ - getMetadata(metadataType: MetadataType): Promise + getMetadata(metadataType: MetadataType): Promise; /** * Marshalling picture and write into MessageSequence. @@ -7709,21 +7874,40 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise } A Promise instance used to return the pixel map data. * @syscap SystemCapability.Multimedia.Image.Core - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 + * @since 13 */ readPixelsToBuffer(): Promise; + /** + * Reads image pixel map data and writes the data to an ArrayBuffer. This method uses + * a promise to return the result. + * + * @returns { Promise } A Promise instance used to return the pixel map data. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 20 + * @arkts 1.2 + */ + readPixelsToBuffer(): Promise; + /** * Obtains the type of auxiliary picture. * * @returns { AuxiliaryPictureType } Returns the type of auxiliary picture. * @syscap SystemCapability.Multimedia.Image.Core - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 + * @since 13 */ getType(): AuxiliaryPictureType; + /** + * Obtains the type of auxiliary picture. + * + * @returns { AuxiliaryPictureType | undefined } Returns the type of auxiliary picture. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 20 + * @arkts 1.2 + */ + getType(): AuxiliaryPictureType | undefined; + /** * Set the metadata of auxiliary picture. * @@ -7750,10 +7934,24 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise; + + /** + * Obtains the metadata of auxiliary picture. + * + * @param { MetadataType } metadataType The type of metadata. + * @returns { Promise } Return the metadata of auxiliary picture. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 7600202 - Unsupported metadata. Possible causes: 1. Unsupported metadata type. 2. The + * metadata type does not match the auxiliary picture type. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 20 + * @arkts 1.2 */ - getMetadata(metadataType: MetadataType): Promise + getMetadata(metadataType: MetadataType): Promise; /** * Obtains the information about this auxiliary picture. @@ -7761,11 +7959,21 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise> } Array of Records instance used to return the property values. * @syscap SystemCapability.Multimedia.Image.Core - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 + * @since 13 + */ + getAllProperties(): Promise>; + + /** + * Obtains the value of all properties in an image. This method uses a promise to return the property values + * in array of records. + * + * @returns { Promise | undefined> } Array of Records instance used to return the property values. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 20 + * @arkts 1.2 */ - getAllProperties(): Promise> + getAllProperties(): Promise | undefined>; /** * Obtains a clone of metadata. This method uses a promise to return the metadata. * * @returns { Promise } A Promise instance used to return the metadata. * @syscap SystemCapability.Multimedia.Image.Core - * @since arkts {'1.1':'13','1.2':'20'} - * @arkts 1.1&1.2 + * @since 13 + */ + clone(): Promise; + + /** + * Obtains a clone of metadata. This method uses a promise to return the metadata. + * + * @returns { Promise } A Promise instance used to return the metadata. + * @syscap SystemCapability.Multimedia.Image.Core + * @since 20 + * @arkts 1.2 */ - clone(): Promise + clone(): Promise; } /** @@ -8183,11 +8410,27 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise): void; + /** + * Obtains information about an image with the specified sequence number and uses a callback + * to return the result. + * + * @param { int } index Sequence number of an image. The default value is 0, indicating the first image. + * When the value is N, it refers to the (N-1)th image. In single-frame image scenarios, the value must be 0. + * In multi-frame image scenarios such as animations, the valid range is 0 to (frame count - 1). + * @param { AsyncCallback } callback Callback used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getImageInfo(index: int, callback: AsyncCallback): void; + /** * Obtains information about this image and uses a callback to return the result. * @@ -8220,11 +8463,23 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise): void; + /** + * Obtains information about this image and uses a callback to return the result. + * + * @param { AsyncCallback } callback Callback used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getImageInfo(callback: AsyncCallback): void; + /** * Get image information from image source. * @@ -8269,11 +8524,26 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise; + /** + * Get image information from image source. + * + * @param { int } index Sequence number of an image. The default value is 0, indicating the first image. + * When the value is N, it refers to the (N-1)th image. In single-frame image scenarios, the value must be 0. + * In multi-frame image scenarios such as animations, the valid range is 0 to (frame count - 1). + * @returns { Promise } A Promise instance used to return the image information. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getImageInfo(index?: int): Promise; + /** * Get image information from image source synchronously. * @@ -8283,11 +8553,24 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise; + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a promise to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + createPixelMap(options?: DecodingOptions): Promise; + /** * Creates a PixelMap object. This method uses a callback to return the object. * @@ -8365,11 +8662,23 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise): void; + /** + * Creates a PixelMap object. This method uses a callback to return the object. + * + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + createPixelMap(callback: AsyncCallback): void; + /** * Creates a PixelMap object based on image decoding parameters. This method uses a callback to * return the object. @@ -8410,11 +8719,25 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise): void; + /** + * Creates a PixelMap object based on image decoding parameters. This method uses a callback to + * return the object. + * + * @param { DecodingOptions } options Image decoding parameters. + * @param { AsyncCallback } callback Callback used to return the PixelMap object. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @crossplatform + * @form + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + createPixelMap(options: DecodingOptions, callback: AsyncCallback): void; + /** * Creates a PixelMap based on decoding parameters, the memory type used by the PixelMap can be specified by * allocatorType. By default, the system selects the memory type based on the image type, image size, platform @@ -8437,11 +8760,38 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise; + /** + * Creates a PixelMap based on decoding parameters, the memory type used by the PixelMap can be specified by + * allocatorType. By default, the system selects the memory type based on the image type, image size, platform + * capability, etc. When processing the PixelMap returned by this interface, please always consider the impact of + * stride. + * + * @param { DecodingOptions } options Image decoding parameters. + * @param { AllocatorType } allocatorType Indicate which memory type will be used by the returned PixelMap. + * @returns { Promise } A Promise instance used to return the PixelMap object. + * @throws { BusinessError } 401 - Parameter error.Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 7700101 - Bad source. e.g.,1. Image has invalid width or height. 2. Image source incomplete. + * 3. Read image data failed. 4. Codec create failed. + * @throws { BusinessError } 7700102 - Unsupported mimetype. + * @throws { BusinessError } 7700103 - Image too large. This status code is thrown when an error occurs during the process of + * checking size. + * @throws { BusinessError } 7700201 - Unsupported allocator type, e.g., use share memory to decode a HDR image as + * only DMA supported hdr metadata. + * @throws { BusinessError } 7700203 - Unsupported options, e.g, cannot convert image into desired pixel format. + * @throws { BusinessError } 7700301 - Failed to decode image. + * @throws { BusinessError } 7700302 - Failed to allocate memory. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 20 + * @arkts 1.2 + */ + createPixelMapUsingAllocator(options?: DecodingOptions, allocatorType?: AllocatorType) + : Promise; + /** * Create a PixelMap object based on image decoding parameters synchronously. * @@ -8449,11 +8799,22 @@ function createUnpremultipliedPixelMap(src: PixelMap, dst: PixelMap): Promise + /** + * Creates a Picture object based on image decoding parameters. This method uses a promise to + * return the object. + * + * @param { DecodingOptionsForPicture } options Image decoding parameters. + * @returns { Promise } A Promise instance used to return the Picture object. + * @throws { BusinessError } 401 - Parameter error.Possible causes: 1.Mandatory parameters are left unspecified. + * 2.Incorrect parameter types; 3.Parameter verification failed. + * @throws { BusinessError } 7700301 - Failed to decode image. + * @syscap SystemCapability.Multimedia.Image.ImageSource + * @since 20 + * @arkts 1.2 + */ + createPicture(options?: DecodingOptionsForPicture): Promise + /** * Decodes an image at the specified index into a Picture object. * -- Gitee