1

I'm using https://github.com/CyberAgent/android-gpuimage

In .xml layout file, I use GPUImageView to display photo.

Now I want the photo can drag & zoom in/ out.

Which way I should do:

  1. Use a filter like that idea:

"You can apply a GPUImageTransformFilter to the GPUImagePicture (add the transform filter as a target of the picture, then add the blending filter as a target of the transform filter). You can then apply arbitrary transformations to the image, like scaling, rotation, and translation."

https://github.com/BradLarson/GPUImage/issues/51

  1. Custom GPUImageView like these ImageViewZoom libraries:

https://github.com/search?l=Java&q=image+zoom&type=Repositories&utf8=%E2%9C%93

If you have other way, or more detail, please show me.

------------- Update --------------

Because I have some custom views will be added later, so I follow the idea: create ZoomableViewGroup (from https://stackoverflow.com/a/19204645/3455160 ) like this:

<ZoomableViewGroup
    android:id="@+id/zoom_group"
    android:layout_above="@+id/panel_adjuster"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
    <jp.co.cyberagent.android.gpuimage.GPUImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
<ZoomableViewGroup>

ZoomableViewGroup scales well bet GPUImageView doesn't.

Community
  • 1
  • 1
Cuong Nguyen
  • 1,166
  • 1
  • 11
  • 20

2 Answers2

0

Just get your bitmap after applying filter using getBitmapWithFilterApplied then set this bitmap to your ImageView and use any library from list of them which you mentioned in option 2.

dtx12
  • 4,438
  • 1
  • 16
  • 12
  • In this activity I have both scale & do filter functions. Your way is ok for zooming but when I do filter, it seems so slow. – Cuong Nguyen Sep 10 '15 at 07:28
  • 1
    Also about your update - you cannot work with GlSurfaceView like with usual view, you may create your own implementation based on TextureView although. – dtx12 Sep 10 '15 at 16:18
0

You can not do pinch zoom using GPUImage. Just capture bitmap from GPUImage using GPUImageView.capture() or GPUImageView.getBitmapWithFilterApplied() and then set this bitmap to imageView for Zoom. You can use ZoomableImageView.java, CustomImageVIew.java or TouchImageView.java etc which is suggested in Android imageView Zoom-in and Zoom-Out for Pinch zoom.

Community
  • 1
  • 1
Rezaul Karim
  • 1,311
  • 1
  • 18
  • 26