2012-02-27 61 views

回答

1

您可以使用

Bitmap.createBitmap(android.graphics.Bitmap source, int x, int y, int width, int height) 
-1
public static Bitmap CropImage(Image source, int x, int y, int width, int height) 
     { 
      Rectangle crop = new Rectangle(x, y, width, height); 

      var bmp = new Bitmap(crop.Width, crop.Height); 
      using (var gr = Graphics.FromImage(bmp)) 
      { 
       gr.DrawImage(source, new Rectangle(0, 0, bmp.Width, bmp.Height), crop, GraphicsUnit.Pixel); 
      } 
      return bmp; 
} 
+0

欢迎来到Stack Overflow!你可以添加一个解释来代替只粘贴代码。这可能对你很有意义,但其他人可能有理解上的问题。 – 2015-06-10 20:28:08

+0

这段代码只给出左上方裁剪,但不是右下方裁剪......所以我也需要一个正确的代码。 – Deepak 2015-06-10 20:31:45