Example usage for android.graphics RectF RectF

List of usage examples for android.graphics RectF RectF

Introduction

In this page you can find the example usage for android.graphics RectF RectF.

Prototype

public RectF() 

Source Link

Document

Create a new empty RectF.

Usage

From source file:org.stockchart.core.Area.java

public RectF getSideMargins() {
    RectF r = new RectF();

    r.left = getLeftAxis().getSize(0f);/* www  .  j  a  va2  s .c  o m*/
    r.right = getRightAxis().getSize(0f);
    r.top = getTopAxis().getSize(0f);
    r.bottom = getBottomAxis().getSize(0f);

    if (fLegend.isVisible()) {
        RectF size = fLegend.getSize();

        switch (fLegend.getSide()) {
        case LEFT:
            r.left += size.width();
            break;
        case RIGHT:
            r.right += size.width();
            break;
        case BOTTOM:
            r.bottom += size.height();
            break;
        case TOP:
            r.top += size.height();
            break;

        }
    }

    return r;
}

From source file:com.fanfou.app.opensource.ui.viewpager.TitlePageIndicator.java

/**
 * Determines the height of this view//ww  w  . ja  va2  s  .  c o  m
 * 
 * @param measureSpec
 *            A measureSpec packed into an int
 * @return The height of the view, honoring constraints from measureSpec
 */
private int measureHeight(final int measureSpec) {
    float result = 0;
    final int specMode = MeasureSpec.getMode(measureSpec);
    final int specSize = MeasureSpec.getSize(measureSpec);

    if (specMode == MeasureSpec.EXACTLY) {
        // We were told how big to be
        result = specSize;
    } else {
        // Calculate the text bounds
        final RectF bounds = new RectF();
        bounds.bottom = this.mPaintText.descent() - this.mPaintText.ascent();
        result = (bounds.bottom - bounds.top) + this.mFooterLineHeight + this.mFooterPadding;
        if (this.mFooterIndicatorStyle != IndicatorStyle.None) {
            result += this.mFooterIndicatorHeight;
        }
    }
    return (int) result;
}

From source file:de.vanita5.twittnuker.view.ColorPickerView.java

@Override
protected void onSizeChanged(final int w, final int h, final int oldw, final int oldh) {

    super.onSizeChanged(w, h, oldw, oldh);

    mDrawingRect = new RectF();
    mDrawingRect.left = mDrawingOffset + getPaddingLeft();
    mDrawingRect.right = w - mDrawingOffset - getPaddingRight();
    mDrawingRect.top = mDrawingOffset + getPaddingTop();
    mDrawingRect.bottom = h - mDrawingOffset - getPaddingBottom();

    setUpSatValRect();/*  w  w  w. j  av a 2  s  .  co  m*/
    setUpHueRect();
    setUpAlphaRect();
}

From source file:com.huyn.demogroup.freechild.FixedViewAttacher.java

/**
 * Helper method that maps the supplied Matrix to the current Drawable
 *
 * @return RectF - Displayed Rectangle//  ww  w.ja  v a  2 s .  c o m
 */
private RectF getVisibleRect() {
    /*View parent = (View) mImageView.getParent();
    RectF mDisplayRect = new RectF();
    Rect mResult = new Rect();
    //parent.getGlobalVisibleRect(mResult);
    parent.getLocalVisibleRect(mResult);
    mDisplayRect.set(mResult);*/
    RectF mDisplayRect = new RectF();
    float tx = mImageView.getTranslationX();
    float ty = mImageView.getTranslationY();
    mDisplayRect.set(tx, ty, tx + mImageView.getWidth(), ty + mImageView.getHeight());
    return mDisplayRect;
}

From source file:com.jafme.mobile.activity.CropImageActivity.java

private Bitmap decodeRegionCrop(Rect rect, int outWidth, int outHeight) {
    // Release memory now
    clearImageView();//from  w  w  w  . j  a v  a 2 s  . com

    InputStream is = null;
    Bitmap croppedImage = null;
    try {
        is = getContentResolver().openInputStream(sourceUri);
        BitmapRegionDecoder decoder = BitmapRegionDecoder.newInstance(is, false);
        final int width = decoder.getWidth();
        final int height = decoder.getHeight();

        if (exifRotation != 0) {
            // Adjust crop area to account for image rotation
            Matrix matrix = new Matrix();
            matrix.setRotate(-exifRotation);

            RectF adjusted = new RectF();
            matrix.mapRect(adjusted, new RectF(rect));

            // Adjust to account for origin at 0,0
            adjusted.offset(adjusted.left < 0 ? width : 0, adjusted.top < 0 ? height : 0);
            rect = new Rect((int) adjusted.left, (int) adjusted.top, (int) adjusted.right,
                    (int) adjusted.bottom);
        }

        try {
            croppedImage = decoder.decodeRegion(rect, new BitmapFactory.Options());

            //  ?  

            if (exifRotation != 0) {

                final Matrix matrix = new Matrix();
                matrix.setRotate(exifRotation);
                croppedImage = Bitmap.createBitmap(croppedImage, 0, 0, croppedImage.getWidth(),
                        croppedImage.getHeight(), matrix, true);

                exifRotation = 0;
            }

            int croppedWidth = croppedImage.getWidth();
            int croppedHeight = croppedImage.getHeight();
            if (croppedWidth > outWidth || croppedHeight > outHeight) {
                Matrix matrix = new Matrix();
                matrix.postScale((float) outWidth / croppedWidth, (float) outHeight / croppedHeight);
                croppedImage = Bitmap.createBitmap(croppedImage, 0, 0, croppedWidth, croppedHeight, matrix,
                        true);
            }

        } catch (IllegalArgumentException e) {
            // Rethrow with some extra information
            throw new IllegalArgumentException("Rectangle " + rect + " is outside of the image (" + width + ","
                    + height + "," + exifRotation + ")", e);
        }

    } catch (IOException e) {
        Log.e(LOG_TAG, "Error cropping image: " + e.getMessage(), e);
        finish();
    } catch (OutOfMemoryError e) {
        Log.e(LOG_TAG, "OOM cropping image: " + e.getMessage(), e);
        setResultException(e);
    } finally {
        CropUtil.closeSilently(is);
    }
    return croppedImage;
}

From source file:net.networksaremadeofstring.rhybudd.RhybuddDock.java

private void drawScale(Canvas canvas, Boolean Colors, int Count, int Max) {
    RectF faceRect = new RectF();
    faceRect.set(10, 10, 190, 190);//from w  w w  . j a  v  a2s  .c om

    Paint scalePaint = new Paint();
    scalePaint.setStyle(Paint.Style.STROKE);
    scalePaint.setColor(getResources().getColor(R.color.WarningGreen));
    scalePaint.setStrokeWidth(1);
    scalePaint.setAntiAlias(true);

    scalePaint.setTextSize(12);
    scalePaint.setTypeface(Typeface.createFromAsset(this.getAssets(), "fonts/chivo.ttf"));
    scalePaint.setTextAlign(Paint.Align.CENTER);

    float scalePosition = 10;
    RectF scaleRect = new RectF();
    scaleRect.set(faceRect.left + scalePosition, faceRect.top + scalePosition, faceRect.right - scalePosition,
            faceRect.bottom - scalePosition);

    if (!Colors)
        scalePaint.setColor(Color.WHITE);

    scalePaint.setStrokeWidth(2);
    canvas.save(Canvas.MATRIX_SAVE_FLAG);
    for (int i = 0; i < Max; ++i) {
        if (Colors) {
            if (i > 20)
                scalePaint.setColor(getResources().getColor(R.color.WarningYellow));

            if (i > 40)
                scalePaint.setColor(getResources().getColor(R.color.WarningOrange));

            if (i > 60)
                scalePaint.setColor(getResources().getColor(R.color.WarningRed));
        }

        canvas.drawLine(100, 20, 100, 18, scalePaint);
        int divisor = 5;

        if (Max > 100)
            divisor = 25;

        if (i % divisor == 0) {
            canvas.drawText(Integer.toString(i), 100, 16, scalePaint);
        }

        canvas.rotate((360.0f / Max), 100, 100);
    }

    canvas.restore();
}

From source file:com.futurologeek.smartcrossing.crop.CropImageActivity.java

private Bitmap decodeRegionCrop(Rect rect, int outWidth, int outHeight) {
    // Release memory now
    clearImageView();/*from   ww  w.  ja v a 2 s  .  c  o  m*/

    InputStream is = null;
    Bitmap croppedImage = null;
    try {
        is = getContentResolver().openInputStream(sourceUri);
        BitmapRegionDecoder decoder = BitmapRegionDecoder.newInstance(is, false);
        final int width = decoder.getWidth();
        final int height = decoder.getHeight();

        if (exifRotation != 0) {
            // Adjust crop area to account for image rotation
            Matrix matrix = new Matrix();
            matrix.setRotate(-exifRotation);

            RectF adjusted = new RectF();
            matrix.mapRect(adjusted, new RectF(rect));

            //if the cutting box are rectangle( outWidth != outHeight ),and the exifRotation is 90 or 270,
            //the outWidth and outHeight showld be interchanged
            if (exifRotation == 90 || exifRotation == 270) {
                int temp = outWidth;
                outWidth = outHeight;
                outHeight = temp;
            }

            // Adjust to account for origin at 0,0
            adjusted.offset(adjusted.left < 0 ? width : 0, adjusted.top < 0 ? height : 0);
            rect = new Rect((int) adjusted.left, (int) adjusted.top, (int) adjusted.right,
                    (int) adjusted.bottom);
        }

        try {
            croppedImage = decoder.decodeRegion(rect, new BitmapFactory.Options());
            if (rect.width() > outWidth || rect.height() > outHeight) {
                Matrix matrix = new Matrix();
                matrix.postScale((float) outWidth / rect.width(), (float) outHeight / rect.height());

                //if the picture's exifRotation !=0 ,they should be rotate to 0 degrees
                matrix.postRotate(exifRotation);
                croppedImage = Bitmap.createBitmap(croppedImage, 0, 0, croppedImage.getWidth(),
                        croppedImage.getHeight(), matrix, true);
            } else {
                //if the picture need not to be scale, they also neet to be rotate to 0 degrees
                Matrix matrix = new Matrix();
                matrix.postRotate(exifRotation);
                croppedImage = Bitmap.createBitmap(croppedImage, 0, 0, croppedImage.getWidth(),
                        croppedImage.getHeight(), matrix, true);
            }
        } catch (IllegalArgumentException e) {
            // Rethrow with some extra information
            throw new IllegalArgumentException("Rectangle " + rect + " is outside of the image (" + width + ","
                    + height + "," + exifRotation + ")", e);
        }

    } catch (IOException e) {
        Log.e("Error cropping image: " + e.getMessage(), e);
        finish();
    } catch (OutOfMemoryError e) {
        Log.e("OOM cropping image: " + e.getMessage(), e);
        setResultException(e);
    } finally {
        CropUtil.closeSilently(is);
    }
    return croppedImage;
}

From source file:in.sc9.discreteslider.DiscreteSlider.java

public DiscreteSlider(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setFocusable(true);/*from   w  w w.  ja v a  2  s . c  o m*/
    setWillNotDraw(false);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    float density = context.getResources().getDisplayMetrics().density;
    mTrackHeight = (int) (1 * density);
    mScrubberHeight = (int) (4 * density);
    int thumbSize = (int) (density * ThumbDrawable.DEFAULT_SIZE_DP);

    //Extra pixels for a touch area of 48dp
    int touchBounds = (int) (density * 32);
    mAddedTouchBounds = (touchBounds - thumbSize) / 2;

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSlider, defStyleAttr,
            R.style.Widget_DiscreteSeekBar);

    int max = 100;
    int min = 0;
    int value = 0;
    mMirrorForRtl = a.getBoolean(R.styleable.DiscreteSlider_dsb_mirrorForRtl, mMirrorForRtl);
    mAllowTrackClick = a.getBoolean(R.styleable.DiscreteSlider_dsb_allowTrackClickToDrag, mAllowTrackClick);
    mIndicatorPopupEnabled = a.getBoolean(R.styleable.DiscreteSlider_dsb_indicatorPopupEnabled,
            mIndicatorPopupEnabled);
    mIndicatorTextFromArray = a.getBoolean(R.styleable.DiscreteSlider_dsb_indicatorTextFromArray,
            mIndicatorTextFromArray);
    int indexMax = R.styleable.DiscreteSlider_dsb_max;
    int indexMin = R.styleable.DiscreteSlider_dsb_min;
    int indexValue = R.styleable.DiscreteSlider_dsb_value;
    final TypedValue out = new TypedValue();
    //Not sure why, but we wanted to be able to use dimensions here...
    if (a.getValue(indexMax, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            max = a.getDimensionPixelSize(indexMax, max);
        } else {
            max = a.getInteger(indexMax, max);
        }
    }
    if (a.getValue(indexMin, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            min = a.getDimensionPixelSize(indexMin, min);
        } else {
            min = a.getInteger(indexMin, min);
        }
    }
    if (a.getValue(indexValue, out)) {
        if (out.type == TypedValue.TYPE_DIMENSION) {
            value = a.getDimensionPixelSize(indexValue, value);
        } else {
            value = a.getInteger(indexValue, value);
        }
    }

    mMin = min;
    mMax = Math.max(min + 1, max);
    mValue = Math.max(min, Math.min(max, value));
    updateKeyboardRange();

    mIndicatorFormatter = a.getString(R.styleable.DiscreteSlider_dsb_indicatorFormatter);

    mDiscretePointsEnabled = a.getBoolean(R.styleable.DiscreteSlider_dsb_discretePointsEnabled, false);
    mDiscretePointsShowAlways = a.getBoolean(R.styleable.DiscreteSlider_dsb_discretePointsShowAlways, false);

    ColorStateList trackColor = a.getColorStateList(R.styleable.DiscreteSlider_dsb_trackColor);
    ColorStateList progressColor = a.getColorStateList(R.styleable.DiscreteSlider_dsb_progressColor);
    ColorStateList rippleColor = a.getColorStateList(R.styleable.DiscreteSlider_dsb_rippleColor);
    int discretePointColor = a.getColor(R.styleable.DiscreteSlider_dsb_discretePointsColor, Color.RED);

    mtextColor = a.getColor(R.styleable.DiscreteSlider_dsb_textColor, Color.BLACK);
    mTextSize = a.getDimensionPixelSize(R.styleable.DiscreteSlider_dsb_TextSize, mTextSize);
    mTextPaddingTop = a.getDimensionPixelSize(R.styleable.DiscreteSlider_dsb_TextSize, mTextPaddingTop);
    textStyle = a.getInt(R.styleable.DiscreteSlider_dsb_TextStyle, textStyle);

    boolean editMode = isInEditMode();
    if (editMode || rippleColor == null) {
        rippleColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.DKGRAY });
    }
    if (editMode || trackColor == null) {
        trackColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { Color.GRAY });
    }
    if (editMode || progressColor == null) {
        progressColor = new ColorStateList(new int[][] { new int[] {} }, new int[] { DEFAULT_THUMB_COLOR });
    }
    if (editMode) {
        discretePointColor = Color.RED;
        mtextColor = Color.BLACK;
    }
    mRipple = SeekBarCompat.getRipple(rippleColor);
    if (isLollipopOrGreater) {
        SeekBarCompat.setBackground(this, mRipple);
    } else {
        mRipple.setCallback(this);
    }

    TrackRectDrawable shapeDrawable = new TrackRectDrawable(trackColor);
    mTrack = shapeDrawable;
    mTrack.setCallback(this);

    shapeDrawable = new TrackRectDrawable(progressColor);
    mScrubber = shapeDrawable;
    mScrubber.setCallback(this);

    mThumb = new ThumbDrawable(progressColor, thumbSize);
    mThumb.setCallback(this);
    mThumb.setBounds(0, 0, mThumb.getIntrinsicWidth(), mThumb.getIntrinsicHeight());

    textArray = new String[((mMax - mMin) + 1)];

    int j = mMin;
    for (int i = 0; i < ((mMax - mMin) + 1); i++) {
        if (j <= mMax) {
            textArray[i] = j + "";
            j++;
        } else
            break;
    }

    if (!editMode) {
        mIndicator = new PopupIndicator(context, attrs, defStyleAttr, convertValueToMessage(mMax));
        mIndicator.setListener(mFloaterListener);
    }
    a.recycle();

    setNumericTransformer(new DefaultNumericTransformer());

    mDiscretePoints = new Paint(Paint.ANTI_ALIAS_FLAG);
    mDiscretePoints.setColor(discretePointColor);
    mDiscretePoints.setStyle(Paint.Style.FILL);
    mDiscretePointsTran = new Paint(Paint.ANTI_ALIAS_FLAG);
    mDiscretePointsTran.setColor(Color.TRANSPARENT);
    mDiscretePointsTran.setStyle(Paint.Style.FILL_AND_STROKE);
    position = new RectF();

}

From source file:org.akop.crosswords.view.CrosswordView.java

public CrosswordView(Context context, AttributeSet attrs) {
    super(context, attrs);

    if (!isInEditMode()) {
        setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }//from w  w  w.j  a v a2s  .c o m

    // Set drawing defaults
    Resources r = context.getResources();
    DisplayMetrics dm = r.getDisplayMetrics();

    int cellFillColor = NORMAL_CELL_FILL_COLOR;
    int cheatedCellFillColor = CHEATED_CELL_FILL_COLOR;
    int mistakeCellFillColor = MISTAKE_CELL_FILL_COLOR;
    int selectedWordFillColor = SELECTED_WORD_FILL_COLOR;
    int selectedCellFillColor = SELECTED_CELL_FILL_COLOR;
    int textColor = TEXT_COLOR;
    int cellStrokeColor = CELL_STROKE_COLOR;
    int circleStrokeColor = CIRCLE_STROKE_COLOR;

    float numberTextSize = NUMBER_TEXT_SIZE * dm.scaledDensity;
    float answerTextSize = ANSWER_TEXT_SIZE * dm.scaledDensity;

    mCellSize = CELL_SIZE * dm.density;
    mNumberTextPadding = NUMBER_TEXT_PADDING * dm.density;
    mAnswerTextPadding = ANSWER_TEXT_PADDING * dm.density;

    // Read supplied attributes
    if (attrs != null) {
        Resources.Theme theme = context.getTheme();
        TypedArray a = theme.obtainStyledAttributes(attrs, R.styleable.Crossword, 0, 0);
        mCellSize = a.getDimension(R.styleable.Crossword_cellSize, mCellSize);
        mNumberTextPadding = a.getDimension(R.styleable.Crossword_numberTextPadding, mNumberTextPadding);
        numberTextSize = a.getDimension(R.styleable.Crossword_numberTextSize, numberTextSize);
        mAnswerTextPadding = a.getDimension(R.styleable.Crossword_answerTextPadding, mAnswerTextPadding);
        answerTextSize = a.getDimension(R.styleable.Crossword_answerTextSize, answerTextSize);
        cellFillColor = a.getColor(R.styleable.Crossword_defaultCellFillColor, cellFillColor);
        cheatedCellFillColor = a.getColor(R.styleable.Crossword_cheatedCellFillColor, cheatedCellFillColor);
        mistakeCellFillColor = a.getColor(R.styleable.Crossword_mistakeCellFillColor, mistakeCellFillColor);
        selectedWordFillColor = a.getColor(R.styleable.Crossword_selectedWordFillColor, selectedWordFillColor);
        selectedCellFillColor = a.getColor(R.styleable.Crossword_selectedCellFillColor, selectedCellFillColor);
        cellStrokeColor = a.getColor(R.styleable.Crossword_cellStrokeColor, cellStrokeColor);
        circleStrokeColor = a.getColor(R.styleable.Crossword_circleStrokeColor, circleStrokeColor);
        textColor = a.getColor(R.styleable.Crossword_textColor, textColor);
        a.recycle();
    }

    mMarkerSideLength = mCellSize * MARKER_TRIANGLE_LENGTH_FRACTION;

    // Init paints
    mCellFillPaint = new Paint();
    mCellFillPaint.setColor(cellFillColor);
    mCellFillPaint.setStyle(Paint.Style.FILL);

    mCheatedCellFillPaint = new Paint();
    mCheatedCellFillPaint.setColor(cheatedCellFillColor);
    mCheatedCellFillPaint.setStyle(Paint.Style.FILL);

    mMistakeCellFillPaint = new Paint();
    mMistakeCellFillPaint.setColor(mistakeCellFillColor);
    mMistakeCellFillPaint.setStyle(Paint.Style.FILL);

    mSelectedWordFillPaint = new Paint();
    mSelectedWordFillPaint.setColor(selectedWordFillColor);
    mSelectedWordFillPaint.setStyle(Paint.Style.FILL);

    mSelectedCellFillPaint = new Paint();
    mSelectedCellFillPaint.setColor(selectedCellFillColor);
    mSelectedCellFillPaint.setStyle(Paint.Style.FILL);

    mCellStrokePaint = new Paint();
    mCellStrokePaint.setColor(cellStrokeColor);
    mCellStrokePaint.setStyle(Paint.Style.STROKE);
    //      mCellStrokePaint.setStrokeWidth(1);

    mCircleStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mCircleStrokePaint.setColor(circleStrokeColor);
    mCircleStrokePaint.setStyle(Paint.Style.STROKE);
    mCircleStrokePaint.setStrokeWidth(1);

    mNumberTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mNumberTextPaint.setColor(textColor);
    mNumberTextPaint.setTextAlign(Paint.Align.CENTER);
    mNumberTextPaint.setTextSize(numberTextSize);

    mNumberStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mNumberStrokePaint.setColor(cellFillColor);
    mNumberStrokePaint.setTextAlign(Paint.Align.CENTER);
    mNumberStrokePaint.setTextSize(numberTextSize);
    mNumberStrokePaint.setStyle(Paint.Style.STROKE);
    mNumberStrokePaint.setStrokeWidth(NUMBER_TEXT_STROKE_WIDTH * dm.scaledDensity);

    mAnswerTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mAnswerTextPaint.setColor(textColor);
    mAnswerTextPaint.setTextSize(answerTextSize);
    mAnswerTextPaint.setTextAlign(Paint.Align.CENTER);

    // http://www.google.com/fonts/specimen/Kalam
    Typeface typeface = Typeface.createFromAsset(context.getAssets(), "kalam-regular.ttf");
    mAnswerTextPaint.setTypeface(typeface);

    // Init rest of the values
    mCircleRadius = (mCellSize / 2) - mCircleStrokePaint.getStrokeWidth();
    mPuzzleCells = EMPTY_CELLS;
    mPuzzleWidth = 0;
    mPuzzleHeight = 0;
    mAllowedChars = EMPTY_CHARS;

    mRenderScale = 0;
    mBitmapOffset = new PointF();
    mCenteredOffset = new PointF();
    mTranslationBounds = new RectF();

    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    mGestureDetector = new GestureDetector(context, new GestureListener());

    mContentRect = new RectF();
    mPuzzleRect = new RectF();

    mBitmapPaint = new Paint(Paint.FILTER_BITMAP_FLAG);

    mScroller = new Scroller(context, null, true);
    mZoomer = new Zoomer(context);

    setFocusableInTouchMode(true);
    setOnKeyListener(this);
}

From source file:com.example.android.camera.CameraActivity.java

private List<Rect> getFaces() {
    List<Rect> found = new ArrayList<Rect>();

    for (Face face : mPreview.faces) {
        if (face.score < 100)
            continue;

        Rect rect = new Rect();
        RectF rectf = new RectF();

        rectf.set(face.rect);/* w  w w.j  a v  a2 s  . c o  m*/
        mViewFinderView.dumpRect(rectf, "before");
        matrix.mapRect(rectf);
        mViewFinderView.dumpRect(rectf, "after");

        float adj = (rectf.bottom - rectf.top - rectf.right + rectf.left) / 2;
        rectf.set(rectf.left - adj, rectf.top, rectf.right + adj, rectf.bottom);
        mViewFinderView.dumpRect(rectf, "Squared");

        if (rectf.left < 0) {
            rectf.set(0, rectf.top, rectf.right - rectf.left, rectf.bottom);
            Log.d("face Adjust", "Left");
        } else if (rectf.right > pWidth) {
            rectf.set(rectf.left - rectf.right + pWidth, rectf.top, pWidth, rectf.bottom);
            Log.d("face Adjust", "Right");
        }

        if (rectf.top < 0) {
            rectf.set(rectf.left, 0, rectf.right, rectf.bottom - rectf.top);
            Log.d("face Adjust", "Top");
        } else if (rectf.bottom > pHeight) {
            rectf.set(rectf.left, rectf.top - rectf.bottom + pHeight, rectf.right, pHeight);
            Log.d("face Adjust", "Bottom");
        }

        mViewFinderView.dumpRect(rectf, "Shift Adjusted");
        rectf.round(rect);
        found.add(rect);
    }

    return found;
}