未验证 提交 2fc38f78 编写于 作者: 刘关鹏 提交者: Gitee

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

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