CImage:Rotate


The Rotate method rotates the image about its image center. To rotate about a different point, use RotatePt.

Syntax

bSuccess = CImage:Rotate( nAngle )

bSuccess = CImage:Rotate( nAngle, bResize ) 

 

where

    nAngle is the rotation angle in degrees.

    bResize is true or false to control whether the image dimension is adjusted for the scale factor. It defaults to true.

    bSuccess is the returned success code. On success it is true, otherwise false.

  

The angle is measured into increasing row number with 0 degrees pointing along the positive x axis (i.e., along a row toward increasing column number). Whether the image appears rotated clockwise or counterclockwise depends upon whether the image is displayed with row number increasing upward or downward.

This method resamples the image to calculate the new values at fractional pixel locations. Resampling is controlled by members of the ResampleParams table. The image is not resampled if both x and y shifts are integral values. When resampling is needed, you can either do nothing and use the default parameters or set specific parameters and then call SetResampleParams function.

Example

Suppose an image is displayed in a CImageView named V. The following script rotates the image by 53.45 degrees and adjusts the image size to accommodate the rotated data:

I = V:GetImage()

-- attach the current displayed image

I:Rotate( 53.45 )

-- perform the operation

V:Update()

-- update the display after the rotation

Related Topics

RotatePt

Image Geometry Methods

CImage class