静止画像に画像を挿入しようとしています(フレーム内の画像のようなもの)。ある程度は取れましたが、与えられた画像にうまく収めることができませんでした。
オレンジ色の境界線は、マップ内のマーカーに動的に挿入する必要があるフレームとプレースホルダーです。
これが私が試したことです:
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;
}
私はこれを取得しています:
プレースホルダーは動的で、オレンジ色のフレーム イメージは静的です。プログラムでオレンジ色の画像の中に画像を直接挿入したいと思います。
これは可能ですか?