I'm trying to develop a custom application that uses Camera 2 API and I would like to add the feature "tap to focus". In other words, when I tap on the screen to focus, it shows a circle of the focus area.
How can I draw the circle focus area?
I followed the Google Camera2Basic example.
Thank you.
May be enough is draw circle of tap area, not focus area? In this case You can save X and Y pos of tap and use it as center of circle. And You can use any tutorial for drawing over camera preview, like that.
Related
I my app I have some shapes , I want to fill the specified color in it using touch and gesture. the user finger finger will move inside the shape to fill the color in it , It has starting point so that it should always start from the right corner until it gets the last corner which should be the ending corner.
is the picture link so that you guys can easily understand what I am trying to say.
in this picture you can see the white space of the center shape , I want to fill it with user finger touch.
I have read to many gesture techniques including the gesture builder , but they are free form drawings , so in my app I have to face do following thing
1. To fill under the predefined shape
2. The shape should be filled in a single way , ie from starting point towards the ending point.
3. in other Examples they are drawing on canvas , in my case What should I use ??
Please answer me of my confusions or at least tell me how to do it, Please give me a starting point.
I am in the process of developing a drafting tool using OpenGL ES 2.0, I have made arrangement to draw lines & circles using a button click. What I need presently is to indicate the edges of the line to snap so that another line can be drawn from the end of the line. The snap should be indicated as a box which indicates that the edge is been selected and soon as another line or circle is made to draw from that edge, the box should disappear. Can anyone help in clearing the particular box drawn in the drafting screen while the other lines are circles drawn using button click remain in the screen ?
I don't think anyone could help you with an right answer because it depends only on your code for rendering items. Just don't render the snap box if you don't want to.
I am interested in implementing a user interface navigation control mechanism based on a wheel shaped device (or pie chart shaped or circle shaped) in my Android app.
I would like only half of the wheel to be visible at any time. That is, only the top half of the wheel should be visible since the bottom half should be below the border of the screen. The user can then turn the 'half wheel' to show options hidden by the screen border. The visible top half should then be divided into three parts like a pie chart, so the user can press either one of them to invoke some action. The following pic should explain (it is an example with seven (A-G) options).
http://imgur.com/lNu1F
The rotation itself should not be hard, but I am having a hard time understanding how to position the wheel so that half of it is outside the actual screen. I am thinking that loading the entire wheel (but hiding half of it) is best, since that is that graphics I have and it will also allow a smooth animation when the user swipes to show some other options. How can I make Android show the wheel in this way?
Also. Any comment on how to implement the 'swipe along the wheel shape' would be appreciated.
Thank you.
So for the wheel - you are hving trouble knowing how to position the wheel because you are using XML to align you objects and would like to use something like "Align Object Center To Bottom" which does not exist.
Here is one approach that might work fine: Mask the wheel view.
Is it possible to mask a View in android?
As for swipe the wheel along, I would register the wheel to take touche events, and use only the horizontal componenet of move events to apply to the rotation of the wheel. This setup is common in audio software that uses knobs.
However if you want to have it stick to the users finger in a more realistic fashion, you will need to do the following:
When the user first touches the wheel, calculate the angle from the wheel center to the finger.
Every time the finger moves, check the angle from the wheel center to the finger - and rotate the wheel the amount that the angle has changed from the last touch event.
The formula for getting the angle between two points is this:
Float angleInRadians = Math.atan2(point1.y-point2.y, point1.x-point2.x);
I'm just playing around with basic animation on the Android platform. What I have so far allows the user to touch the screen and a circle, centered at the touch, will increase its radius until the user lifts his finger or the circle hits the edge of the screen. I have a class set up to store the center and radius of each circle so that every circle is drawn to the screen. What is the best way to make a circle stop increasing its radius when it hits another circle?
Let me google that for you
http://badasshat.blogspot.com/2010/03/2d-collision-detection-part-1.html
I was just playing with Android SDK Demos and I found the rotating dialer example which you can find here : Android Rotating Dialer and I'm curious about one thing. How can I set the image to rotate only when I click on image..not inside in or out. I don't want to rotate it if I click at the center (in white area) or outside of the image (again in white area).
Any suggestions how can I achieve this?
Interesting question.
This would be possible by modifiying the code of myOnTouchListener. Just before the switch statement you would perform a calculation to check whether the x,y coords of the touch were outside an inner radius and inside an outer radius.
Some simple Pythagoras and it wouldn't be too hard. If this was not the case then return true at that point.