需要生成pixelmap,然后保存成图片存储在本地。操作步骤:1、调用XComponent,如下:XComponent({ id: XCOMPONENT_ID, type: XComponentType.TEXTURE, libraryname: LIBRARY_NAME }) .onLoad((xComponentContext) => { this.xComponentContext = xComponentContext as XComponentContext; }) .onDestroy(() => { Logger.info(TAG, "XComponent onDestroy"); }) .width('100%') .height('100%') .backgroundColor(Color.Black)2、调用createPixelMapFromSurface,如下:image.createPixelMapFromSurface(XCOMPONENT_ID, region).then(() => { Logger.info(TAG, 'onTakePhoto:Succeeded in creating pixelmap from Surface'); }).catch((error: BusinessError) => { Logger.error(TAG, 'onTakePhoto:Failed to create pixelmap ' + JSON.stringify(error)); });3、报错如下:onTakePhoto:Failed to create pixelmap 62980178
需要生成pixelmap,然后保存成图片存储在本地。
操作步骤:
1、调用XComponent,如下:
2、调用createPixelMapFromSurface,如下:
3、报错如下: