Code example for RectF

Methods: height, set, width

0
    /** 
     * Sets cropped bounds; modifies the bounds if it's smaller than the allowed dimensions. 
     */ 
    public void setCropBounds(RectF bounds) {
        // Avoid cropping smaller than minimum width or height. 
        if (bounds.width() * getPhotoWidth() < MIN_CROP_WIDTH_HEIGHT) {
            bounds.set(0, bounds.top, 1, bounds.bottom);
        } 
        if (bounds.height() * getPhotoHeight() < MIN_CROP_WIDTH_HEIGHT) {
            bounds.set(bounds.left, 0, bounds.right, 1);
        } 
        cropBounds.set(bounds);
        refreshByCropChange(false); 
    } 
 
    private RectF getCropBoundsDisplayed() {
        float width = displayBounds.width();
        float height = displayBounds.height();
        RectF cropped = new RectF(cropBounds.left * width, cropBounds.top * height,
                cropBounds.right * width, cropBounds.bottom * height);
        cropped.offset(displayBounds.left, displayBounds.top);