Android examples for Graphics:Bitmap Paint
normalize Rect from Bitmap
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Rect; public class Main { public static void normalizeRect(Rect rect, Bitmap normal) { rect.left = Math.max(rect.left, 0); rect.top = Math.max(rect.top, 0); rect.right = Math.min(rect.right, normal.getWidth()); rect.bottom = Math.min(rect.bottom, normal.getHeight()); }/* www .jav a2s. c om*/ }