提交 4d3a7c00 编写于 作者: P pengpenglottie

docs update

Signed-off-by: Npengpenglottie <pengpeng35@huawei.com>
Change-Id: I134d9cd00a754fb04d6af77e0fad1cd0b897cbdb
上级 a8ef73d7
......@@ -51,7 +51,7 @@ image.createPixelMap(color, opts).then((pixelMap) => {
## effectKit.createColorPicker
createColorPicker(source: image.PixelMap): Promise\<ColorPicker>
createColorPicker(source: image.PixelMap, region?:Array\<number>): Promise\<ColorPicker>
通过传入的PixelMap创建ColorPicker实例,使用Promise异步回调。
......@@ -62,6 +62,7 @@ createColorPicker(source: image.PixelMap): Promise\<ColorPicker>
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------- | ---- | -------------------------- |
| 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,9 +84,23 @@ image.createPixelMap(color, opts).then((pixelMap) => {
})
```
**示例:**
```js
import image from "@ohos.multimedia.image";
const color = new ArrayBuffer(96);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts).then((pixelMap) => {
effectKit.createColorPicker(pixelMap, [0, 0, 0.5, 0.5]).then(colorPicker => {
console.info("color picker=" + colorPicker);
}).catch(ex => console.error(".error=" + ex.toString()))
})
```
## effectKit.createColorPicker
createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>): void
createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>, region?:Array\<number>): void
通过传入的PixelMap创建ColorPicker实例,使用callback异步回调。
......@@ -97,6 +112,7 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>)
| -------- | ------------------ | ---- | -------------------------- |
| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 |
| callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数。返回创建的ColorPicker实例。 |
| region<sup>10+</sup> | Array\<number> | 否 | 指定图片的取色区域,取值范围为[0, 1],数组元素分别表示图片区域的上左、上、右、下位置。数组长度需大于等于4,大于4时取前四个元素。数组第三个元素需大于第一个元素,第四个元素需大于第二个元素。从API version 10开始,支持此参数。此参数不填时,默认值为[0, 0, 1, 1],表示取色区域为全图。 |
**示例:**
......@@ -116,6 +132,24 @@ image.createPixelMap(color, opts).then((pixelMap) => {
})
```
**示例:**
```js
import image from "@ohos.multimedia.image";
const color = new ArrayBuffer(96);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts).then((pixelMap) => {
effectKit.createColorPicker(pixelMap, (error, colorPicker) => {
if (error) {
console.log('Failed to create color picker.');
} else {
console.log('Succeeded in creating color picker.');
}
}, [0, 0, 0.5, 0.5])
})
```
## Color
颜色类,用于保存取色的结果。
......
......@@ -130,6 +130,24 @@ function createVerify(algName: string): Verify;
* @since 9
*/
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;
```
修改后的接口原型:
......@@ -268,6 +286,43 @@ function createVerify(algName: string): Verify;
* @since 9
*/
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.
先完成此消息的编辑!
想要评论请 注册