本文整理汇总了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);
}
示例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;
}
}
示例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);
}
示例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;
}
}