Shiny Language Reference

Language Reference > Image Functions


rotateimage

rotateimage(image MyImage, double Degrees);

 

 

Rotates the specified image

The ROTATEIMAGE statement internally rotates an image previously loaded with the createimage statement. Because the rotation is performed internally this statement may be used anywhere in a plugin's code.

ROTATEIMAGE discards the original (unrotated) image and replaces it with the rotated image. Therefore all subsequent calls to drawimage that use this image will use its rotated form.

Rotation is a slow operation (especially when per-pixel alpha channel images are used), therefore you should use this statement as little as possible. If your plugin needs to draw 2 versions of the same image - one rotated, and one normal - then you should load the image twice into 2 separate IMAGE variables, rather than rotating the image, drawing it, then rotating it back.

Note that rotating an image usually increases its height and/or width. The height and width of the specified image are automatically increased to ensure the image is not clipped during rotation. You should call getimagewidth and getimageheight after calling ROTATEIMAGE to obtain up-to-date and accurate dimensions.

 

Parameters

MyImage

A variable declared as type IMAGE and previously associated with a bitmap image using the CREATEIMAGE statement.

Degrees

The number of degrees to rotate the image. Rotations are performed counter-clockwise. Rotations of less than 0 or greater than 360 are ignored.

 

Return Value

None

 

Example Code

image MyImage;
if(createimage(MyImage, "C:\\MyBitmap.bmp") == TRUE)
{
    // Rotate the image 20 degrees counterclockwise
    rotateimage(MyImage, 20);
}