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

!10801 image文档修改

Merge pull request !10801 from 徐蕊w/master
...@@ -36,7 +36,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi ...@@ -36,7 +36,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions): Promise\<Pi
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
let bufferArr = new Uint8Array(color); let bufferArr = new Uint8Array(color);
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) => {
...@@ -65,7 +65,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As ...@@ -65,7 +65,7 @@ createPixelMap(colors: ArrayBuffer, options: InitializationOptions, callback: As
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
let bufferArr = new Uint8Array(color); let bufferArr = new Uint8Array(color);
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, (error, pixelmap) => { image.createPixelMap(color, opts, (error, pixelmap) => {
...@@ -112,7 +112,7 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void> ...@@ -112,7 +112,7 @@ readPixelsToBuffer(dst: ArrayBuffer): Promise\<void>
**示例:** **示例:**
```js ```js
const readBuffer = new ArrayBuffer(96); const readBuffer = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
pixelmap.readPixelsToBuffer(readBuffer).then(() => { pixelmap.readPixelsToBuffer(readBuffer).then(() => {
console.log('Succeeded in reading image pixel data.'); //符合条件则进入 console.log('Succeeded in reading image pixel data.'); //符合条件则进入
}).catch(error => { }).catch(error => {
...@@ -138,7 +138,7 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void ...@@ -138,7 +138,7 @@ readPixelsToBuffer(dst: ArrayBuffer, callback: AsyncCallback\<void>): void
**示例:** **示例:**
```js ```js
const readBuffer = new ArrayBuffer(96); const readBuffer = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
pixelmap.readPixelsToBuffer(readBuffer, (err, res) => { pixelmap.readPixelsToBuffer(readBuffer, (err, res) => {
if(err) { if(err) {
console.log('Failed to read image pixel data.'); //不符合条件则进入 console.log('Failed to read image pixel data.'); //不符合条件则进入
...@@ -202,7 +202,7 @@ readPixels(area: PositionArea, callback: AsyncCallback\<void>): void ...@@ -202,7 +202,7 @@ readPixels(area: PositionArea, callback: AsyncCallback\<void>): void
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
let bufferArr = new Uint8Array(color); let bufferArr = new Uint8Array(color);
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, (err, pixelmap) => { image.createPixelMap(color, opts, (err, pixelmap) => {
...@@ -243,7 +243,7 @@ writePixels(area: PositionArea): Promise\<void> ...@@ -243,7 +243,7 @@ writePixels(area: PositionArea): Promise\<void>
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
let bufferArr = new Uint8Array(color); let bufferArr = new Uint8Array(color);
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) image.createPixelMap(color, opts)
...@@ -328,7 +328,7 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void> ...@@ -328,7 +328,7 @@ writeBufferToPixels(src: ArrayBuffer): Promise\<void>
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
let bufferArr = new Uint8Array(color); let bufferArr = new Uint8Array(color);
for (var i = 0; i < bufferArr.length; i++) { for (var i = 0; i < bufferArr.length; i++) {
bufferArr[i] = i + 1; bufferArr[i] = i + 1;
...@@ -358,7 +358,7 @@ writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void ...@@ -358,7 +358,7 @@ writeBufferToPixels(src: ArrayBuffer, callback: AsyncCallback\<void>): void
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
let bufferArr = new Uint8Array(color); let bufferArr = new Uint8Array(color);
for (var i = 0; i < bufferArr.length; i++) { for (var i = 0; i < bufferArr.length; i++) {
bufferArr[i] = i + 1; bufferArr[i] = i + 1;
...@@ -390,7 +390,7 @@ getImageInfo(): Promise\<ImageInfo> ...@@ -390,7 +390,7 @@ getImageInfo(): Promise\<ImageInfo>
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } }
image.createPixelMap(color, opts).then(pixelmap => { image.createPixelMap(color, opts).then(pixelmap => {
if (pixelmap == undefined) { if (pixelmap == undefined) {
...@@ -424,7 +424,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void ...@@ -424,7 +424,7 @@ getImageInfo(callback: AsyncCallback\<ImageInfo>): void
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
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, (err, pixelmap) => { image.createPixelMap(color, opts, (err, pixelmap) => {
if (pixelmap == undefined) { if (pixelmap == undefined) {
...@@ -458,7 +458,7 @@ getBytesNumberPerRow(): number ...@@ -458,7 +458,7 @@ getBytesNumberPerRow(): number
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
let bufferArr = new Uint8Array(color); let bufferArr = new Uint8Array(color);
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, (err,pixelmap) => { image.createPixelMap(color, opts, (err,pixelmap) => {
...@@ -1044,7 +1044,7 @@ createImageSource(buf: ArrayBuffer): ImageSource ...@@ -1044,7 +1044,7 @@ createImageSource(buf: ArrayBuffer): ImageSource
**示例:** **示例:**
```js ```js
const buf = new ArrayBuffer(96); const buf = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
const imageSourceApi = image.createImageSource(buf); const imageSourceApi = image.createImageSource(buf);
``` ```
...@@ -1099,7 +1099,7 @@ createIncrementalSource(buf: ArrayBuffer): ImageSource ...@@ -1099,7 +1099,7 @@ createIncrementalSource(buf: ArrayBuffer): ImageSource
**示例:** **示例:**
```js ```js
const buf = new ArrayBuffer(96); const buf = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
const imageSourceIncrementalSApi = image.createIncrementalSource(buf); const imageSourceIncrementalSApi = image.createIncrementalSource(buf);
``` ```
...@@ -1127,7 +1127,7 @@ createIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource ...@@ -1127,7 +1127,7 @@ createIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource
**示例:** **示例:**
```js ```js
const buf = new ArrayBuffer(96); const buf = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
const imageSourceIncrementalSApi = image.createIncrementalSource(buf); const imageSourceIncrementalSApi = image.createIncrementalSource(buf);
``` ```
...@@ -1662,7 +1662,7 @@ packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayB ...@@ -1662,7 +1662,7 @@ packing(source: PixelMap, option: PackingOption, callback: AsyncCallback\<ArrayB
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
let bufferArr = new Uint8Array(color); let bufferArr = new Uint8Array(color);
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) => {
...@@ -1697,7 +1697,7 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer> ...@@ -1697,7 +1697,7 @@ packing(source: PixelMap, option: PackingOption): Promise\<ArrayBuffer>
**示例:** **示例:**
```js ```js
const color = new ArrayBuffer(96); const color = new ArrayBuffer(96); //96为需要创建的像素buffer大小,取值为:height * width *4
let bufferArr = new Uint8Array(color); let bufferArr = new Uint8Array(color);
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) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册