黑色浆果摄像头编程 [英] Black berry camera programming

查看:124
本文介绍了黑色浆果摄像头编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要采取使用黑色浆果相机内的照片我的应用程序,它是在5.0版可能并是那么如何?

I want take pictures using black berry camera for my app, it is possible in v5.0 and yes then how?

推荐答案

是的,它是绝对有可能的,但不是一个很简单的任务,如果你没有得到一些建议锋线。

Yes it is definitely possible, but not a very simple task if you don't get some advice up front.

首先,有附带演示了如何使用现场,播放机,并VideoScreen创建viewfiender Eclipse的包至少(CameraDemo)一些示例code。最大的问题是第三方开发人员不能在取景器的顶部覆盖任何东西(这是什么,他们会打电话给外地将它设置为这样一个VideoControl对了。

First and foremost, there is some sample code that is shipped with the Eclipse package at least (CameraDemo) that shows how to create a viewfiender using a Field, Player, and VideoScreen. The biggest issue is third party developers cannot overlay anything on top of the view finder (which is the what they'll call the Field after you set it as such with a VideoControl.

另外,你是非常有限的,以什么样的大小可以设置字段 - 我只听懂了一半的大小和全屏工作,某些方面得到了忽视和其他人造成它根本不显示。

Also, you are very limited to what size you can set the Field -- I only got half size and fullscreen working, some dimensions got ignored and others caused it to not be displayed at all.

下面是一些code,显示这一点:

Here is some code that shows this:

private Field _videoField;
private Player _player;
private VideoControl _videoControl;

private void initCamera() {
        try{ 
            _player = Manager.createPlayer( "capture://video??encoding=jpeg&width=640&height=480" );
            _player.realize();
            _player.prefetch();
            _videoControl = (VideoControl)_player.getControl("VideoControl");
            _player.start();                
            if (_videoControl != null){

                _videoField = (Field) _videoControl.initDisplayMode (VideoControl.USE_GUI_PRIMITIVE, "net.rim.device.api.ui.Field");
                _videoControl.setDisplayFullScreen(true);
                add(_videoField);
            }
        }
        catch(Exception e)
        {
           //show error
        }
    }

您做到这一点后,您可以使用

After you do this you can use

            byte[] image = _videoControl.getSnapshot(sizeAndEncodingParamters);

抓拍图片。要确定sizeAndEncodingParameters您的设备支持,可以使用 System.getProperty(video.snapshot.encodings); 将返回一个的String [] ,你可以遍历来决定使用什么样的。

to snap the picture. To determine what sizeAndEncodingParameters your device supports, you can use System.getProperty("video.snapshot.encodings"); which will return a String[] that you can iterate over to determine what to use.

这篇关于黑色浆果摄像头编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆