ImageGear for C and C++ on Windows v20.3 - Updated
IG_IP_rotate_any_angle
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_rotate_any_angle

This function rotates the image by the specified angle.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_rotate_any_angle(
   HIGEAR hIGear,
   DOUBLE angle,
   AT_MODE rotate_mode
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
angle DOUBLE Angle by which to rotate the image, in degrees. Positive values result in clockwise rotation; negative values result in counter-clockwise rotation.
rotate_mode AT_MODE Rotation mode. Specifies whether the image should be clipped or expanded. See enumIGRotationModes for possible values.

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

Timing; GUI component source code.

Example:

 
Copy Code
HIGEAR hIGear;            // HIGEAR handle of the image
AT_ERRCOUNT nErrcount;    // Count of errs on stack upon ret from func

// Load image file "picture.bmp" from working directory
nErrcount = IG_load_file("picture.bmp", &hIGear);
if(nErrcount == 0)
{
    nErrcount = IG_IP_rotate_any_angle(hIGear, 45., IG_ROTATE_CLIP);
    // ...
    // Destroy the image
    IG_image_delete(hIGear);
}

Remarks:

The function rotates the image about its center point.

You can use IG_IP_rotate_compute_size to calculate the new dimensions of the bitmap that the image will have after rotation in IG_ROTATE_EXPAND mode.

The functionality of this API call has been upgraded and supported by the new function IG_IP_rotate_any_angle_ex. This new function allows you to specify the interpolation method for rotation and background color around the image being rotated. In the interest of backward compatibility, we have left the old function in its original form and have retained support for it. If you have already used the old function in your code, it is not mandatory that you modify your code, but it is recommended.

Rotating the image multiple times at angles that are not multiple of 90 degrees may degrade the quality of the image.

You can only rotate PDF/PS images in 90 degree increments.

Is this page helpful?
Yes No
Thanks for your feedback.