티스토리 뷰

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


댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함