Drag listener on special shaped image - android

I have this image:
And in Android I want to drag on the image and get the x and y. But only on the dark part (but a imageview/button is a rectangle). So a sort of round OnTouchListener.
How can I manage to do this?

You able to do it by Get touched pixel color of ImageView.
So, Step you need:
1. Get touched pixel color.
2. Compare touched pixel color with your image color . it is black.
So, you able to touched position in your desire image view position or not.
Thanks

Related

Blur and un-Blur selected portion of image on finger touch in Android

I have searched the some example but found solutions like blur full image, update radius on seekbar change. I want to blur and un-blur selected region of the image, that could be circle or rectangle.
please try https://developers.aviary.com/docs/android
for your best performance

Get Non-Transparent Area of Drawable

I wonder is there a way to know the non-transparent area of a drawable image?
For example, I have this image:
What I want is to detect when people touch the transparent area it will do nothing and when people touch the non-transparent area (which is that start button) it will do something.
Thanks for you help.
Just check the pixel value of the touch position, if it is transparent do nothing.
how to get color at the spot(or pixel) of a image on touch event in android
Check if a pixel is transparent or NOT - Android
Seee the Image is nothing but the set of color pixel start fetching the pixels from the top left corner to the right and iterate till the bottom right, and maintain an array of only thos pixels into which event may trigger . Add checks while event generate and match the corresponding pixel's color code

How to make image visible area clickable in android?

I am using triangle shape button (PNG image), I need to make clickable only on the image visible area. As you can see in the image of my triangle shape button below , in the image I need to make clickable only on the image visible portion ie black and red, the green area will remain transparent and non clickable. Please help me this respect I would very thankful to you. Thanks in advance.
Identifying image area clicked in Android? check this question
OR if green will be transparent,
I think the easiest way to detect whether 'visible' content of the image was clicked, is to hook up an OnTouchListener, get the touch coordinates and subsequently get the color for those coordinates using Bitmap.getPixel(int x, int y). Since this will return an ARBG color, you should have little problems with images using an alpha channel. Anything that is 'transparent' (if green will be transparent?) will be invalid, everything else will mean the actual content was tapped.
something like this as a start up:
int color = Bitmap.getPixel(x,y); // x and y are the location of the touch event in Bitmap space
int alpha = Color.getAlpha(color);
boolean isTransparent = (alpha==0);
You can refer to this link:
Image Map
Or you can also refer this similar question :
Link
But, i would not recommend doing so as you have to manually calculate the coordinates and apart from that android screen has different sizes so it may cause a problem for you.
You can set OnTouchListener to your View and check was click inside of triangle shape or not (OnTouch event sends MotionEvent object, you can get coordinates of touch event from it).
May be it will be better, if button will be clickable as rectangle? Like here, on stackoverflow, vote buttons has triangle form too, but they are clickable on rectangle shape.

Draw on imageview image in android?

Fellow Programmers,
I am new to android and I am trying to draw on a image based on giving the x and y axis of the image as the input.So that he pixel value corresponding to the coordinate gets filled with a color that I mention. Say Red color for now.
User Story: Render a image through image view and on a button click I need to pass the co-ordinate value for the image that represents the pixel of the image and fill it with red color. Keep on doing it looks like drawing on the image that I render using image view.
Is this user story is possible to do in Android? If then help me on this. I referred the draw class and canvas class and not sure how to implement.
Looking forward to ur help on developing this user story on android application.
Best,
Googler
Take a blank canvas.
Draw your image on the canvas.
Draw points on the canvas by specifying x and y co-ordinates and red color in paint.

Android : Fill yellow color proportional to on Touch over the image

I have a dial-or image as shown in which whenever i move the finger in clockwise manner the part covered of sub ring gets yellow in color.I tried to apply this scenario through gesture overlay but do not serve the requirement.
Any idea is welcomed.Please assist me and thanks in advance.

Categories

Resources