ImageEn, unit imageenproc




procedure Rotate(Angle: Double; AntiAliasMode: TIEAntialiasMode = ierFast; BackgroundColor: TColor = -1);


Rotate the current image by the specified angle (negative or positive degrees counter-clockwise).

AntialiasMode specifies the algorithm used to improve rotation quality:
  ierNone : No anti-aliasing (lowest quality)
  ierFast : Fast but lower quality
  ierBilinear : Bilinear, high quality
  ierBicubic : Bicubic, highest quality

BackgroundColor specifies an alternative background color. If it is -1, Rotate uses the default background.

This is a common image from a digital camera that was not held correctly causing the horizon not to be level.

After calling ImageEnView1.Proc.Rotate( 5 ):

- If the image has an alpha channel then the null area is filled with transparency (so you will not see the background color). To prevent the transparent area, and force a background color fill, remove the alpha channel
- To crop the image caused by rotation, use RotateAndCrop
- To allow the user to interactively rotate the image, use RotateTool
- If PdfViewer is enabled, this will redirect to PageRotation
- This function is also available to the user in the Image Processing dialog


// Rotate the image 45 clockwise at highest quality and using the ImageEnView background color
ImageEnView1.Proc.Rotate( 315, ierBicubic, -1 );

// Rotate the image 90 clockwise (Note: AntialiasMode is irrelevant for 90 deg. rotations)
ImageEnView1.Proc.Rotate( 270 );

// Rotate the image 180 clockwise
ImageEnView1.Proc.Rotate( 180 );

// Rotate the image 90 counter-clockwise
ImageEnView1.Proc.Rotate( 90 );

// Rotate the image 45 clockwise, with good quality, and the null area created by the rotation set as transparent
ImageEnView1.IEBitmap.AlphaChannel; // Create an alpha channel if one does not exist
ImageEnView1.Proc.Rotate( -45, ierBicubic );

// Rotate the image 45 clockwise, with good quality, and the null area created by the rotation set as black
ImageEnView1.IEBitmap.RemoveAlphaChannel; // Remove alpha channel if there is one
ImageEnView1.Proc.Rotate( -45, ierBicubic, clBlack );

See Also

- Global Image Methods
- AngleToImageEnRotateAngle