3

(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.

Maksim
  • 131
  • 2
  • 6
  • This might help: http://stackoverflow.com/questions/221830/set-bufferedimage-alpha-mask-in-java/221990#221990 – Tony Jul 20 '11 at 10:49

2 Answers2

1

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);   
Mafujul
  • 1,090
  • 10
  • 15
0

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...

Community
  • 1
  • 1
Lumis
  • 21,517
  • 8
  • 63
  • 67