W3Schools Learner's Blog

W3Schools Programming knowledge summary website

div

1/19/2022

How to flip a bitmap image in android?

 How to flip a bitmap image in android? We can use matrix to do it.

public Bitmap flipBitmap(Bitmap bitmap) {
 
    Bitmap bitmap = new Bitmap();
    matrix.setScale(-1,1);
    Bitmap bitmapRes = Bitmap.createBitmap(bitmap,0,0,bitmap.getWidth(),
        bitmap.getHeight(),matrix,true);
    return bitmapRes;
}

It's easy to mirror a bitmap image.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.