Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Rect; import android.graphics.RectF; public class Main { public static RectF zoom(final RectF rect, final float zoom) { return new RectF(zoom * rect.left, zoom * rect.top, zoom * rect.right, zoom * rect.bottom); } public static void zoom(final RectF rect, final float zoom, final RectF target) { target.left = rect.left * zoom; target.right = rect.right * zoom; target.top = rect.top * zoom; target.bottom = rect.bottom * zoom; } public static RectF zoom(final Rect rect, final float zoom) { return new RectF(zoom * rect.left, zoom * rect.top, zoom * rect.right, zoom * rect.bottom); } public static Rect zoom(final float left, final float top, final float right, final float bottom, final float zoom) { return new Rect((int) (zoom * left), (int) (zoom * top), (int) (zoom * right), (int) (zoom * bottom)); } }