티스토리 뷰
private Bitmap combineImage(Bitmap first, Bitmap second, boolean isVerticalMode){
Options option = new Options();
option.inDither = true;
option.inPurgeable = true;
Bitmap bitmap = null;
if(isVerticalMode)
bitmap = Bitmap.createScaledBitmap(first, first.getWidth(), first.getHeight()+second.getHeight(), true);
else
bitmap = Bitmap.createScaledBitmap(first, first.getWidth()+second.getWidth(), first.getHeight(), true);
Paint p = new Paint();
p.setDither(true);
p.setFlags(Paint.ANTI_ALIAS_FLAG);
Canvas c = new Canvas(bitmap);
c.drawBitmap(first, 0, 0, p);
if(isVerticalMode)
c.drawBitmap(second, 0, first.getHeight(), p);
else
c.drawBitmap(second, first.getWidth(), 0, p);
first.recycle();
second.recycle();
return bitmap;
}
비트맵 2장을 이어붙이는 방법(소스)
isVerticalMode = true를 주면 세로로, false를주면 가로로 합친다. 리턴은 Bitmap
'개발 > 개발 자료' 카테고리의 다른 글
| (JSP) jsp에서 json으로 데이터 출력하기 (0) | 2014.04.27 |
|---|---|
| (NSXmlParser) 기본 변수 구분하기 (0) | 2014.04.27 |
| (Android) SurfaceView Canvas 를 Bitmap으로 저장하기(가져오기) (5) | 2014.03.26 |
| (Android) RelativeLayout 코드로 구현하기 (2) | 2014.03.26 |
| (Android) Assets에서 Bitmap 읽어오기 (0) | 2014.03.24 |
댓글
