How to perform zoom in/out ,rotation together in Android - 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 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 -:)

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.

Related

Flip an Imageview with two images back to back

I need to have a set of Image views on a Linear Layout. &
==> onClick of an ImageView, I want to turn the Image to the back(Like Flipping Effect) & show another Image.
==> Again on click of that Image or another Image, I want to apply the same effect for that Image View & the Previous Imageview must come to the default position.
---> I just checked the FLIP ANIMATION in Android. But it is flipping the total view.
So I Just need How to flip an Image view in the same manner, with support from Android v2.2 & up
I think it is quite complicated but it is interesting & need some help how to achieve this as I am just learning the Android(& Coding).
Thanks.!!!
You can use this small library to do that :
https://github.com/castorflex/FlipImageView

how to make large image clickable on different different image part

I want to implement a application in this application multiple click event like periodic table i want to use large image for this and make image clickable from its different different part called element in this implementation zoom and scroll feature are also include
Try this:
Define a Rect for the spot/area that you would like to make clickable. Also remember to redifine it based on screen layout size and resolution.
Now onTouch event get the x and y position and calculate whether it lies within the defined Rect and act accordingly. The Rects will act as virtual image maps.
I think you have to divide your large image into sub images and add these sub images to every image view. You have to create a layout such that all these image views must show the original large image without any disturbance at corners, then only you can get separate click events for each sub image.
I think that this is a good idea.
Use a "layer" with different alpha level areas. Each area with a specific alpha level is a specific action-click.
https://groups.google.com/d/msg/android-developers/_6u3Iu-sYrI/DA0KCo8pTksJ

How to display 2 separate images in Android OpenGL 2.0 then upon button click shrink img to nothing and grow new image to normal size

Main idea is to display 2 square images and then upon button click they should shrink to nothing then display a new image from nothing and grow to normal size. (if possible I'd also like to add a rotation as it shrinks and grows)
I've followed http://developer.android.com/resources/tutorials/opengl/opengl-es20.html
but as I don't have access to an android device till tomorrow I have no way of testing it out right now so I'm hoping anybody might know of existing tutourials which covers anything like this.
I don't want any animation to occur during normal running and it should only occur during my click handler, ofc I still like the images to be displayed till the button clicked just not in motion.
I don't see where the problem is, it is just a simple game of scaling of your object model view.
When you want to scale down ---> you decrease the scaling factor toward zero
Change picture ---> Change binded texture (or change the texture coordinates if you have an atlas)
Scale up ---> increase the scaling factor toward 1.0

Android - Zoom in/out from multiple ImageViews

Im working on a application that should be able to have diffrent ImageViews applied to a view or layout and zoom in and out from them. Similair to create a chessboard where each square represent a ImageView and then I can zoom out or in from the whole chessboard.
I want to chose a particular ImageView and then add a tween animation to it like a bounce or scaling.
Whats the best approch to do this in Android?
First of all you will need to check which image is focused. To check this you can try :
Image focusedImg = getViewById(R.id.YourMainLayout).findFocus();
Now, once you have the focused image you need to apply tween animations on it. Follow the below mentioned link to apply twwen animation :
http://chengalva.com/dnn_site/Home/tabid/41/EntryId/57/Android-Tween-Animations.aspx
Best,
Shraddha

Draw images on top of each other in android

I have some images that I want to put on top of each other on random order.
If it possible using one ImageView or do I need to create multiple image views based on number of images?
You don't completely specify what you want.... if you want the images to be placed in different positions (in the X and Y axis), meaning that while watching the photo on the top you can see part of the other images, then you have to create different ImageViews, or drawing them on a canvas (I think this one is much better).
If the images are just one on top of the other (hiding the one on the bottom), you just have to use one ImageView.
LayerDrawable may fit your requirement, you may refer to this post overlay two images in android to set an imageview

Categories

Resources