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 two images after changes made by applying actions.
I succeed in apply zoom/drag to top image ,created new image from that.
main problem is
1.How to apply action to two images, one image at a time ?
2.How to switch to another image from currently showing image (which layout I should use)?
3.How user can have a facility to rotate or zoom a image using multitouch ?
What I开发者_JAVA百科 am missing, Sorry for the list -:)
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.
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.
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.
精彩评论