안드로이드 개발 질문/답변
(글 수 45,052)
안녕하세요..
Bitmap resize 하는데 delay가 300ms 가 넘을 때가 있더라고요......
함수는
public static Bitmap CreateScaledBitmapFromBytes(byte[] bytes, int iSrcWidth, int iSrcHeight, int iDstWidth, int iDstHeight)
{
if(bytes == null)
{
return null;
}
ByteBuffer buf = ByteBuffer.wrap(bytes);
buf.rewind();
Bitmap bmp = CreateBitmapFromBytes(bytes, iSrcWidth, iSrcHeight);
if( bmp == null )
return null;
return Bitmap.createScaledBitmap(bmp, iDstWidth, iDstHeight, true);
}
다음과 같이 적용했습니다.
Bitmap.createScaledBitmap(bmp, iDstWidth, iDstHeight, true);
이 부분이 resize해주는 부분인데.. 이렇게 size를 늘려주는 방법 말고 다른 방법이 있는지.... 가르쳐주세요....
평균적으로 resizing delay가 30~80ms 적용이 되고 오래 걸릴때는 300~700정도 걸립니다....
실시간으로 Bitmap이 변환이 되어야 되어서.. 최대 30~50까지 나오도록 하고싶어요...도와주세요..




자답입니다.
Bitmap.createScaledBitmap(bmp, iDstWidth, iDstHeight, true); 이 함수가 delay를 많이 가지고 있기 때문에
제거를 하고 Rect함수를 사용해서 이미지를 늘여주면 됩니다.