use of com.android.camera.CameraScreenNail in project android_packages_apps_Camera by CyanogenMod.
the class FaceView method onDraw.
@Override
protected void onDraw(Canvas canvas) {
if (!mBlocked && (mFaces != null) && (mFaces.length > 0)) {
final CameraScreenNail sn = ((CameraActivity) getContext()).getCameraScreenNail();
int rw = sn.getUncroppedRenderWidth();
int rh = sn.getUncroppedRenderHeight();
// Prepare the matrix.
if (((rh > rw) && ((mDisplayOrientation == 0) || (mDisplayOrientation == 180))) || ((rw > rh) && ((mDisplayOrientation == 90) || (mDisplayOrientation == 270)))) {
int temp = rw;
rw = rh;
rh = temp;
}
Util.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();
// postRotate is clockwise
mMatrix.postRotate(mOrientation);
// rotate is counter-clockwise (for canvas)
canvas.rotate(-mOrientation);
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)
Util.dumpRect(mRect, "Original rect");
mMatrix.mapRect(mRect);
if (LOGV)
Util.dumpRect(mRect, "Transformed rect");
mPaint.setColor(mColor);
mRect.offset(dx, dy);
canvas.drawOval(mRect, mPaint);
}
canvas.restore();
}
super.onDraw(canvas);
}
Aggregations