How to create a new image by combining two images

I want to create a new image from two different images. The image of the image should be the result of superimposing one image on another image using drag and drop, increase / decrease, rotation of actions.

I am new to Android, how can I do this. which should I use SurfaceView / ImageView ????

Thank you for your time.

0
source share
1 answer

It is not clear whether you want to do this dynamically (in response to user actions) or want to create a fixed image based on the specified drag / zoom / rotate options. For the first you have to go with a custom view where you can do all your own drawing in onDraw() . For the latter, you can do this using the Bitmap class. You do not need any views. Follow these steps:

  • Create a destination bitmap of the desired size.
  • create a canvas by passing the target bitmap to the constructor. This will create a canvas that will draw into the destination bitmap.
  • Create a Paint object to draw.
  • Draw your first source image with Canvas.
  • Draw an overlay image after applying the appropriate transformations to the Paint object.

Later, you can use Bitmap in an ImageView or other view class that accepts images (e.g. TextView).

+1
source

Source: https://habr.com/ru/post/1343126/


All Articles