Using ImageView for panoramic view - android

Is it possible to use ImageView to draw a panoramic picture? I.E. When you scroll to the end of the right edge of a panoramic picture, it should start showing the left edge of the picture. I know there is a panoramicgl project for android, but I was thinking of doing this manually. Right now, I have scrolling and zooming using Android's matrix.

Yes that is possible, but you need to have a scrollview too.

You could try to subclass ImageView and implement onTouchEvent() to listen to userinput that will modify the current focal point. If the focal point is moved, redraw the picture to an offscreenbitmap, e.g. with matrix.postTranslate(deltaX,deltaY), and redraw the portion of the image that has been shifted out of bounds on the opposite side.

Related

Add OverlayView on ImageView in Android at particular X-Y Co-ordinate

I have back side TouchImageview, which having zoom in/out functionality, I am setting up bitmap on ImageView, the size of Bitmap is w-h (2100 x 2900), I have particular X-Y co-ordinate, now I want to add Overlay view at same co-ordinate as per imageview's X-Y co-ordinate, the background imageview should be touchable.
Can you please let me know solution for the same.
Thank you.
I'm an iOS developer, but can be answer to your question, as I'm sure that these things are also possible in Android ! ;)
You can follow these steps:
Don’t make any change in your current flow.
Add overlay view the way you want.
Take screenshot of the back image view which are showing location, may be of particular size (or the exact size of circle on overlay).
Show that captured screenshot (image) at circle view position (you can have an another image view for that).
Zoom that image view (From Step.4)
You are done!
Goodluck.

How to Resize imageview size using ontouch Android

I have an ImageView which I want to "resize", not re-sizing the Image but the ImageView, I know I have to implement it using onTouch, but I what I do not know is how to use the given Coordinates in getting a resize, a good example would be WhatsApp, when one ought to set a new display Image on android, it takes them to the gallery then it brings up a "grid" like view which has 8 points, one of each corner and one in between the two points at each corner, you can resize that view how you like it, you can drag the points and the view sizes updates to drop point height and width, how Can i implement such a view? all help will be highly appreciated
look at this Moving Images on the Screen with Android
How to use Multi-touch in Android 2: Part 6, Implementing the Pinch Zoom Gesture

How to resize an ImageView dynamically by dragging from its corners just like a cropping frame on a picture?

In my android application I am stuck in a problem and nothing seems to work for me.
I have an ImageView on the top of another ImageView inside a relative layout.
Now I need to resize the imageview on top when user touches one of its corners and drags.
Just like a cropping frame we generally see. When we drag any one corner, then the diagonally opposite corner must remain fixed and the resizing must be done across the corner which is being dragged.
What I am doing is setting OnTouchListener and getting new/dragged coordinates on Action.MOVE then I tried to resize using Bitmap's createScaledBitmap. This does resize the image view but not across the corner which is being dragged. I am totally confused .
How I can use the coordinates to draw an Image View just like we do it while drawing a rectangle using Canvas.
Please help.
I wouldn't do this in an ImageView. I would subclass View and override onTouchEvent and onDraw to handle the input and draw all the various components. You have to break this down into it's components and manage a number of objects in this view.
You have a Rect that represents the size of the crop area. This probably defaults to the size of the control. In onTouchEvent, you need to test for an area around each corner and then keep track of which corner is being dragged to resize your Rect appropriately.
You don't have to call createScaledBitmap each time you draw it, and you probably shouldn't because you are flirting with an OutOfMemoryException at that point (clean up your Bitmaps too slowly and you'll find out the hard way what this is). Just decode the Bitmap when the control gets created and draw it to the canvas using a destination Rect.
Lots of code to write, but it sounds like a fun project. There's no easy way to drop in a control like this (if I'm understanding you correctly). You have to manage the touches, drags, and the destination rectangle inside the custom View.

How can I animate an ImageView after I applied transformations on it?

I am trying to implement the zoom and drag features for an image viewer. So far I created the custom ImageView and implemented the actual features for pinch zoom and drag using the transformation matrix of the view. Now I want to animate the transition from the last position to a legal one (the user can drag the image where he/she wants but when it is released it should bounce back). If I just make modifications on the transformation matrix it works but, as I said, I want animations.
My problem is that if the image is out of the screen and I animate the view back the image is cut and remains truncated even after the animation is finished. I should mention that the image is set using the setImageUri method.
Does anyone have any idea on this one?

Android: Draw a moveable and sizeable rectangle on ImageView(Or any other bitmap compatible widget) and crop the selected region

I want to crop my image which is being displayed on an ImageView. How I want to go about it is that I want a re-sizable rectangle to be displayed on the image. That rectangle will have moveable corners (which I can drag around with touch) to increase/decrease its size. The image below illustrates a demo of something I would like to develop.
P. S. I am not quite sure how to phrase my question.
What I want:
http://imageshack.us/photo/my-images/832/customcropbox.jpg/
The final solution I came up with after ample research was:
Extend ImageView to make my own custom view.
#Override onDraw method and do my custom drawing there in that method.
Implement onTouchListener on the view to get the touch events and process them according to their position.
e. g.
I checked whether the touch was in the radius of the anchor point circle I drew around the movable rectangle that I was drawing in my overriden onDraw method.
Edit:
I am sorry guys I don't have that piece of code anymore, I came here after a very long time otherwise would have loved to help you out.
Heartache.

Categories

Resources