Code example for RectF

Methods: isEmpty

0
    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
        super.onSizeChanged(w, h, oldw, oldh);
 
        displayBounds.setEmpty();
        photoMatrix.reset();
        if (photoBounds.isEmpty()) {
            return; 
        } 
 
        // Assumes photo-view is also full-screen as this tool-view and centers/scales photo to fit. 
        Matrix matrix = new Matrix();
        if (matrix.setRectToRect(photoBounds, new RectF(0, 0, w, h), Matrix.ScaleToFit.CENTER)) {
            matrix.mapRect(displayBounds, photoBounds);
        } 
 
        matrix.invert(photoMatrix);
    } 
 
    protected float getPhotoWidth() { 
        return photoBounds.width();
    }