matrix 를 이용해서 터치로 이미지뷰의 확대, 축소, 이동을 구현했습니다.
이미지뷰는 서피스뷰 위에 떠서 그림파일을 불러오고 서피스뷰와 이미지뷰를 bitmap으로 전환해서 서로 합성시키는 코드를 만들었는데요.
이미지뷰의 확대, 축소, 이동이 정확하게 합성되지가 않아요.
변화가 있긴 한데 내가 조작한 그대로 합성되지는 않네요. 이유가 뭘까요??
제 코드 일부입니다. backgroundbitmap 과 stickerbitmap을 합성시키려고 합니다.
public void setBackgroundbitmap(Bitmap backgroundbitmap) { this.backgroundbitmap = backgroundbitmap;}
Bitmap stickerbitmap;
public void setStickerbitmap(Bitmap stickerbitmap) { this.stickerbitmap = Bitmap.createBitmap(stickerbitmap, 0, 0, stickerbitmap.getWidth(), stickerbitmap.getHeight());;}
public Bitmap combineImages(Bitmap c, Bitmap s) {
Bitmap cs = null;
int width, height = 0;
if (c.getWidth() > s.getWidth()) {
width = c.getWidth();
height = c.getHeight();
} else {
width = s.getWidth();
height = s.getHeight();
}
cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas comboImage = new Canvas(cs);
comboImage.drawBitmap(c, 0, 0, null);
comboImage.drawBitmap(s, matrix, null);