提交 327f349e 编写于 作者: P pengpenglottie

review change

Signed-off-by: Npengpenglottie <pengpeng35@huawei.com>
Change-Id: I2cc5efb4047379978e8f003d459345fe850a2c1f
上级 4d3a7c00
...@@ -51,7 +51,7 @@ image.createPixelMap(color, opts).then((pixelMap) => { ...@@ -51,7 +51,7 @@ image.createPixelMap(color, opts).then((pixelMap) => {
## effectKit.createColorPicker ## effectKit.createColorPicker
createColorPicker(source: image.PixelMap, region?:Array\<number>): Promise\<ColorPicker> createColorPicker(source: image.PixelMap): Promise\<ColorPicker>
通过传入的PixelMap创建ColorPicker实例,使用Promise异步回调。 通过传入的PixelMap创建ColorPicker实例,使用Promise异步回调。
...@@ -62,7 +62,6 @@ createColorPicker(source: image.PixelMap, region?:Array\<number>): Promise\<Colo ...@@ -62,7 +62,6 @@ createColorPicker(source: image.PixelMap, region?:Array\<number>): Promise\<Colo
| 参数名 | 类型 | 必填 | 说明 | | 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------- | ---- | -------------------------- | | -------- | ----------- | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 |
| region<sup>10+</sup> | Array\<number> | 否 | 指定图片的取色区域,取值范围为[0, 1],数组元素分别表示图片区域的上左、上、右、下位置。数组长度需大于等于4,大于4时取前四个元素。数组第三个元素需大于第一个元素,第四个元素需大于第二个元素。从API version 10开始,支持此参数。此参数不填时,默认值为[0, 0, 1, 1],表示取色区域为全图。 |
**返回值:** **返回值:**
...@@ -83,6 +82,24 @@ image.createPixelMap(color, opts).then((pixelMap) => { ...@@ -83,6 +82,24 @@ image.createPixelMap(color, opts).then((pixelMap) => {
}).catch(ex => console.error(".error=" + ex.toString())) }).catch(ex => console.error(".error=" + ex.toString()))
}) })
``` ```
createColorPicker(source: image.PixelMap, region: Array<number>): Promise\<ColorPicker>
通过传入的PixelMap创建ColorPicker实例,使用Promise异步回调。
**系统能力:** SystemCapability.Multimedia.Image.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------- | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 |
| region<sup>10+</sup> | Array\<number> | 否 | 指定图片的取色区域,从API version 10开始,支持此参数。<br>数组元素个数为4,取值范围为[0, 1],数组元素分别表示图片区域的上左、上、右、下位置。数组第三个元素需大于第一个元素,第四个元素需大于第二个元素。<br>此参数不填时,默认值为[0, 0, 1, 1],表示取色区域为全图。 |
**返回值:**
| 类型 | 说明 |
| ---------------------- | -------------- |
| Promise\<[ColorPicker](#colorpicker)> | Promise对象。返回创建的ColorPicker实例。 |
**示例:** **示例:**
...@@ -100,7 +117,7 @@ image.createPixelMap(color, opts).then((pixelMap) => { ...@@ -100,7 +117,7 @@ image.createPixelMap(color, opts).then((pixelMap) => {
## effectKit.createColorPicker ## effectKit.createColorPicker
createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>, region?:Array\<number>): void createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>): void
通过传入的PixelMap创建ColorPicker实例,使用callback异步回调。 通过传入的PixelMap创建ColorPicker实例,使用callback异步回调。
...@@ -112,7 +129,6 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>, ...@@ -112,7 +129,6 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>,
| -------- | ------------------ | ---- | -------------------------- | | -------- | ------------------ | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 | | source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 |
| callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数。返回创建的ColorPicker实例。 | | callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数。返回创建的ColorPicker实例。 |
| region<sup>10+</sup> | Array\<number> | 否 | 指定图片的取色区域,取值范围为[0, 1],数组元素分别表示图片区域的上左、上、右、下位置。数组长度需大于等于4,大于4时取前四个元素。数组第三个元素需大于第一个元素,第四个元素需大于第二个元素。从API version 10开始,支持此参数。此参数不填时,默认值为[0, 0, 1, 1],表示取色区域为全图。 |
**示例:** **示例:**
...@@ -132,6 +148,20 @@ image.createPixelMap(color, opts).then((pixelMap) => { ...@@ -132,6 +148,20 @@ image.createPixelMap(color, opts).then((pixelMap) => {
}) })
``` ```
createColorPicker(source: image.PixelMap, region:Array\<number>, callback: AsyncCallback\<ColorPicker>): void
通过传入的PixelMap创建ColorPicker实例,使用callback异步回调。
**系统能力:** SystemCapability.Multimedia.Image.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------ | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 |
| region<sup>10+</sup> | Array\<number> | 否 | 指定图片的取色区域,从API version 10开始,支持此参数。<br>数组元素个数为4,取值范围为[0, 1],数组元素分别表示图片区域的上左、上、右、下位置。数组第三个元素需大于第一个元素,第四个元素需大于第二个元素。<br>此参数不填时,默认值为[0, 0, 1, 1],表示取色区域为全图。 |
| callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数。返回创建的ColorPicker实例。 |
**示例:** **示例:**
```js ```js
...@@ -140,13 +170,13 @@ import image from "@ohos.multimedia.image"; ...@@ -140,13 +170,13 @@ import image from "@ohos.multimedia.image";
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts).then((pixelMap) => { image.createPixelMap(color, opts).then((pixelMap) => {
effectKit.createColorPicker(pixelMap, (error, colorPicker) => { effectKit.createColorPicker(pixelMap, [0, 0, 0.5, 0.5], (error, colorPicker) => {
if (error) { if (error) {
console.log('Failed to create color picker.'); console.log('Failed to create color picker.');
} else { } else {
console.log('Succeeded in creating color picker.'); console.log('Succeeded in creating color picker.');
} }
}, [0, 0, 0.5, 0.5]) })
}) })
``` ```
......
...@@ -130,24 +130,6 @@ function createVerify(algName: string): Verify; ...@@ -130,24 +130,6 @@ function createVerify(algName: string): Verify;
* @since 9 * @since 9
*/ */
function createKeyAgreement(algName: string): KeyAgreement; function createKeyAgreement(algName: string): KeyAgreement;
/**
* Create a color picker to get color of an image.
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
* @param image.PixelMap.
* @returns Returns the ColorPicker.
*/
function createColorPicker(source: image.PixelMap): Promise<ColorPicker>;
/**
* Create a color picker to get color of an image.
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
* @param image.PixelMap.
* @returns Returns the ColorPicker.
*/
function createColorPicker(source: image.PixelMap, callback: AsyncCallback<ColorPicker>): void;
``` ```
修改后的接口原型: 修改后的接口原型:
...@@ -286,43 +268,6 @@ function createVerify(algName: string): Verify; ...@@ -286,43 +268,6 @@ function createVerify(algName: string): Verify;
* @since 9 * @since 9
*/ */
function createKeyAgreement(algName: string): KeyAgreement; function createKeyAgreement(algName: string): KeyAgreement;
/**
* Create a color picker to get color of an image.
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
* @param image.PixelMap.
* @returns Returns the ColorPicker.
*/
/**
* Create a color picker to get color of an image.
* @param { image.PixelMap } source - the source pixelmap.
* @param { Array<number> } region - at least 4 elements, represents the region's left, top, right, bottom coordinates,
* its range is [0, 1], default is [0, 0, 1, 1], represents the region of color picker is the whole pixelMap.
* @returns { Promise<ColorPicker> } - returns the ColorPicker generated.
* @syscap SystemCapability.Multimedia.Image.Core
* @since 10
*/
function createColorPicker(source: image.PixelMap, region?: Array<number>): Promise<ColorPicker>;
/**
* Create a color picker to get color of an image.
* @since 9
* @syscap SystemCapability.Multimedia.Image.Core
* @param image.PixelMap.
* @returns Returns the ColorPicker.
*/
/**
* Create a color picker to get color of an image.
* @syscap SystemCapability.Multimedia.Image.Core
* @param { image.PixelMap } source - the source pixelmap.
* @param { AsyncCallback<ColorPicker> } callback - the callback of createColorPicker.
* @param { Array<number> } region - at least 4 elements, represents the region's left, top, right, bottom coordinates,
* its range is [0, 1], default is [0, 0, 1, 1], represents the region of color picker is the whole pixelMap.
* @syscap SystemCapability.Multimedia.Image.Core
* @since 10
*/
function createColorPicker(source: image.PixelMap, callback: AsyncCallback<ColorPicker>, region?: Array<number>): void;
``` ```
**适配指导** **适配指导**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册