diff --git a/zh-cn/application-dev/reference/apis/js-apis-image.md b/zh-cn/application-dev/reference/apis/js-apis-image.md index fb19c79366c04310c055c3f4daf4624dae662416..43cbc6de32d59b5835b3442db491cbdf42e8a64a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-image.md +++ b/zh-cn/application-dev/reference/apis/js-apis-image.md @@ -925,6 +925,33 @@ let path = this.context.getApplicationContext().fileDirs + "test.jpg"; const imageSourceApi = image.createImageSource(path); ``` +## image.createImageSource9+ + +createImageSource(uri: string, options: SourceOptions): ImageSource + +通过传入的uri创建图片源实例。 + +**系统能力:** SystemCapability.Multimedia.Image.ImageSource + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | ----------------------------------- | +| uri | string | 是 | 图片路径,当前仅支持应用沙箱路径。 | +| options | [SourceOptions](#SourceOptions) | 是 | 图片属性,包括图片序号与默认属性值。| + +**返回值:** + +| 类型 | 说明 | +| --------------------------- | -------------------------------------------- | +| [ImageSource](#imagesource) | 返回ImageSource类实例,失败时返回undefined。 | + +**示例:** + +```js +、、、、、、、、、、、 +``` + ## image.createImageSource7+ createImageSource(fd: number): ImageSource @@ -948,7 +975,34 @@ createImageSource(fd: number): ImageSource **示例:** ```js -const imageSourceApi = image.createImageSource(0) +const imageSourceApi = image.createImageSource(0); +``` + +## image.createImageSource9+ + +createImageSource(fd: number, options: SourceOptions): ImageSource + +通过传入文件描述符来创建图片源实例。 + +**系统能力:** SystemCapability.Multimedia.Image.ImageSource + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | ----------------------------------- | +| fd | number | 是 | 文件描述符fd。 | +| options | [SourceOptions](#SourceOptions) | 是 | 图片属性,包括图片序号与默认属性值。| + +**返回值:** + +| 类型 | 说明 | +| --------------------------- | -------------------------------------------- | +| [ImageSource](#imagesource) | 返回ImageSource类实例,失败时返回undefined。 | + +**示例:** + +```js +。。。。。。。。。。。。。。。。。。。。。 ``` ## image.createImageSource9+ @@ -972,9 +1026,62 @@ const buf = new ArrayBuffer(96); const imageSourceApi = image.createImageSource(buf); ``` +## image.createImageSource9+ + +createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource + +通过缓冲区创建图片源实例。 + +**系统能力:** SystemCapability.Multimedia.Image.ImageSource + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------------------------------- | ---- | ------------------------------------ | +| buf | ArrayBuffer | 是 | 图像缓冲区数组。 | +| options | [SourceOptions](#SourceOptions) | 是 | 图片属性,包括图片序号与默认属性值。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------- | -------------------------------------------- | +| [ImageSource](#imagesource) | 返回ImageSource类实例,失败时返回undefined。 | + +**示例:** + +```js +......................... +``` + +## image.CreateIncrementalSource9+ + +CreateIncrementalSource(buf: ArrayBuffer): ImageSource + +通过缓冲区以增量的方式创建图片源实例。 + +**系统能力:** SystemCapability.Multimedia.Image.ImageSource + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------| ---- | ----------| +| buf | ArrayBuffer | 是 | 增量数据。| + +**返回值:** + +| 类型 | 说明 | +| --------------------------- | --------------------------------- | +| [ImageSource](#imagesource) | 返回图片源,失败时返回undefined。 | + +**示例:** + +```js +。。。。。。。。。。。。。。。。。。 +``` + ## image.CreateIncrementalSource9+ -function CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource +CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource 通过缓冲区以增量的方式创建图片源实例。 @@ -1211,7 +1318,7 @@ imageSourceApi.modifyImageProperty("ImageWidth", "abc") ### modifyImageProperty9+ -modifyImageProperty(key: string, value: string, callback: AsyncCallback): void +modifyImageProperty(key: string, value: string, callback: AsyncCallback\): void 通过指定的键修改图片属性的值,callback形式返回结果。 @@ -1266,7 +1373,7 @@ imageSourceIncrementalSApi.updateData(array, false, 0, 10).then(data => { ### updateData9+ -updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number, callback: AsyncCallback): void +updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number, callback: AsyncCallback\): void 更新增量数据,callback形式返回结果。 @@ -1423,7 +1530,7 @@ createImagePacker(): ImagePacker 创建ImagePacker实例。 -**系统能力:** SystemCapability.Multimedia.Image.ImageReceiver +**系统能力:** SystemCapability.Multimedia.Image.ImagePacker **返回值:** @@ -2064,6 +2171,19 @@ img.release().then(() =>{ | CENTER_CROP | 1 | 缩放图像以填充目标图像区域并居中裁剪区域外的效果。 | | FIT_TARGET_SIZE | 2 | 图像适合目标尺寸的效果。 | +## SourceOptions9+ + +ImageSource的初始化选项。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.Core + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------------------ | ---------------------------------- | ---- | ---- | ------------------ | +| sourceDensity9+ | number | 是 | 是 | ImageSource的密度。| +| sourcePixelFormat8+ | [PixelMapFormat](#pixelmapformat7) | 是 | 是 | 图片像素格式。 | +| sourceSize8+ | [Size](#size) | 是 | 是 | 图像像素大小。 | + + ## InitializationOptions8+ PixelMap的初始化选项。 @@ -2112,9 +2232,9 @@ PixelMap的初始化选项。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.Image.ImagePacker -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------- | ------ | ---- | ---- | -------------- | -| format | string | 是 | 是 | 目标格式。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------- | ------ | ---- | ---- | --------------------------------------------------- | +| format | string | 是 | 是 | 目标格式。 | | quality | number | 是 | 是 | JPEG编码中设定输出图片质量的参数,取值范围为1-100。 | ## GetImagePropertyOptions7+