开发者

ImageView rotation working fine, but still distortion in graphic

开发者 https://www.devze.com 2023-03-10 18:26 出处:网络
M开发者_JAVA百科y code is working fine for rotation of ImageView.But the rotated ImageView becomes distorted/crisp and it appears blurred.

M开发者_JAVA百科y code is working fine for rotation of ImageView.But the rotated ImageView becomes distorted/crisp and it appears blurred.

arrow1 = (ImageView) findViewById(R.id.arrow1);
bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.arrow1);
bmpWidth = bitmap.getWidth();
bmpHeight = bitmap.getHeight();
float curScale = 1F;        
Matrix matrix = new Matrix();
matrix.postScale(curScale, curScale);
matrix.postRotate(90);  
if(resizedBitmap!=null){
 resizedBitmap.recycle();
}
resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bmpWidth, bmpHeight, matrix, true);
arrow1.setImageBitmap(resizedBitmap);


Are you specifically limited to the classes you have used above i.e. is this an academic exercise?

There seems to be many ways to accomplish lossless 90 degree rotation and none of them using ImageView and Matrix like you do.

It is a bit mean to just say 'Google it' but, really, it seems as though you haven't done so.

http://www.google.co.uk/search?q=image+rotate+90+degrees+java

0

精彩评论

暂无评论...
验证码 换一张
取 消