ImageGear for C and C++ on Linux v18.10 - Updated
IG_IP_flip
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_flip

Flips the image referenced by hIGear either horizontally or vertically.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_flip(
   HIGEAR hIGear,
   AT_MODE nDirection
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image to flip.
nDirection AT_MODE IG_FLIP_HORIZONTAL or IG_FLIP_VERTICAL, indicating whether to flip horizontally or vertically.

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++.

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_flip(hIGear, IG_FLIP_VERTICAL);
    // ...
    // Destroy the image
    IG_image_delete(hIGear);
}

Remarks:

Flipping horizontally exchanges the right-most pixel column of the image bitmap with the left-most. Flipping vertically exchanges the topmost pixel row (raster) of the image bitmap with the bottom-most. The dimensions of the image do not change.

If you want to turn the image upside-down (not the same as a vertical flip), use function IG_IP_rotate_multiple_90, with rotation mode set to IG_ROTATE_180.