Rotate bitmap

Hi,

 I need to rotate a bitmap and store the result (keeping the original intact). I tried to do what written in this topic http://forums.rpgmakerweb.com/index.php?/topic/48225-how-to-rotate-bitmap/ 

but the image i want to rotate has the alpha and when the code redraws it after the rotation the old bitmap and the new rotate one overlay eachother. It would be even better to mirror the bitmap but having both funcitons would be handy

basically what i need is something like this:

var bitmap = new Bitmap(w, h);bitmap = ImageManager.loadSprite('file path');// BITMAP ROTATIONvar rotatedBitmap = new Bitmap(w, h);rotatedBitmap = bitmap.rotate(90); //I want the rotate method to retrun a value, not modify the source image// BITMAP MIRRORING (EVEN BETTER FOR ME)var mirroredBitmap = new Bitmap(w, h);rotatedBitmap = bitmap.mirror(axis);For now I just need 90 degrees rotations and horizontal or vertical flips only, but a code that works with every kind of rotation / mirror axis inclination would be good.

Any idea how to write "Bitmap.rotate()" and "Bitmap.mirror()"?

Thank you
in my plugin EST - GRAPHIC SHIFT EVO...

(link in my signature)

i hijack Sprite_Character to modify how the bitmap drawn...

so maybe using sprite would be better.

since inside sprite object...

this.scale.x = -this.scale.x;

will flip the image horizontally

this.scale.y = -this.scale.y;

will flip the image vertically

this.rotation = 90 * Math.PI / 180;

will rotate graphic 90 degrees...

hope this help.

you could also revert your bitmap back by changing the value inside sprite object... since your actual bitmap is not modified...
Cool, I'll try it

Original thread: https://forums.rpgmakerweb.com/threads/rotate-bitmap.52785/