How to Rotate Bitmap

How do I rotate the bitmap?

Code:
var bitmap = new Bitmap(32,32);bitmap.blt(b,sx,sy,pw,ph,x,y);bitmap._context.rotate(90); <-- it's not working
You can define Rotate version blt.

fx.

    

Code:
Bitmap.prototype.bltRotate = function(source, sx, sy, sw, sh, dx, dy, angle, dw, dh) {        angle = angle || 0;        dw = dw || sw;        dh = dh || sh;        if (sx >= 0 && sy >= 0 && sw > 0 && sh > 0 && dw > 0 && dh > 0 &&                sx + sw <= source.width && sy + sh <= source.height) {            this._context.globalCompositeOperation = 'source-over';            var offsetX = dx + dw/2;            var offsetY = dy + dh/2;            this._context.translate(offsetX, offsetY);            this._context.rotate(angle * Math.PI / 180);            this._context.translate(-offsetX, -offsetY);            this._context.drawImage(source._canvas, sx, sy, sw, sh, dx, dy, dw, dh);            this._context.setTransform(1, 0, 0, 1, 0, 0);            this._setDirty();        }    };

Original thread: https://forums.rpgmakerweb.com/threads/how-to-rotate-bitmap.48225/