我想在
之后裁剪图像的特定部分(图库或相机图像)放大或缩小,就像android.i中的这个给定图像一样,我在android.please中的新功能帮助了我。谢谢你。
答案 0 :(得分:0)
看一下android.graphics.Bitmap,你可以使用下面的API来裁剪位图。如果愿意,您可以学习API createScaledBitmap()。
/**
* Returns an immutable bitmap from the specified subset of the source
* bitmap. The new bitmap may be the same object as source, or a copy may
* have been made. It is initialized with the same density as the original
* bitmap.
*
* @param source The bitmap we are subsetting
* @param x The x coordinate of the first pixel in source
* @param y The y coordinate of the first pixel in source
* @param width The number of pixels in each row
* @param height The number of rows
* @return A copy of a subset of the source bitmap or the source bitmap itself.
* @throws IllegalArgumentException if the x, y, width, height values are
* outside of the dimensions of the source bitmap, or width is <= 0,
* or height is <= 0
*/
public static Bitmap createBitmap(Bitmap source, int x, int y, int width, int height) {
return createBitmap(source, x, y, width, height, null, false);
}
答案 1 :(得分:0)
现在有很多图书馆可以满足您的要求。您可以使用 https://github.com/albinmathew/PhotoCrop用于将特定区域裁剪为方形或圆形,具有放大/缩小功能。