Try popular Android Application by Feliz-Droid

Try popular Android Application by Feliz-Droid

Speaking Caller logo
Speaking Caller
   
Battery temperature logo
Battery Temperature
   
Dual Photo logo
Dual Photo
   
Ganesh Wallpapersl ogo
Lord Ganesh Wallpaper
   
Girly Pink Keyboard l ogo
Girly Pink Keyboard

Thursday, August 27, 2015

Flip Bitmap in android

Hello Friends today we will see how to flip bitmap in android.

//# create a enum flip type parameter.
enum FLIP{HORIZONTAL,VERTICAL};
 // flip function with type
public static Bitmap flip(Bitmap bitmap, FLIP type){
Matrix matrix =new Matrix();
if(type==FLIP.HORIZONTAL){
              matrix.preScale(-1.0f, 1.0f);
}else if(type==FLIP.VERTICAL){
              matrix.preScale(1.0f, -1.0f);
}
return Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
}
 // calling flip function and get flipped bitmap
Bitmap flippedBitmap=flip(bitmap, FLIP.HORIZONTAL);


 Support by downloading my App!