ImageGear for C and C++ on Linux v18.10 - Updated
IG_tile_count_get_FD
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Info Functions > IG_tile_count_get_FD

This function gets the number of tiles constituting a page for file formats that support tiled pages in the image file specified by its file handle.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_tile_count_get_FD(
   AT_INT fd,
   LONG lOffset,
   UINT nPageNum,
   LPUINT lpTileCountH,
   LPUINT lpTileCountV
);

Arguments:

Name Type Description
fd AT_INT Handle of the open file. This handle can be obtained from Microsoft Windows function such as CreateFile(), and cast to AT_INT for passing to the function parameter. FILE pointers returned by functions such as fopen(), and file handles returned by functions such as _sopen_s() are not supported.
lOffset LONG Offset into the file, in bytes, to where the image begins. This is the offset to the beginning of the header, not to the beginning of the bitmap. lOffset is usually 0.
nPageNum UINT Page number for which to get count of tiles.
lpTileCountH LPUINT Pointer to a UINT variable to receive the number of tiles horizontally (number of tiles in a row).
lpTileCountV LPUINT Pointer to a UINT variable to receive the number of tiles vertically (number of tiles in a column).

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
HANDLE fd;                // File Descriptor
UINT nTileRows;            // Will receive number of tile rows
UINT nTileCols;            // Will receive number of tile cols
AT_ERRCOUNT nErrcount;  // Count of returned errors

fd = CreateFile(_T("picture_tiled.tif"), GENERIC_READ,
        0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(fd != INVALID_HANDLE_VALUE)
{
    nErrcount = IG_tile_count_get_FD((AT_INT)fd, 0, 1, &nTileRows, &nTileCols );
    CloseHandle(fd);
}

Remarks:

Use this function when the file is open and you have its file handle.

The function returns 0 for both lpTileCountH and lpTileCountV if the image file format does not support tiled images.