4

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 am missing, Sorry for the list -:)

Community
  • 1
  • 1
Dev.Sinto
  • 6,802
  • 8
  • 36
  • 54

1 Answers1

6
  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.

toto_tata
  • 14,526
  • 27
  • 108
  • 198
pcans
  • 7,611
  • 3
  • 32
  • 27
  • hi, I totally agree with you.rotation and zoominng worked like a charm!!!!.it's perfect! .one Q ,if I am using this method.How to track transformation of images so that I can create third one from that .thanks – Dev.Sinto Mar 10 '11 at 11:23
  • @Kariyachan I edited my answer describing how based on the sample provided with the library you can retrieve applied transformation to replicate them on another image. – pcans Mar 13 '11 at 14:33
  • I spent days on getting this right. Even tried the multitouch-controller that you linked to. Works fine on one phone and not on another. Verdict: Multi-touch on some Android phones is badly screwed up. – HRJ Sep 27 '11 at 07:14
  • @Kariyachan Didn't work on HTC Desire, but the same code works fine on Samsung Galaxy 3. Here code means both, my simple home cooked one, as well as the android-multitouch-controller. – HRJ Sep 29 '11 at 03:13
  • @HRJ mmmm I think problem is with something else because I implemented face cropper using this .It's working fine on HTC desire S.If Problem is with something else let's know thanks – Dev.Sinto Sep 29 '11 at 04:48
  • @Kariyachan There might be a diff between Desire and Desire S. Can you try my app called "SkEye" on your Desire S? Enter manual mode by dragging the view and then try to rotate the view with two fingers. I will try your app as soon as I get back the Desire (later today) – HRJ Oct 05 '11 at 14:02