未验证 提交 9a7976e6 编写于 作者: 刘关鹏 提交者: Gitee

update zh-cn/application-dev/media/image-transformation-native.md.

Signed-off-by: N刘关鹏 <liuguanpeng1@huawei.com>
上级 f69c94f3
......@@ -100,7 +100,7 @@
2. 调用Native接口,传入JS的资源对象。示例如下:
```js
```ts
import testNapi from 'libentry.so'
import image from '@ohos.multimedia.image';
......@@ -108,7 +108,6 @@
@Component
struct Index {
@State message: string = 'IMAGE'
@State _PixelMap: image.PixelMap = undefined
build() {
Row() {
......@@ -117,22 +116,20 @@
.fontSize(50)
.fontWeight(FontWeight.Bold)
.onClick(() => {
const color = new ArrayBuffer(96);
let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 4, width: 6 } }
const color : ArrayBuffer = new ArrayBuffer(96);
let opts: image.InitializationOptions = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 4, width: 6 } }
image.createPixelMap(color, opts)
.then( pixelmap => {
this._PixelMap = pixelmap;
})
testNapi.testGetImageInfo(this._PixelMap);
.then( (pixelmap : image.PixelMap) => {
testNapi.testGetImageInfo(pixelmap);
console.info("Test GetImageInfo success");
testNapi.testAccessPixels(this._PixelMap);
testNapi.testAccessPixels(pixelmap);
console.info("Test AccessPixels success");
testNapi.testUnAccessPixels(this._PixelMap);
testNapi.testUnAccessPixels(pixelmap);
console.info("Test UnAccessPixels success");
})
})
}
.width('100%')
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册