简体   繁体   English

如何使用Fresco Image Viewer库旋转图像?

[英]How can I rotate image with Fresco Image Viewer library?

I use fresco image viewer library in my app and everything works prefect but I have a problem with rotating image. 我在应用程序中使用了壁画图像查看器库,并且一切正常,但是旋转图像时出现问题。 by default this library can rotate image automatically when the device screen rotation is on but I don't want to use that way. 默认情况下,当设备屏幕旋转打开时,该库可以自动旋转图像,但是我不想使用这种方式。
actually I want to know how can I rotate it by touch or button click in 90 degree and it's very important to work with this library. 实际上,我想知道如何通过90度的触摸或单击来旋转它,使用此库非常重要。

This is my code to show image : 这是我显示图像的代码:

 ImagePipelineConfig config = ImagePipelineConfig.newBuilder(mContext)
     .setProgressiveJpegConfig(new SimpleProgressiveJpegConfig())
     .setResizeAndRotateEnabledForNetwork(true)
     .setDownsampleEnabled(true)
     .build();
 Fresco.initialize(mContext, config);


 ImageViewer.Builder builder = new ImageViewer.Builder < > (mContext, images);


 builder.setFormatter(new ImageViewer.Formatter < Image > () {
         @Override
         public String format(Image customImage) {
             return customImage.getLarge();
         }
     }).setOverlayView(overlayView)
     .show();

https://github.com/stfalcon-studio/FrescoImageViewer https://github.com/stfalcon-studio/FrescoImageViewer

Example for a 90 degree rotation: 90度旋转的示例:

ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(URI)
    .setRotationOptions(RotationOptions.forceRotation(RotationOptions.ROTATE_90))
    .build();

See also this example in Fresco's Showcase sample app. 另请参见Fresco的Showcase示例应用程序中的此示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM