I am trying to insert an image to static image (soemthing like an Image inside a frame). I could get it to an extent, but couldn't put it properly in the given image.
Orange border is the frame and placeholder that needs to be inserted dynamically into a marker in my map.
Here is what I have tried:
Bitmap pic = BitmapFactory.decodeResource(getResources(),
R.drawable.bluepic);
Bitmap orangeframe = BitmapFactory.decodeResource(getResources(),R.drawable.orangeborder);
Bitmap out = combineImages(orangeframe, pic);
public Bitmap combineImages(Bitmap frame, Bitmap image)
{
Bitmap cs = null;
Bitmap rs = null;
rs = Bitmap.createScaledBitmap(frame, image.getWidth(),
image.getHeight(), true);
cs = Bitmap.createBitmap(rs.getWidth(), rs.getHeight(),
Bitmap.Config.RGB_565);
Canvas comboImage = new Canvas(cs);
comboImage.drawBitmap(image,0, 0, null);
comboImage.drawBitmap(rs, 0, 0, null);
if (rs != null) {
rs.recycle();
rs = null;
}
Runtime.getRuntime().gc();
return cs;
}
I am getting this:
The place holder is dynamic, the orage frame image is static. I would like to insert the image directly inside the orange image programatically.
Is this possible?