当前位置: 首页>>代码示例>>Java>>正文


Java CameraUtil.prepareMatrix方法代码示例

本文整理汇总了Java中com.android.camera.util.CameraUtil.prepareMatrix方法的典型用法代码示例。如果您正苦于以下问题:Java CameraUtil.prepareMatrix方法的具体用法?Java CameraUtil.prepareMatrix怎么用?Java CameraUtil.prepareMatrix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.android.camera.util.CameraUtil的用法示例。


在下文中一共展示了CameraUtil.prepareMatrix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onDraw

import com.android.camera.util.CameraUtil; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    if (!mBlocked && (mFaces != null) && (mFaces.length > 0)) {
        int rw, rh;
        rw = (int) mPreviewArea.width();
        rh = (int) mPreviewArea.height();
        // Prepare the matrix.
        if (((rh > rw) && ((mDisplayOrientation == 0) || (mDisplayOrientation == 180)))
                || ((rw > rh) && ((mDisplayOrientation == 90) || (mDisplayOrientation == 270)))) {
            int temp = rw;
            rw = rh;
            rh = temp;
        }
        CameraUtil.prepareMatrix(mMatrix, mMirror, mDisplayOrientation, rw, rh);
        // Focus indicator is directional. Rotate the matrix and the canvas
        // so it looks correctly in all orientations.
        canvas.save();
        mMatrix.postRotate(mOrientation); // postRotate is clockwise
        canvas.rotate(-mOrientation); // rotate is counter-clockwise (for canvas)
        for (int i = 0; i < mFaces.length; i++) {
            // Filter out false positives.
            if (mFaces[i].score < 50) continue;

            // Transform the coordinates.
            mRect.set(mFaces[i].rect);
            if (LOGV) {
                CameraUtil.dumpRect(mRect, "Original rect");
            }
            mMatrix.mapRect(mRect);
            if (LOGV) {
                CameraUtil.dumpRect(mRect, "Transformed rect");
            }
            mPaint.setColor(mColor);
            mRect.offset(mPreviewArea.left, mPreviewArea.top);
            canvas.drawRect(mRect, mPaint);
        }
        canvas.restore();
    }
    super.onDraw(canvas);
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:41,代码来源:FaceView.java

示例2: setMatrix

import com.android.camera.util.CameraUtil; //导入方法依赖的package包/类
private void setMatrix() {
    if (mPreviewRect.width() != 0 && mPreviewRect.height() != 0) {
        Matrix matrix = new Matrix();
        CameraUtil.prepareMatrix(matrix, mMirror, mDisplayOrientation, getPreviewRect());
        // In face detection, the matrix converts the driver coordinates to UI
        // coordinates. In tap focus, the inverted matrix converts the UI
        // coordinates to driver coordinates.
        matrix.invert(mMatrix);
        mInitialized = true;
    }
}
 
开发者ID:jameliu,项目名称:Camera2,代码行数:12,代码来源:FocusOverlayManager.java

示例3: onDraw

import com.android.camera.util.CameraUtil; //导入方法依赖的package包/类
@Override
protected void onDraw(Canvas canvas) {
    if (!mBlocked && (mFaces != null) && (mFaces.length > 0)) {
        int rw, rh;
        rw = mUncroppedWidth;
        rh = mUncroppedHeight;
        // Prepare the matrix.
        if (((rh > rw) && ((mDisplayOrientation == 0) || (mDisplayOrientation == 180)))
                || ((rw > rh) && ((mDisplayOrientation == 90) || (mDisplayOrientation == 270)))) {
            int temp = rw;
            rw = rh;
            rh = temp;
        }
        CameraUtil.prepareMatrix(mMatrix, mMirror, mDisplayOrientation, rw, rh);
        int dx = (getWidth() - rw) / 2;
        int dy = (getHeight() - rh) / 2;

        // Focus indicator is directional. Rotate the matrix and the canvas
        // so it looks correctly in all orientations.
        canvas.save();
        mMatrix.postRotate(mOrientation); // postRotate is clockwise
        canvas.rotate(-mOrientation); // rotate is counter-clockwise (for canvas)
        for (int i = 0; i < mFaces.length; i++) {
            // Filter out false positives.
            if (mFaces[i].score < 50) continue;

            // Transform the coordinates.
            mRect.set(mFaces[i].rect);
            if (LOGV) CameraUtil.dumpRect(mRect, "Original rect");
            mMatrix.mapRect(mRect);
            if (LOGV) CameraUtil.dumpRect(mRect, "Transformed rect");
            mPaint.setColor(mColor);
            mRect.offset(dx, dy);
            canvas.drawOval(mRect, mPaint);
        }
        canvas.restore();
    }
    super.onDraw(canvas);
}
 
开发者ID:asm-products,项目名称:nexus-camera,代码行数:40,代码来源:FaceView.java

示例4: setMatrix

import com.android.camera.util.CameraUtil; //导入方法依赖的package包/类
private void setMatrix() {
    if (mPreviewWidth != 0 && mPreviewHeight != 0) {
        Matrix matrix = new Matrix();
        CameraUtil.prepareMatrix(matrix, mMirror, mDisplayOrientation,
                mPreviewWidth, mPreviewHeight);
        // In face detection, the matrix converts the driver coordinates to UI
        // coordinates. In tap focus, the inverted matrix converts the UI
        // coordinates to driver coordinates.
        matrix.invert(mMatrix);
        mInitialized = true;
    }
}
 
开发者ID:asm-products,项目名称:nexus-camera,代码行数:13,代码来源:FocusOverlayManager.java


注:本文中的com.android.camera.util.CameraUtil.prepareMatrix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。