Problème de redimensionnement d'une image après rotation
Bonjour,
voilà je fait un petit programme sous android 2.0 qui permet de tourner une image avec la fonction onFling d'un gestureListener.
Mon problème et qu'après avoir effectue un mouvement brusque sur l'ecran mon image se redimenssionne 1 fois sur 2.
voici le code de mon GestureListener:
Code:
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
|
private ImageView splash; //init dans la fct onCreate de la classe parent et récupéré depuis le constructeur de la classe GestureListener
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY)
{
float res = e2.getX() - e1.getX();
if (res > 0f)
rotateRight();
return true;
}
private void rotateRight()
{
Animation a = AnimationUtils.loadAnimation(parent, R.anim.rotate_right);
splash.startAnimation(a);
Matrix mat = new Matrix();
mat.setRotate(deg);
Bitmap bMapRotate = Bitmap.createBitmap(bMap, 0, 0, bMap.getWidth(), bMap.getHeight(), mat, true);
System.out.println("bMap taile : "+bMap.getWidth()+" "+bMap.getHeight());
System.out.println("bMapRotate taile : "+bMapRotate.getWidth()+" "+bMapRotate.getHeight());
splash.setImageBitmap(bMapRotate);
if (deg >= 360f)
deg = 45f;
else
deg += 45f;
} |
la console m'affiche ça pour la taille de mon image:
Code:
1 2 3 4 5 6
|
bMap taille : 540 533
bMapRotate taille : 540 533
-----------------------------
bMap taille : 540 533
bMapRotate taille : 759 759 |
quelqu'un saurait pourquoi ?