ImageGear for C and C++ on Linux v18.10 - Updated
IG_mpf_page_swap
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Multi Page Image File Functions > IG_mpf_page_swap

If the multi-page image is associated with an external file, then this function swaps pages with the given page numbers in the external file.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_mpf_page_swap( 
        [IN] HMIGEAR hMIGear, 
        [IN] UINT nPage1, 
        [IN] UINT nPage2
);

Arguments:

Name Type Description
hMIGear HMIGEAR The handle of the multi-page image.
nPage1 UINT The number of first page to swap.
nPage2 UINT The number of second page to swap.

Return Value:

Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

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

Example:

 
Copy Code
HMIGEAR   hMIGear;       /* handle to multi-page image  */
AT_ERRCOUNT  nErrCount = IGE_SUCCESS; /* will hold returned error count */
UINT nPageCount = 0; /* number of pages that should get from multi-page image */
 ...
/* initialize multi-page image and assign it with external file */
nErrCount = IG_mpf_page_count_get( hMIGear, &nPageCount );
/* Swap first page and last pages */
if (!nErrCount && nPageCount > 1)
        nErrCount += IG_mpf_page_swap(hMIGear, 0, nPageCount - 1 );

Remarks:

If the multi-page image is not associated with an external file, an error is returned. Pages are numerated starting with 0. The multi-page image is not changed.

Not all format filters support IG_mpf_page_swap() mode. Use the IG_fltr_info_get() function to obtain information about the supported features for specific format filters.