ImageGear for C and C++ on Linux - Updated
IG_load_CCITT_FD
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Load Functions > IG_load_CCITT_FD

This function has been deprecated and will be removed from the public API in a future release. Please use IG_load_raw_FD instead.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_load_CCITT_FD(
   AT_INT fd,
   AT_DIMENSION nWidth,
   AT_DIMENSION nHeight,
   AT_MODE nType,
   AT_MODE nFillOrder,
   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.
nWidth AT_DIMENSION Number of pixels in each row of data to be read.
nHeight AT_DIMENSION Number of rows of data.
nType AT_MODE Specifies the type of compression: IG_COMPRESSION_CCITT_G3, IG_COMPRESSION_CCITT_G4 or IG_COMPRESSION_G32D. There is no default for this property.
nFillOrder AT_MODE IG_FILL_MSB or IG_FILL_LSB, specifying whether the most-significant-bit-first or least-significant-bit-first. There is no default for this property.
lphIGear LPHIGEAR Pointer to HIGEAR variable to return a newly created image.

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

Example:

 
Copy Code
HIGEAR hIGear = 0;            // Will receive HIGEAR image handle
HANDLE fd;                    // File Descriptor handle

// Open a dile to read
fd = CreateFile(_T("Group4.raw"), GENERIC_READ,
        0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);

if(fd != INVALID_HANDLE_VALUE)
{
    AT_ERRCOUNT nErrcount;        /* Returned count of errors */
    nErrcount = IG_load_CCITT_FD((AT_INT)fd, 2320, 3408, IG_COMPRESSION_CCITT_G4, IG_FILL_MSB,    &hIGear);

    //...

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

Remarks:

This function creates an ImageGear image from a raw CCITT Compressed data file.

File pointer must be positioned at the start of the data. (For example, your application should read or seek past any header that is present.) You must specify the type, G3 or G4, by means of argument nType, and you must specify the fill order, most-significant-bit-first or least-significant-bit-first, by argument nFillOrder. The most common fill order is most-significant-bit-first or IG_FILL_MSB.

The width and height of the image are specified by nWidth and nHeight. The handle of the resulting new ImageGear image is returned in the HIGEAR variable pointed to by lphIGear. The resulting image is always 1-bit.

This function is used when you have a non-standard or proprietary G3 or G4 compressed image file and you know the details of the header. There are literally hundreds of different types of image files that fall into this category. In order to be able to successfully read an image of this type you must know enough about the header to find where the height and width are stored. You can usually look at the header with a hex dump utility and see where these values are stored. Once you are able to read past the header plus get the dimensions of the image, you can then use this function. You can experiment with the other settings until the image is read correctly. See also function IG_load_auto_detect_set.

The functionality of this API call has been upgraded and supported by the new function IG_load_raw_FD. The reason that this new function has been created to expand the number of raw image types you can load into ImageGear.

In the interest of backward compatibility, we have left the old function in its original form and have retained support for it. If you have already used the old function in your code, it is not mandatory that you modify your code, but it is recommended. Consider using IG_load_raw_FD instead.

G3 compressed images are always 1728 pixels wide. Since G3 files usually have a special code at the end of the image that ImageGear will detect, you can set the height to a value greater than the expected height of the image and it will be corrected once the end of image marker is detected. For G4 files the height and width must be known and in all cases the file pointer must be at the start of the compressed image when this function is called.