放大或缩小后在android中裁剪图像的特定部分
我想在之后裁剪图像的特定部分(画廊或相机图像) 放大或缩小,就像android中的给定图像。我是android中的新手。请帮助我。谢谢放大或缩小后在android中裁剪图像的特定部分,android,Android,我想在之后裁剪图像的特定部分(画廊或相机图像) 放大或缩小,就像android中的给定图像。我是android中的新手。请帮助我。谢谢 看看android.graphics.Bitmap,您可以使用下面的API裁剪位图。如果愿意,您可以学习API createScaledBitmap() /** * Returns an immutable bitmap from the specified subset of the source * bitmap. The new bitmap may
看看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);
}
/**
*从源的指定子集返回不可变位图
*位图。新位图可以是与源相同的对象,也可以是副本
*已经制作好了。它以与原始文件相同的密度初始化
*位图。
*
*@param source我们正在子集的位图
*@param x源中第一个像素的x坐标
*@param y源中第一个像素的y坐标
*@param width每行的像素数
*@param height行数
*@返回源位图子集或源位图本身的副本。
*如果x、y、宽度和高度值为
*在源位图的尺寸之外,或者宽度现在有许多库可以满足您的要求。你可以用
用于使用放大/缩小功能将特定区域裁剪为正方形或圆形 请提供更多详细信息CreateBitmap将从srouce位图中获取新位图,如果正确设置参数x、y、宽度和高度,则新位图将被裁剪。