drawRotatedImage

This is the same as the other 'drawImage' method, except that it takes an angle, and the image will be rotated by this angle when drawn onto this Image.

Images are always rotated around their centre, rotations are performed in a clockwise direction, and all angles are in radians.

.drawRotatedImage( image, angle, x, y, isCentred=false )

Draws the image at the x and y location given, and rotated by the angle. If 'isCentred' is true, then the x and y refer to the images centre, and otherwise it will drawn from the top-left corner.

back = new Image( 200, 150 )
croc = new Image( 'croc.png' )

back.drawRotatedImage( croc, 30.toRadians(), 10, 10 )
back.drawRotatedImage( croc, -45.toRadians(), 100, 100, true )

.drawRotatedImage( image, angle, x, y, width, height, isCentred=false )

Draws the rotated image, but scaled to the width and height given. If 'isCentred' is true, then the image is centred around the 'x' and 'y' location, based on 'width' and 'height'.

back = new Image( 200, 150 )
croc = new Image( 'croc.png' )
angle = 30.toRadians()

// draw at double the size
back.drawRotatedImage( croc, angle, 10, 10, croc.getWidth()*2, croc.getHeight()*2 )

// draw at a massive size!
back.drawRotatedImage( croc, angle, 100, 10, 200, 200, false )

.drawRotatedImage( image, angle, srcX, srcY, srcWidth, srcHeight, x, y, isCentred=false )

'srcX', 'srcY', 'srcWidth' and 'srcHeight' describe a rectangle found on the given image. This section of the image is drawn to the screen, at the 'x' and 'y' location, and rotated by 'angle'.

'isCentred' only alters where the image is drawn around 'x' and 'y', it has no bearing on the src parameters.

.drawRotatedImage( image, angle, srcX, srcY, srcWidth, srcHeight, x, y, width, height, isCentred=false )

The same as the previous 'drawRotatedImage', only 'width' and 'height' parameters are added to allow you to scale the src section of the image, when it is drawn.