CopyPastor

Detecting plagiarism made easy.

Score: 1.7678510546684265; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Reposted on 2016-12-19
by Daniel Nyamasyo

Original Post

Original - Posted on 2016-12-19
by Daniel Nyamasyo



            
Present in both answers; Present only in the new answer; Present only in the old answer;

I think this example will definitely help you overlay a transparent image on top of another image. This is made possible by drawing both the images on canvas and returning a bitmap image.
Read more or download demo [**here**][1]
private Bitmap createSingleImageFromMultipleImages(Bitmap firstImage, Bitmap secondImage){ Bitmap result = Bitmap.createBitmap(firstImage.getWidth(), firstImage.getHeight(), firstImage.getConfig()); Canvas canvas = new Canvas(result); canvas.drawBitmap(firstImage, 0f, 0f, null); canvas.drawBitmap(secondImage, 10, 10, null); return result; }
and call the above function on button click and pass the two images to our function as shown below
public void buttonMerge(View view) { Bitmap bigImage = BitmapFactory.decodeResource(getResources(), R.drawable.img1); Bitmap smallImage = BitmapFactory.decodeResource(getResources(), R.drawable.img2); Bitmap mergedImages = createSingleImageFromMultipleImages(bigImage, smallImage); img.setImageBitmap(mergedImages); }
For more than two images, you can follow this link, [**how to merge multiple images programmatically on android**][2]

[1]: http://whats-online.info/science-and-tutorials/93/how-to-merge-two-images-in-android-programmatically/ [2]: http://whats-online.info/science-and-tutorials/92/how-to-combine-multiple-images-into-a-single-image-in-android/
You can use the code below to solve the problem or [**download demo here**][1]
Create two functions to handle each.
First, the canvas is drawn and the images are drawn on top of each other from point (0,0)
On button click
public void buttonMerge(View view) { Bitmap bigImage = BitmapFactory.decodeResource(getResources(), R.drawable.img1); Bitmap smallImage = BitmapFactory.decodeResource(getResources(), R.drawable.img2); Bitmap mergedImages = createSingleImageFromMultipleImages(bigImage, smallImage); img.setImageBitmap(mergedImages); }
Function to create an overlay.
private Bitmap createSingleImageFromMultipleImages(Bitmap firstImage, Bitmap secondImage){
Bitmap result = Bitmap.createBitmap(firstImage.getWidth(), firstImage.getHeight(), firstImage.getConfig()); Canvas canvas = new Canvas(result); canvas.drawBitmap(firstImage, 0f, 0f, null); canvas.drawBitmap(secondImage, 10, 10, null); return result; }
[**Read more**][1]

[1]: http://whats-online.info/science-and-tutorials/93/how-to-merge-two-images-in-android-programmatically/

        
Present in both answers; Present only in the new answer; Present only in the old answer;