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

This function computes the new width and height of the image after it has been rotated using IG_IP_rotate_any_angle, IG_IP_rotate_any_angle_bkgrnd, or IG_IP_rotate_any_angle_ex functions.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_rotate_compute_size(
   HIGEAR hIGear,
   DOUBLE angle,
   AT_MODE rotate_mode,
   LPAT_DIMENSION lpWidth,
   LPAT_DIMENSION lpHeight
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image of which to compute size.
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.
lpWidth LPAT_DIMENSION Pointer in which is returned the new width of the bitmap after rotation.
lpHeight LPAT_DIMENSION Pointer in which is returned the new height of the bitmap after rotation.

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:

None

Example:

 
Copy Code
HIGEAR hIGear;            // HIGEAR handle of the image
AT_ERRCOUNT nErrcount;    // Count of errs on stack upon ret from func
AT_DIMENSION nWidth, nHeight;  // New height and width of image


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

Remarks:

You may use this function before rotation in IG_ROTATE_EXPAND mode to determine the dimensions of the new rotated image. This way, you can estimate the amount of memory that will be needed to hold the new image.

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