Android: clip image to shape - android

(Sorry for my bad english)
I have two pictures. One picture is colorful and big. On the other picture shows a black figure arbitrary shape (like a cross or a star or a piece of the classic puzzle) on a transparent background.
I want to put the second picture on the first picture and replace the black with part of the first image. Then i need to save the second image in a new file.
Thank you.
Max.

You can get this by using a library and a single line code.
Please try this, hope you will get a better solution.
dependencies {
compile 'com.mafstech.libs:mafs-image-shape:1.0.4'
}
And this line is your main code
Shaper.shape(context, R.drawable.your_original_image_which_will_be_displayed, R.drawable.shaped_image__your_original_image_will_get_this_images_shape, imageView, height, weight);

You need to use xfer modes, unless you are preaperd to create Paths and then clip canvas.
Check my answer here: how to draw pic to Closed curve area
Follow the links for examples...

Related

How to create a straight green line between 3 image view in android

My requirement is to draw a straight line between three image view in android. Please some one give any solution or send me any source code. I am sending a image please have a look.
enter image description here
You could place transparent ImageViews over your pictures, and if there is a winning pattern, draw the line on the ImageViews. Maybe this help you as well:
https://stackoverflow.com/a/6179075/7325737

How to crop an image taking base a rectangle in android?

I'm implementing a custom camera, in the layout I have a rectangle inside the layout, where the user have to put his card, so after take the photo i need crop the picture, taking the reference the rectangle.
Any suggestion of how to do this?
Possibly you can use a library that do this on your behalf.
If you are not fully satisfied and need to understand how it works the process you can read the API. I do not know exact if you mean the selection have to be a rectangle of you are referring to the rectangle of your customer view where the card should fit, in the first case the library from Arthurhub should be enough
if you want to implement from scratch, I guess you need to use Matrix
enter link description here
https://github.com/ArthurHub/Android-Image-Cropper

Making a certain color transparent on an image

I have an image that is circular and I want to make the other junk in the image to be transparent. I've spent the last hour looking around and I can't seem to figure out how this is done for android. Any help is greatly appreciated!
I haven't worked with Android but on iOS pngs weren't loading for me when I made them in photoshop but when I made them in flash all of a sudden they would work! Try that first :)
Anyways, you want to google something along the line of "pixel arrays android code" you can create an array of each pixel, find an individual color, then make it transparent...
But I really think this is just a GIMP issue and you don't need to go through all of that hassle.
what i can understand from your uncleared words is that you want to display transparent image of a normal image you have . so i would suggest don't do it through programming . create a transparent image through any image editor tool and use it .
if image is dynamic that you cant go in this way so use Matrix and setAlpha . search over net for both the terms

Can we edit the picture in Android to set the Radius of the pics on the edges?

I would like to know if we can edit the picture that we take from a camera and store it on our Phone. Can we make use of android.graphics package to edit the picture.
One of the sample picture has has been edited on the top width is this as you can see the image has been clipped from the top center just below the word "Discovery". Is this possible on Andriod?
Yes, you can make a Canvas out of a bitmap, and then use canvas drawing commands to mutate and save it again.
I'm not really sure what you're asking, though.

Move the ImageView to EditTextView

In my application i want displaying the one image as half of the screen and below i am producing that image spelling and below display that image name letters as shuffled and kid will take one image and place into into that place in above spelling.For example see following website
//www.youtube.com/watch?v=_LSlYYu3F0k
For this how can i design my layout(xml)Please gice me some code suggestions.Thanks in advance
With a layout based on xml you wont get a result like that on the video.
You should use 2D/3D based SurfaceView/GLSurfaceView and draw on the canvas what you need and where you need it.

Categories

Resources