使用 fresco(facebook 图像库)从整个原始图像中获取缩放部分
Use fresco (facebook image library) to get scaled portion from the entire original image
基本上我有源图像,我想从整个图像中缩小区域。最后,我希望缩小部分的纵横比与整个源图像的纵横比相同。可能吗?如果是这样,请指导我应该看什么。
您应该查看 Fresco 文档 here
他们说:
To scale, simply specify the layout_width and layout_height of your SimpleDraweeView, as you would for any Android view. Then specify a scale type.
为了调整大小,你可以做这样的事情:
Uri uri = "your uri";
int width = 50, height = 50;
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
.setResizeOptions(new ResizeOptions(width, height))
.build();
PipelineDraweeController controller = Fresco.newDraweeControllerBuilder()
.setOldController(mDraweeView.getController())
.setImageRequest(request)
.build();
mSimpleDraweeView.setController(controller);
基本上我有源图像,我想从整个图像中缩小区域。最后,我希望缩小部分的纵横比与整个源图像的纵横比相同。可能吗?如果是这样,请指导我应该看什么。
您应该查看 Fresco 文档 here
他们说:
To scale, simply specify the layout_width and layout_height of your SimpleDraweeView, as you would for any Android view. Then specify a scale type.
为了调整大小,你可以做这样的事情:
Uri uri = "your uri";
int width = 50, height = 50;
ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
.setResizeOptions(new ResizeOptions(width, height))
.build();
PipelineDraweeController controller = Fresco.newDraweeControllerBuilder()
.setOldController(mDraweeView.getController())
.setImageRequest(request)
.build();
mSimpleDraweeView.setController(controller);