ImageEn, unit iexBitmaps

TIEBitmap.Rotate

TIEBitmap.Rotate

Declaration

procedure Rotate(Angle: Double; AntialiasMode: TIEAntialiasMode = ierFast; BackgroundColor: TColor = clWhite);

Description

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

AntialiasMode specifies the anti-aliasing algorithm that is used to improve rotation quality (only used when angle is NOT 90, 180 or 270):
Value Description
ierNone No anti-aliasing (lowest quality)
ierFast Fast, but lower quality
ierBilinear Bilinear, high quality
ierBicubic Bicubic, highest quality

BackgroundColor specifies a background color

BackgroundColor specifies a background color to fill new regions (i.e. when not rotating at a 90 degree angle). It is not used if the image contains an alpha channel.
If clNone, then an alpha channel is applied to the image and the non-image area will become transparent.

Note:
◼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 crop and rotate an ROI, use Crop
◼For other image editing functions, you can use Proc

Demo

Demo  Demos\InputOutput\BatchConvert\BatchConvert.dpr

Anti-alias Modes

Examples

// Rotate the image 45° clockwise at highest quality with a white background color
ABitmap.Rotate( 315, ierBicubic, clWhite );

// Rotate the image right (90° clockwise)
// Note: AntialiasMode is irrelevant for 90 deg. rotates
ABitmap.Rotate( 270 );

// Rotate the image 180° clockwise
ABitmap.Rotate( 180 );

// Rotate the image left (90° counter-clockwise)
ABitmap.Rotate( 90 );

// Rotate the image 45° clockwise at highest quality and make the non-image area transparent
ImageEnView1.Proc.Rotate( 315, ierBicubic, clNone );

// Which is the same as...

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

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

See Also

◼Global Image Methods
◼AngleToImageEnRotateAngle
◼Proc

Compatibility Information

In v5.0.0, the Boolean AntiAlias parameter was removed from TIEBitmap.Rotate. Instead you should pass ierNone to disable anti-aliasing, or specify an anti-alias method, e.g. ierFast.
If you have used bmp.Rotate(45) (i.e. with only one parameter and a non-90 degree rotation) then the anti-aliasing has changed from "None" to "Fast". To preserve the old behavior, change your code to: bmp.Rotate(45, ierNone);