zoukankan      html  css  js  c++  java
  • Android camera 使用过程中的小知识

    一、两个SurfaceView层叠显示

    创建SurfaceView对象之后,将尺寸较小的SurfaceView设置背景透明,顶层显示。

    1 mySurfaceView.setZOrderOnTop(true);    //设置画布背景透明    
    2 mySurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);

    二、调用camera时可能需要设置preview的角度,注意setDisplayOrientation(90)方法应改在unlock( )方法之前调用

    1 camera = Camera.open(cameraId);
    2 camera.setDisplayOrientation(90);
    3 camera.unlock();

    三、利用Matrix类对Bitmap进行旋转和缩放

    Matrix方法中的setRotate()方法会先清除该矩阵,即设为单位矩阵。之后设置旋转操作的,同样,setTranslate()等方法也是一样的。

    所以是不能叠加各种效果在一起的。

    如果是想多种效果同时使用的话,应该使用postRotate(), postTranslate()等类似的矩阵变换方法。

    1 Matrix matrix = new Matrix();
    2 matrix.setRotate(-90);
    3 matrix.postScale(scaleX, scaleY);
    4 Bitmap bmp = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
  • 相关阅读:
    mongoDb
    profile ,explain,
    header 里面的contenttype
    group by,distinct的使用(30万数据测试)
    ubuntu 12.04 mysql 错误 Errcode 13
    php curl,爬虫
    explain mysql
    php 文件的函数
    create User,grand,Load data file
    android 按钮点击测试
  • 原文地址:https://www.cnblogs.com/QuentinYo/p/3439457.html
Copyright © 2011-2022 走看看