ImageGear Professional v18.2 > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_rotate_any_angle_ex |
This function rotates the image by the specified angle.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_IP_rotate_any_angle_ex( HIGEAR hIGear, DOUBLE angle, AT_MODE rotate_mode, LPAT_PIXEL lpBkgrndColor, AT_MODE interpolation ); |
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. |
lpBkgrndColor | LPAT_PIXEL | A far pointer to the RGB or pixel value that specifies the background color to be used in the displaced areas after the image has been rotated. |
interpolation | AT_MODE | Interpolation to use for rotation. Supported modes are IG_INTERPOLATION_NONE, IG_INTERPOLATION_BILINEAR, IG_INTERPOLATION_BICUBIC. Ignored for 1-bit images. |
If interpolation is IG_INTERPOLATION_BILINEAR or IG_INTERPOLATION_BICUBIC:
All pixel formats supported by ImageGear Professional, except:
Interpolation mode is ignored for 1-bit images. |
See GUI component source code.
Copy Code
|
|
---|---|
HIGEAR hIGear; // HIGEAR handle of the image AT_ERRCOUNT nErrcount; // Count of errs on stack upon ret from func AT_INT channelCount; // Count of channels in the image AT_PIXEL lpBackground[256]; // Buffer for background color AT_INT i; // Load image file "picture.bmp" from working directory nErrcount = IG_load_file("picture.bmp", &hIGear); if(nErrcount == 0) { // Get channel count IG_image_channel_count_get(hIGear, &channelCount); // Initialize background color with '255' for(i = 0; i < channelCount; i ++) { lpBackground[i] = (AT_PIXEL)255; } nErrcount = IG_IP_rotate_any_angle_ex(hIGear, 45., IG_ROTATE_CLIP, lpBackground, IG_INTERPOLATION_BILINEAR); // ... // Destroy the image IG_image_delete(hIGear); } |
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.
For the highest quality, bilinear interpolation is recommended, especially if the rotation angle is small (less than 5 degrees) and/or the image will be rotated multiple times. Bi-cubic interpolation can be used to achieve a slightly sharper appearance.
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. |