ImageGear for C and C++ on Windows v19.6 - Updated
IG_load_tiles_stitch_FD
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Load Functions > IG_load_tiles_stitch_FD

This function loads and stitches together a tiled image from the file specified by the file handle, returning you a HIGEAR handle to the image in memory.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_load_tiles_stitch_FD(
   AT_INT fd,
   LONG lOffset,
   UINT nPage,
   LPAT_STITCH lpStitch,
   LPHIGEAR lphIGear
);

Arguments:

Name Type Description
fd AT_INT Handle of the open file containing the image to be loaded. This handle can be obtained from Microsoft Windows functions 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.
nPage UINT Page number to load if this is a multi-page file. Note that page numbers begin at 1, not 0. Set nPage to 1 if this is not a multi-page file.
lpStitch LPAT_STITCH Set to a structure of type AT_STITCH, which defines the reference tile number, and the number of rows and columns of tiles.
lphIGear LPHIGEAR Returns a HIGEAR handle to the newly stitched-together image.

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 = 0;      /* handle ret'd by IG_load_FD */
HANDLE      fd;          /* File Descriptor  */
AT_ERRCOUNT nErrcount;   /* to test for errors  */
AT_STITCH  stitchStruct = {1, 1, 1};

fd = CreateFile(_T("picture.tif"), GENERIC_READ,
        0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if(fd != INVALID_HANDLE_VALUE)
{
    /* Load tiles, stitch together and return HIGEAR handle:  */
    nErrcount = IG_load_tiles_stitch_FD((AT_INT)fd, 0, 1, &stitchStruct, &hIGear );
    CloseHandle(fd);

    //...

    // Destroy the image
    if(IG_image_is_valid(hIGear))
    {
        IG_image_delete(hIGear);
    }
}

Remarks:

Unlike IG_load_tiles_stitch, this function is used when the file is already open and you have its File handle.

The AT_STITCH structure allows you to tell ImageGear which tile to use as the upper-left corner in the new stitched image, and how many tile rows and columns should be stitched together. For a graphical representation of how this works, see Working with Tiled Images.

The nPage argument is set to 1 or greater if you are loading from a multi-page file, to indicate which page (image) you want to load. Set nPage to 1 for a non multi-page file.

If you set nPage to < 1, ImageGear will default the value to 1; if you set nPage to greater than the number of pages in the document, ImageGear will default the value to the last page number.

See also IG_load_tiles_stitch, IG_load_tiles_stitch_mem, and IG_tile_count_get_FD functions.

For a complete discussion of working with tiled images, see Working with Tiled Images.