Android

Code public static Bitmap getBitmapCircleCrop(Bitmap bitmap, int Width, int Height) { Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(output); final int color = 0xff424242; final Paint paint = new Paint(); final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight()); paint.setAntiAlias(true); canvas.drawAR..
1. Bitmap to Drawable Drawable drawable = getResources().getDrawable(R.drawable.my_image); // drawable to bitmap Bitmap bitmap = ((BitmapDrawable)drawable).getBitmap(); drawable 이미지를 가져와 Drawable에 생성한뒤 bitmap으로 형변환 하여 넣어준다 2. Drawable to Bitmap // bitmap to drawable Drawable drawable = new BitmapDrawable(bitmap); bitmap에서 가져와 drawable에 넣어 생성해준다. 때에 때라 여러가지 방법으로 drawable 혹은 bitmap을 사용하게 되는데 이미지를 ..
1. Bitmap 안드로이드에서 지원하는 이미지 포맷이다. 안드로이드는 이미지파일이나 메모리를 통해 Bitmap 파일을 다룰 수 있다. Bitmap을 통하여 이미지를 자르거나 편집, 파일형 변환을 통해 적절하게 사용처에 맞게 사용할 수 있다. Code Bitmap BitmapFactory.decodeFile(String pathName, BitmapFactory.Options opts); Bitmap BitmapFactory.decodeByteArray(byte[] data, int offset, int length, BitmapFactory.Options opts) 기본적으로 Bitmap은 사용시 메모리를 많이 할당하므로 다음과 같이 이미지 파일 크기를 줄여 사용한다 public static int c..
1. Rect란? public Rect (int left, int top, int right, int bottom) 사각형을 표시하는 좌표계 클래스이다. 상기에 보이는 것과 같이 왼쪽, 위, 오른쪽, 아래 순으로 구성되어 있다. x,y의 평면도로 생각하지않고 단순 각각의 변의 길이라고 생각하는것이 편하다 각각의 left부터 right까지가 가로변, top부터 bottom 까지가 세로변이다 Rect rect = new Rect(100, 100, 1000, 1000); 상기와 같이 가정한다면 100
🔔벨91
'Android' 카테고리의 글 목록 (5 Page)