Last active
November 1, 2015 07:50
-
-
Save pvllnspk/b3aa5ad5b79742478426 to your computer and use it in GitHub Desktop.
Revisions
-
pvllnspk renamed this gist
Nov 1, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
pvllnspk created this gist
Dec 6, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ private Bitmap combineBitmaps(Bitmap bmp1, Bitmap bmp2, int angle){ Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth()+2*bmp2.getWidth(), bmp1.getHeight()+2*bmp2.getHeight(), bmp1.getConfig()); Canvas canvas = new Canvas(bmOverlay); int centerX = canvas.getWidth()/2; int centerY = canvas.getHeight()/2; canvas.drawBitmap(bmp1, centerX-bmp1.getWidth()/2, centerY-bmp1.getHeight()/2, null); int R = canvas.getHeight()/2 - bmp2.getHeight()/2; int theta = angle-90; float x = (float)(centerX + R * Math.cos(theta * Math.PI / 180)); float y = (float)(centerY + R * Math.sin(theta * Math.PI / 180)); canvas.rotate(angle,x,y); canvas.drawBitmap(bmp2, x - bmp2.getWidth()/2, y - bmp2.getHeight()/2, null); return bmOverlay; }