Here you can find the source of clip(Bitmap bitmap, int x, int y)
public static Bitmap clip(Bitmap bitmap, int x, int y)
//package com.java2s; import android.graphics.Bitmap; public class Main { public static Bitmap clip(Bitmap bitmap, int x, int y) { int w = bitmap.getWidth(); int h = bitmap.getHeight(); if (h > w) return Bitmap.createBitmap(bitmap, 0, (h - w * x / y) / 2, w, w * x / y);//from w ww . j a v a 2 s. co m else return Bitmap.createBitmap(bitmap, (w - h * x / y) / 2, 0, h * x / y, h); } }