Crop the image for special path - android

I have a list of special items: in left side foto and in right side of item some text. Under the list background with special texture. Image should be crop in the form of a pentagon. Haw to crop the image and not to disrupt the texture under it?

I'd say that create an image however you want to crop your image, i mean as it's mask and put it on your imageView... And then set your imageView which is below mask. So it'll seem like your image's been croped.

Related

Adjusting / place a larger image size imageView Android

What I want is to open the option to adjust the image by touch inside a hollow (imageview size).
For example, if I add a profile picture, the picture does not come out whole, but through touch I move the image to adjust the settings as you want.
The effect is that after choosing a photo gallery, appears something like this:
Thanks. Regards.

Darken parts of a free-hand cropped image in android

I want to add a free hand crop functionality.
Till now I can open the picture and draw a path around the part of the image that I want to crop thanks to this code:
https://stackoverflow.com/a/18459072/2361533
But before opening the cropped image in another activity, I want to darken the outside part of the crop path, to show the user how the cropped image will be. In case he does not like the result, he could reset the image.
It would be something like the image here:
Android: Free Croping of Image
How can i do this ?
Use the following two methods as a start:
setXfermode(new PorterDuffXfermode(Mode.DARKEN));
canvas.clipPath(path, Region.Op.DIFFERENCE);
The first one is applied to a Paint object and darkens a certain region.
The second "clips" the path in your canvas and takes the inverse (using Region.Op.DIFFERENCE).

Crop an image, only visible part of it, which is behind another image

I want to get the part of an image which is visible to us. There is another image over the first image. So from that image, some part of first image is visible. And I want that part only.
I’ll show you sample of it and final output which I am expecting from it.
I know how to crop in oval shape. But here, the template used in above example can be different in actual, so as per the template /mask I need to crop that image.
How can I do this. Any idea?
A simple but maybe not very efficient solution:
assume the mask is above the real image
both images are in the same container and if the mask is above the image this means that the pixels of the image would correspond to pixels of the mask
draw only those pixels of the image whose corresponding pixel in the mask is not black

How to fill the drawable region in an imageView with another drawable?

so I'm trying to find the region of the current image in the ImageView and fill that region with a different image. Here is the original image Empty Circle inside an imageView. The imageView has a drawable of a circle inside. Then I'm trying to make it into something like this Circle filled with image inside an ImageView when a user chooses an image. I don't want to manually Photoshop a circle image. I am just hoping to fill the region with another image. I have tried SRC_IN method from AlphaComposite, but for android, I can't convert from BitMap to graphics2D. If anyone knows how to solve this using the BitmapFactory in android, I would really appreciate your help. Thank you.
The other solution besides Bitmaps, may be too simple for whatever you are trying to achieve otherwise I think it would have occurred to you. I'm just pointing it out in case you have "code blindness" and are trying to over-engineer the solution because you've worked on it for too long (we've all done it)
It is to have that circle/shape image saved as a png with the area you want filled being transparent then set it as the drawable for an ImageView (etc.) then in a RelativeLayout lay this view over the image you want to fill the area and apply a transparent background to the shape view OR simply set the fill image as the background for the shape view.

Change size of selected image in Gallery

I have a Gallery. I have used the android:unselectedAlpha parameter so that the center image in the Gallery is more bright. However, I would like to have this center image size to be bigger than other images. Is there a way to do this ?
You could add and onClickListener to each image. When the image is clicked you could change the layout so that the image is then bigger.

Categories

Resources