Android Camera之 --- Camera API说明(二)

前一篇文章讲解了Camera API的使用流程和Camera内部类CameraInfo和Parameters。http://blog.csdn.net/rony2012/article/details/74908121下面重点介绍Camera API,并通过一个简单的实例程序来说明Camera的使用流程。首先来认识以下Camera内部的回调接口,使用者必须实现器大部分很的回
摘要由CSDN通过智能技术生成

Camera API 介绍系列文章:

Android Camera之 --- Camera API说明(一)

Android Camera之 --- Camera API说明(二)

Android Camera之 --- Camera API说明(三)


下面重点介绍Camera API内的回调函数和内部辅助类,以及msg的相应过程。

首先来认识以下Camera内部的回调接口,使用者必须实现器大部分很的回调接口以便更好的操作camera设备。

1. interface ShutterCallback

    // 回调接口,快门声
    // takePicture(ShutterCallback, PictureCallback, PictureCallback, PictureCallback)的第一个参数,被触发来播放一个快门声音
    @Deprecated
    public interface ShutterCallback
    {
        /**
         * Called as near as possible to the moment when a photo is captured
         * from the sensor.  This is a good opportunity to play a shutter sound
         * or give other feedback of camera operation.  This may be some time
         * after the photo was triggered, but some time before the actual data
         * is available.
         */
        void onShutter();
    }


2.  interface PictureCallback

    // 回调接口, 提供拍照时的数据,数据类型有:Raw picture, posview picture, JPEG picture.
    // takePicture(ShutterCallback, PictureCallback, PictureCallback, PictureCallback)的后三个参数都为PictureCallback.
    // 分别为RawPictureCallback, PostViewPictureCallback, JPEGPictureCallback
    @Deprecated
    public interface PictureCallback {
        /**
         * Called when image data is available after a picture is taken.
         * The format of the data depends on the context of the callback
         * and {@link Camera.Parameters} settings.
         *
         * @param data   a byte array of the picture data
         * @param camera the Camera service object
         */
        void onPictureTaken(byte[] data, Camera camera);
    };

3.  interface PreviewCallback
// 回调接口,用来获取YUV数据,格式必须支持NV21和YV12.
    // 想获取YV12,则必须调用Camera.Parameters。setPreviewFormat(int)进行设置,默认为NV21数据
    @Deprecated
    public interface PreviewCallback
    {
        /**
         * Called as preview frames are displayed.  This callback is invoked
         * on the event thread {@link #open(int)} was called from.
         *
         * <p>If using the {@link android.graphics.ImageFormat#YV12} format,
         * refer to the equations in {@link Camera.Parameters#setPreviewFormat}
         * for the arrangement of the pixel data in the preview callback
         * buffers.
         *
         * @param
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值