提交 29a3fe10 编写于 作者: X xu-rui-w

文档修改

Signed-off-by: Nxu-rui-w <xurui101@huawei.com>
上级 20f94deb
......@@ -20,7 +20,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi
| 名称 | 类型 | 必填 | 说明 |
| ------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ |
| colors | ArrayBuffer | 是 | 颜色数组。 |
| colors | ArrayBuffer | 是 | BGRA_8888格式的颜色数组。 |
| options | [InitializationOptions](#initializationoptions8) | 是 | 创建像素的属性,包括透明度,尺寸,缩略值,像素格式和是否可编辑。 |
**返回值:**
......@@ -32,7 +32,9 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi
**示例:**
```js
image.createPixelMap(Color, opts)
const color = new ArrayBuffer(96);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts)
.then((pixelmap) => {
})
```
......@@ -49,14 +51,16 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As
| 名称 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | -------------------------- |
| colors | ArrayBuffer | 是 | 颜色数组。 |
| colors | ArrayBuffer | 是 | BGRA_8888格式的颜色数组。 |
| options | [InitializationOptions](#initializationoptions8) | 是 | 属性。 |
| callback | AsyncCallback\<[PixelMap](#pixelmap7)> | 是 | 通过回调返回PixelMap对象。 |
**示例:**
```js
image.createPixelMap(Color, opts, (pixelmap) => {
const color = new ArrayBuffer(96);
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts, (pixelmap) => {
})
```
......@@ -95,11 +99,11 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
**示例:**
```js
pixelmap.readPixelsToBuffer(readBuffer).then(() => {
//符合条件则进入
}).catch(error => {
//不符合条件则进入
})
pixelmap.readPixelsToBuffer(ReadBuffer).then(() => {
console.log('readPixelsToBuffer succeeded.'); //符合条件则进入
}).catch(error => {
console.log('readPixelsToBuffer failed.'); //不符合条件则进入
})
```
### readPixelsToBuffer<sup>7+</sup>
......@@ -120,8 +124,13 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
**示例:**
```js
pixelmap.readPixelsToBuffer(readBuffer, () => {
})
pixelmap.readPixelsToBuffer(ReadBuffer, (err, res) => {
if(err) {
console.log('readPixelsToBuffer failed.'); //不符合条件则进入
} else {
console.log('readPixelsToBuffer succeeded.'); //符合条件则进入
}
})
```
### readPixels<sup>7+</sup>
......@@ -147,11 +156,11 @@ readPixels(area: PositionArea): Promise\<void>
**示例:**
```js
pixelmap.readPixels(area).then((data) => {
//符合条件则进入
}).catch(error => {
//不符合条件则进入
})
pixelmap.readPixels(Area).then((data) => {
console.log('readPixels succeeded.'); //符合条件则进入
}).catch(error => {
console.log('readPixels failed.'); //不符合条件则进入
})
```
### readPixels<sup>7+</sup>
......@@ -175,14 +184,12 @@ readPixels(area: PositionArea, callback: AsyncCallback\<void>): void
let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts, (err, pixelmap) => {
if(pixelmap == undefined){
console.info('createPixelMap failed');
expect(false).assertTrue();
done();
}else{
console.info('createPixelMap failed.');
} else {
const area = { pixels: new ArrayBuffer(8),
offset: 0,
stride: 8,
region: { size: { height: 1, width: 2 }, x: 0, y: 0 }}
region: { size: { height: 1, width: 2 }, x: 0, y: 0 }};
pixelmap.readPixels(area, () => {
console.info('readPixels success');
})
......@@ -218,9 +225,7 @@ let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts)
.then( pixelmap => {
if (pixelmap == undefined) {
console.info('createPixelMap failed');
expect(false).assertTrue()
done();
console.info('createPixelMap failed.');
}
const area = { pixels: new ArrayBuffer(8),
offset: 0,
......@@ -243,8 +248,6 @@ image.createPixelMap(color, opts)
})
.catch(error => {
console.log('error: ' + error);
expect().assertFail();
done();
})
```
......@@ -266,14 +269,14 @@ writePixels(area: PositionArea, callback: AsyncCallback\<void>): void
**示例:**
```js
pixelmap.writePixels(area, () => {
pixelmap.writePixels(Area, () => {
const readArea = {
pixels: new ArrayBuffer(20),
offset: 0,
stride: 8,
region: { size: { height: 1, width: 2 }, x: 0, y: 0 },
}
})
})
```
### writeBufferToPixels<sup>7+</sup>
......@@ -299,11 +302,11 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void>
**示例:**
```js
pixelMap.writeBufferToPixels(colorBuffer).then(() => {
PixelMap.writeBufferToPixels(color).then(() => {
console.log("Succeeded in writing data from a buffer to a PixelMap.");
}).catch((err) => {
console.error("Failed to write data from a buffer to a PixelMap.");
});
})
```
### writeBufferToPixels<sup>7+</sup>
......@@ -324,12 +327,13 @@ writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void
**示例:**
```js
pixelMap.writeBufferToPixels(colorBuffer, function(err) {
PixelMap.writeBufferToPixels(color, function(err) {
if (err) {
console.error("Failed to write data from a buffer to a PixelMap.");
return;
}
} else {
console.log("Succeeded in writing data from a buffer to a PixelMap.");
}
});
```
......@@ -350,7 +354,7 @@ getImageInfo(): Promise\<ImageInfo>
**示例:**
```js
pixelMap.getImageInfo().then(function(info) {
PixelMap.getImageInfo().then(function(info) {
console.log("Succeeded in obtaining the image pixel map information.");
}).catch((err) => {
console.error("Failed to obtain the image pixel map information.");
......@@ -374,7 +378,11 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
**示例:**
```js
pixelmap.getImageInfo((imageInfo) => {})
pixelmap.getImageInfo((imageInfo) => {
console.log("getImageInfo succeeded.");
}).catch((err) => {
console.error("getImageInfo failed.");
})
```
### getBytesNumberPerRow<sup>7+</sup>
......@@ -394,7 +402,9 @@ getBytesNumberPerRow(): number
**示例:**
```js
rowCount = pixelmap.getBytesNumberPerRow()
image.createPixelMap(clolr, opts, (err,pixelmap) => {
let rowCount = pixelmap.getBytesNumberPerRow();
})
```
### getPixelBytesNumber<sup>7+</sup>
......@@ -414,7 +424,7 @@ getPixelBytesNumber(): number
**示例:**
```js
pixelBytesNumber = pixelmap.getPixelBytesNumber()
let pixelBytesNumber = pixelmap.getPixelBytesNumber();
```
### release<sup>7+</sup>
......@@ -434,8 +444,13 @@ release():Promise\<void>
**示例:**
```js
pixelmap.release().then(() => { })
.catch(error => {})
image.createPixelMap(color, opts, (pixelmap) => {
pixelmap.release().then(() => {
console.log('release succeeded.');
}).catch(error => {
console.log('release failed.');
})
})
```
### release<sup>7+</sup>
......@@ -455,7 +470,13 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```js
pixelmap.release(()=>{ })
image.createPixelMap(color, opts, (pixelmap) => {
pixelmap.release().then(() => {
console.log('release succeeded.');
}).catch(error => {
console.log('release failed.');
})
})
```
## image.createImageSource
......@@ -508,7 +529,7 @@ createImageSource(fd: number): ImageSource
**示例:**
```js
const imageSourceApi = image.createImageSource(0)
const imageSourceApi = image.createImageSource(0);
```
## ImageSource
......@@ -541,7 +562,13 @@ getImageInfo(index: number, callback: AsyncCallback\<ImageInfo>): void
**示例:**
```js
imageSourceApi.getImageInfo(0,(error, imageInfo) => {})
imageSourceApi.getImageInfo(0,(error, imageInfo) => {
if(error) {
console.log('getImageInfo failed.');
} else {
console.log('getImageInfo succeeded.');
}
})
```
### getImageInfo
......@@ -561,7 +588,11 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
**示例:**
```js
imageSourceApi.getImageInfo(imageInfo => {})
imageSourceApi.getImageInfo(imageInfo => {
console.log('getImageInfo succeeded.');
}).catch(error => {
console.log('getImageInfo failed.');
})
```
### getImageInfo
......@@ -588,8 +619,12 @@ getImageInfo(index?: number): Promise\<ImageInfo>
```js
imageSourceApi.getImageInfo(0)
.then(imageInfo => {})
.catch(error => {})
.then(imageInfo => {
console.log('getImageInfo succeeded.');
})
.catch(error => {
console.log('getImageInfo failed.');
})
```
### getImageProperty<sup>7+</sup>
......@@ -617,8 +652,12 @@ getImageProperty(key:string, options?: GetImagePropertyOptions): Promise\<string
```js
imageSourceApi.getImageProperty("BitsPerSample")
.then(data => {})
.catch(error => {})
.then(data => {
console.log('getImageProperty succeeded.');
})
.catch(error => {
console.log('getImageProperty failed.');
})
```
### getImageProperty<sup>7+</sup>
......@@ -639,7 +678,13 @@ getImageProperty(key:string, callback: AsyncCallback\<string>): void
**示例:**
```js
imageSourceApi.getImageProperty("BitsPerSample",(error,data) => {})
imageSourceApi.getImageProperty("BitsPerSample",(error,data) => {
if(error) {
console.log('getImageProperty failed.');
} else {
console.log('getImageProperty succeeded.');
}
})
```
### getImageProperty<sup>7+</sup>
......@@ -661,7 +706,13 @@ getImageProperty(key:string, options: GetImagePropertyOptions, callback: AsyncCa
**示例:**
```js
imageSourceApi.getImageProperty("BitsPerSample",property,(error,data) => {})
imageSourceApi.getImageProperty("BitsPerSample",Property,(error,data) => {
if(error) {
console.log('getImageProperty failed.');
} else {
console.log('getImageProperty succeeded.');
}
})
```
### createPixelMap<sup>7+</sup>
......@@ -687,8 +738,11 @@ createPixelMap(options?: DecodingOptions): Promise\<PixelMap>
**示例:**
```js
imageSourceApi.createPixelMap().then(pixelmap => {})
.catch(error => {})
imageSourceApi.createPixelMap().then(pixelmap => {
console.log('createPixelMap succeeded.');
}).catch(error => {
console.log('createPixelMap failed.');
})
```
### createPixelMap<sup>7+</sup>
......@@ -708,7 +762,11 @@ createPixelMap(callback: AsyncCallback\<PixelMap>): void
**示例:**
```js
imageSourceApi.createPixelMap(pixelmap => {})
imageSourceApi.createPixelMap(pixelmap => {
console.log('createPixelMap succeeded.');
}).catch(error => {
console.log('createPixelMap failed.');
})
```
### createPixelMap<sup>7+</sup>
......@@ -729,7 +787,11 @@ createPixelMap(options: DecodingOptions, callback: AsyncCallback\<PixelMap>): vo
**示例:**
```js
imageSourceApi.createPixelMap(decodingOptions, pixelmap => {})
imageSourceApi.createPixelMap(decodingOptions, pixelmap => {
console.log('createPixelMap succeeded.');
}).catch(error => {
console.log('createPixelMap failed.');
})
```
### release
......@@ -749,7 +811,11 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```js
imageSourceApi.release(() => {})
imageSourceApi.release(() => {
console.log('release succeeded.');
}).catch(error => {
console.log('release failed.');
})
```
### release
......@@ -769,7 +835,11 @@ release(): Promise\<void>
**示例:**
```js
imageSourceApi.release().then(()=>{ }).catch(error => {})
imageSourceApi.release().then(()=>{
console.log('release succeeded.');
}).catch(error => {
console.log('release failed.');
})
```
## image.createImagePacker
......@@ -823,8 +893,8 @@ packing(source: ImageSource, option: PackingOption, callback: AsyncCallback\<Arr
**示例:**
```js
let packOpts = { format:["image/jpeg"], quality:98 }
imagePackerApi.packing(imageSourceApi, packOpts, data => {})
let packOpts = { format:["image/jpeg"], quality:98 };
imagePackerApi.packing(ImageSourceApi, packOpts, data => {})
```
### packing
......@@ -852,9 +922,12 @@ packing(source: ImageSource, option: PackingOption): Promise\<ArrayBuffer>
```js
let packOpts = { format:["image/jpeg"], quality:98 }
imagePackerApi.packing(imageSourceApi, packOpts)
.then( data => { })
.catch(error => {})
imagePackerApi.packing(ImageSourceApi, packOpts)
.then( data => {
console.log('packing succeeded.');
}).catch(error => {
console.log('packing failed.');
})
```
### packing<sup>8+</sup>
......@@ -877,7 +950,11 @@ packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayB
```js
let packOpts = { format:["image/jpeg"], quality:98 }
imagePackerApi.packing(pixelMapApi, packOpts, data => {})
imagePackerApi.packing(PixelMapApi, packOpts, data => {
console.log('packing succeeded.');
}).catch(error => {
console.log('packing failed.');
})
```
### packing<sup>8+</sup>
......@@ -905,9 +982,12 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
```js
let packOpts = { format:["image/jpeg"], quality:98 }
imagePackerApi.packing(pixelMapApi, packOpts)
.then( data => { })
.catch(error => {})
imagePackerApi.packing(PixelMapApi, packOpts)
.then( data => {
console.log('packing succeeded.');
}).catch(error => {
console.log('packing failed.');
})
```
### release
......@@ -927,7 +1007,11 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```js
imagePackerApi.release(()=>{})
imagePackerApi.release(()=>{
console.log('release succeeded.');
}).catch(error => {
console.log('release failed.');
})
```
### release
......@@ -947,8 +1031,11 @@ release(): Promise\<void>
**示例:**
```js
imagePackerApi.release().then(()=>{
}).catch((error)=>{})
imagePackerApi.release().then(()=>{
console.log('release succeeded.');
}).catch((error)=>{
console.log('release failed.');
})
```
## image.createImageReceiver<sup>9+</sup>
......@@ -977,7 +1064,7 @@ createImageReceiver(width: number, height: number, format: number, capacity: num
**示例:**
```js
var receiver = image.createImageReceiver(8192, 8, 4, 8)
var receiver = image.createImageReceiver(8192, 8, 4, 8);
```
## ImageReceiver<sup>9+</sup>
......@@ -1013,7 +1100,13 @@ getReceivingSurfaceId(callback: AsyncCallback\<string>): void
**示例:**
```js
receiver.getReceivingSurfaceId((err, id) => {});
receiver.getReceivingSurfaceId((err, id) => {
if(err) {
console.log('getReceivingSurfaceId failed.');
} else {
console.log('getReceivingSurfaceId succeeded.');
}
});
```
### getReceivingSurfaceId<sup>9+</sup>
......@@ -1034,8 +1127,10 @@ getReceivingSurfaceId(): Promise\<string>
```js
receiver.getReceivingSurfaceId().then( id => {
}).catch(error => {
})
console.log('getReceivingSurfaceId succeeded.');
}).catch(error => {
console.log('getReceivingSurfaceId failed.');
})
```
### readLatestImage<sup>9+</sup>
......@@ -1055,7 +1150,13 @@ readLatestImage(callback: AsyncCallback\<Image>): void
**示例:**
```js
receiver.readLatestImage((err, img) => { });
receiver.readLatestImage((err, img) => {
if(err) {
console.log('readLatestImage failed.');
} else {
console.log('readLatestImage succeeded.');
}
});
```
### readLatestImage<sup>9+</sup>
......@@ -1075,8 +1176,11 @@ readLatestImage(): Promise\<Image>
**示例:**
```js
receiver.readLatestImage().then(img => {})
.catch(error => {})
receiver.readLatestImage().then(img => {
console.log('readLatestImage succeeded.');
}).catch(error => {
console.log('readLatestImage failed.');
})
```
### readNextImage<sup>9+</sup>
......@@ -1096,7 +1200,13 @@ readNextImage(callback: AsyncCallback\<Image>): void
**示例:**
```js
receiver.readNextImage((err, img) => {});
receiver.readNextImage((err, img) => {
if(err) {
console.log('readNextImage failed.');
} else {
console.log('readNextImage succeeded.');
}
});
```
### readNextImage<sup>9+</sup>
......@@ -1116,9 +1226,11 @@ readNextImage(): Promise\<Image>
**示例:**
```js
receiver.readNextImage().then(img => {
}).catch(error => {
})
receiver.readNextImage().then(img => {
console.log('readNextImage succeeded.');
}).catch(error => {
console.log('readNextImage failed.');
})
```
### on('imageArrival')<sup>9+</sup>
......@@ -1139,7 +1251,7 @@ on(type: 'imageArrival', callback: AsyncCallback\<void>): void
**示例:**
```js
receiver.on('imageArrival', () => {})
receiver.on('imageArrival', () => {})
```
### release<sup>9+</sup>
......@@ -1159,7 +1271,7 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```js
receiver.release(() => {})
receiver.release(() => {})
```
### release<sup>9+</sup>
......@@ -1179,8 +1291,11 @@ release(): Promise\<void>
**示例:**
```js
receiver.release().then(() => {})
.catch(error => {})
receiver.release().then(() => {
console.log('release succeeded.');
}).catch(error => {
console.log('release failed.');
})
```
## Image<sup>9+</sup>
......@@ -1215,7 +1330,13 @@ getComponent(componentType: ComponentType, callback: AsyncCallback\<Component>):
**示例:**
```js
img.getComponent(4, (err, component) => {})
img.getComponent(4, (err, component) => {
if(err) {
console.log('getComponent failed.');
} else {
console.log('getComponent succeeded.');
}
})
```
### getComponent<sup>9+</sup>
......@@ -1263,7 +1384,11 @@ release(callback: AsyncCallback\<void>): void
**示例:**
```js
img.release(() =>{ })
img.release(() =>{
console.log('release succeeded.');
}).catch(error => {
console.log('release failed.');
})
```
### release<sup>9+</sup>
......@@ -1286,8 +1411,10 @@ release(): Promise\<void>
```js
img.release().then(() =>{
}).catch(error => {
})
console.log('release succeeded.');
}).catch(error => {
console.log('release failed.');
})
```
## PositionArea<sup>7+</sup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册