CImage:Reorient


The Reorient method performs one of a variety of reorientation transformations on an image. This applies only to 2-dimensional images.

Syntax

bSuccess = CImage:Reorient( nMethod )

bSuccess = CImage:Reorient( nMethod, bResize )

where

    nMethod is the operation code.

    bResize is true or false to control whether the image shape is changed by the transformation. It defaults to true.

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

  

This method is a single function that embodies the functionality or Hflip, Vflip, Rot90, Rot180, Rot270, and Transpose. Using this method avoids constructing a if...elseif table when the method is unknown or several transformations are applied in succession. The methods are defined in the following table:

Reorient Methods

Operation

Method

Description

Hflip

1

Horizontal flip

Vflip

2

Vertical flip

Rot90

3

Rotate 90 degrees

Rot180

4

Rotate 180 degrees

Rot270

5

Rotate 270 degrees

Transpose

6

Flip about main diagonal

If the optional bResize argument is omitted or set to false, the image retains its original number of columns and rows.

Example

Suppose that a CImage I exists. The following script rotates the image 180 degrees, then flips it horizontally:

I:Reorient( 4 )

-- perform 180 degree rotation

I:Reorient( 1 )

-- perform horizontal flip

Related Topics

CImage class