Skip to content Skip to sidebar Skip to footer

How To Perform Zoom In/out ,rotation Together In Android

I want to apply drag,zoom in/out,rotate using multitouch to two images .one image is placed on the top of the other. after applying these action Create a image from above

Solution 1:

  1. You need to keep the transformation done to Bitmap1 and apply it again to Bitmap2. for example you can use a Matrix calculated using touch events in order to apply it to the two Bitmaps.

  2. I am not sure to uderstand what you want to do. What i understand is: you've got multiple imageview (that can be composed of 2 images placed on top of another) floating on the layout and you want to select one of them to resize / rotate it. In order to do that you can simply use the ontouch event of an imageView.

  3. Rotate + zoom with multitouch is not easy in Android, lots of code have to be written in order to make it work nicely. I suggest you to use an existing library. I used this one and it worked like a charm: https://github.com/lukehutch/android-multitouch-controller

You can see in the sample provided http://code.google.com/p/android-multitouch-controller/source/browse/trunk/demo/MTPhotoSortr/src/org/metalev/multitouch/photosortr/PhotoSortrView.java that you can retreive at any time the new center, angle, and scale ratio of the updated images in mImages(i).getCenterX(), mImages(i).getAngle(), mImages(i).getScaleX(), ... Using this values you can replicate the transformations (rotation, scaling, translation) on another Bitmap.

Post a Comment for "How To Perform Zoom In/out ,rotation Together In Android"