Baruch Baruch - 1 year ago 109
Android Question

Flipping a bitmap in android help?

I want to save up memory for my game and I wanted to ask you because I couldn't find anything and last time that I asked something here I got a good answer. Can i flip the bitmap inside eclipse so i could save on memory for sprites? All the tutorials that i found were about rotating and not flipping. The tutorials for flipping a bitmap were only for open Gl or something like that. Please help me.
I've been looking up for tutorials in google but i gave up at page 5. Can anyone help me?
Does anyone have a good tutorial?
By the way I am using a canvas.

I get a force close everytime I try to run it... can u figure it out? here is my code:

Matrix flipHorizontalMatrix = new Matrix();
flipHorizontalMatrix.postTranslate(0, canvas.getHeight()-arrowL.getHeight());
canvas.drawBitmap(arrowL, flipHorizontalMatrix, null);

I want the arrow to be at the bottom right corner.

Answer Source

Since you're using Canvas, why not try the drawBitmap (Bitmap bitmap, Matrix matrix, Paint paint) method. Use a Matrix that flips the x coordinates.

You can do something like this:

Matrix flipHorizontalMatrix = new Matrix();

canvas.drawBitmap(myBitmap, flipHorizontalMatrix, myPaint);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download