未验证 提交 e0f2dcd1 编写于 作者: O openharmony_ci 提交者: Gitee

!9562 翻译完成:8346 js-apis-image.md.文档示例代码参数格式修改

Merge pull request !9562 from wusongqing/TR8346
...@@ -92,7 +92,7 @@ Provides APIs to read or write image pixel map data and obtain image pixel map i ...@@ -92,7 +92,7 @@ Provides APIs to read or write image pixel map data and obtain image pixel map i
readPixelsToBuffer(dst: ArrayBuffer): Promise\<void> readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
Reads image pixel map data and writes the data to an **ArrayBuffer**. This API uses a promise to return the result. If the pixel map is created in the BGRA_8888 format, the pixel map data read is the same as the original data. Reads data of this pixel map and writes the data to an **ArrayBuffer**. This API uses a promise to return the result. If this pixel map is created in the BGRA_8888 format, the data read is the same as the original data.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
...@@ -123,7 +123,7 @@ pixelmap.readPixelsToBuffer(readBuffer).then(() => { ...@@ -123,7 +123,7 @@ pixelmap.readPixelsToBuffer(readBuffer).then(() => {
readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
Reads image pixel map data and writes the data to an **ArrayBuffer**. This API uses an asynchronous callback to return the result. If the pixel map is created in the BGRA_8888 format, the pixel map data read is the same as the original data. Reads data of this pixel map and writes the data to an **ArrayBuffer**. This API uses an asynchronous callback to return the result. If this pixel map is created in the BGRA_8888 format, the data read is the same as the original data.
**System capability**: SystemCapability.Multimedia.Image.Core **System capability**: SystemCapability.Multimedia.Image.Core
...@@ -810,7 +810,7 @@ Crops this image based on the input size. This API uses an asynchronous callback ...@@ -810,7 +810,7 @@ Crops this image based on the input size. This API uses an asynchronous callback
```js ```js
async function () { async function () {
await pixelMap.crop(3x3); await pixelMap.crop({ x: 0, y: 0, size: { height: 100, width: 100 } });
} }
``` ```
...@@ -838,7 +838,7 @@ Crops this image based on the input size. This API uses a promise to return the ...@@ -838,7 +838,7 @@ Crops this image based on the input size. This API uses a promise to return the
```js ```js
async function () { async function () {
await pixelMap.crop(3x3); await pixelMap.crop({ x: 0, y: 0, size: { height: 100, width: 100 } });
} }
``` ```
...@@ -910,7 +910,7 @@ Creates an **ImageSource** instance based on the URI. ...@@ -910,7 +910,7 @@ Creates an **ImageSource** instance based on the URI.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------------------- | | ------ | ------ | ---- | ---------------------------------- |
| uri | string | Yes | Image path. Currently, only the application sandbox path is supported.| | uri | string | Yes | Image path. Currently, only the application sandbox path is supported.<br>Currently, the following raw formats are supported: .jpg, .png, .gif, .bmp, and .webp.|
**Return value** **Return value**
...@@ -937,7 +937,7 @@ Creates an **ImageSource** instance based on the URI. ...@@ -937,7 +937,7 @@ Creates an **ImageSource** instance based on the URI.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------------------------------- | ---- | ----------------------------------- | | ------- | ------------------------------- | ---- | ----------------------------------- |
| uri | string | Yes | Image path. Currently, only the application sandbox path is supported. | | uri | string | Yes | Image path. Currently, only the application sandbox path is supported.<br>Currently, the following raw formats are supported: .jpg, .png, .gif, .bmp, and .webp.|
| options | [SourceOptions](#sourceoptions9) | Yes | Image properties, including the image index and default property value.| | options | [SourceOptions](#sourceoptions9) | Yes | Image properties, including the image index and default property value.|
**Return value** **Return value**
...@@ -1569,7 +1569,7 @@ Packs an image. This API uses an asynchronous callback to return the result. ...@@ -1569,7 +1569,7 @@ Packs an image. This API uses an asynchronous callback to return the result.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------- | ---- | ---------------------------------- | | -------- | ---------------------------------- | ---- | ---------------------------------- |
| source | [ImageSource](#imagesource) | Yes | Image to pack. | | source | [ImageSource](#imagesource) | Yes | Image to pack. |
| option | [PackingOption](#packingoption) | Yes | Option for image packing. | | option | [PackingOption](#packingoption) | Yes | Option for image packing. |
| callback | AsyncCallback\<ArrayBuffer> | Yes | Callback used to return the packed data.| | callback | AsyncCallback\<ArrayBuffer> | Yes | Callback used to return the packed data.|
**Example** **Example**
...@@ -2166,7 +2166,7 @@ Enumerates the scale modes of images. ...@@ -2166,7 +2166,7 @@ Enumerates the scale modes of images.
| Name | Default Value| Description | | Name | Default Value| Description |
| --------------- | ------ | -------------------------------------------------- | | --------------- | ------ | -------------------------------------------------- |
| CENTER_CROP | 1 | Scales the image so that it fills the requested bounds of the target and crops the extra.| | CENTER_CROP | 1 | Scales the image so that it fills the requested bounds of the target and crops the extra.|
| FIT_TARGET_SIZE | 2 | Reduces the image size to the dimensions of the target. | | FIT_TARGET_SIZE | 0 | Reduces the image size to the dimensions of the target. |
## SourceOptions<sup>9+</sup> ## SourceOptions<sup>9+</sup>
...@@ -2231,7 +2231,7 @@ Defines the option for image packing. ...@@ -2231,7 +2231,7 @@ Defines the option for image packing.
| Name | Type | Readable| Writable| Description | | Name | Type | Readable| Writable| Description |
| ------- | ------ | ---- | ---- | --------------------------------------------------- | | ------- | ------ | ---- | ---- | --------------------------------------------------- |
| format | string | Yes | Yes | Format of the packed image. | | format | string | Yes | Yes | Format of the packed image.<br>Currently, the following raw formats are supported: .jpg, .png, .gif, .bmp, and .webp. |
| quality | number | Yes | Yes | Quality of the output image during JPEG encoding. The value ranges from 1 to 100.| | quality | number | Yes | Yes | Quality of the output image during JPEG encoding. The value ranges from 1 to 100.|
## GetImagePropertyOptions<sup>7+</sup> ## GetImagePropertyOptions<sup>7+</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册