如何使用LWUIt VIdeoComponent捕获图像 [英] How to capture images using LWUIt VIdeoComponent
问题描述
我尝试使用MediaComponent
,但是由于现在已弃用它,因此前进将不会是一件好事.我也不能让它重新调整大小到窗体上的全屏.我正在尝试使用VideoComponent
捕获S40设备中的屏幕截图.我找不到如何正确实例化VideoComponent
来捕获图像而不播放视频的方法.
I have tried using MediaComponent
, but since it is now deprecated it wont be good moving forward. Also i was not able to get it to re-size to full screen on the form. I am trying to use VideoComponent
to capture a screen shot in an S40 device. I cant find how to instantiate the VideoComponent
properly for capturing an image and not playing a video.
推荐答案
您可以使用VideoComponent捕获图像.
You can use VideoComponent for capturing an image.
首先,要实例化VideoComponent,您需要创建一个本机对等体:
First, to instantiate the VideoComponent, you need to create a native peer:
VideoComponent videoComponent = VideoComponent.createVideoPeer("capture://video");
Player player = (Player) videoComponent.getNativePeer();
player.realize();
VideoControl videoControl = (VideoControl) player.getControl("VideoControl");
要捕获图像,您必须启动视频组件并使用Video Control的getSnapshot:
To capture the image, you have to start video component and use getSnapshot of Video Control:
videoComponent.start();
videoControl.getSnapshot(null);
如果要将视频组件的大小调整为全屏,则可以使用:
If you want to resize the video component to full screen you can use:
videoComponent.setFullScreen(false);
其他可能性是
videoComponent.setPreferredH(Display.getInstance().getDisplayHeight());
videoComponent.setPreferredW(Display.getInstance().getDisplayWidth());
这篇关于如何使用LWUIt VIdeoComponent捕获图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!