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

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

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_load_CCITT_mem(
   LPVOID lpImage,
   AT_UINT nSize,
   AT_DIMENSION nWidth,
   AT_DIMENSION nHeight,
   AT_MODE nType,
   AT_MODE nFillOrder,
   LPHIGEAR lphIGear
);

Arguments:

Name Type Description
lpImage LPVOID Memory buffer containing raw Fax data to be loaded.
nSize AT_UINT Size of the memory buffer lpImage.
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:

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

Sample:

None

Example:

 
Copy Code
HIGEAR hIGear = 0;            // Will receive HIGEAR image handle
AT_BYTE* lpImage;        // Memory buffer to keep an image
AT_INT fileSize;        // Size of the memory buffer
FILE* fd = NULL;        // File Descriptor
AT_ERRCOUNT nErrcount;  // Returned count of errors */

// Open a file and get its size
fopen_s(&fd, "Group4.raw", "rb");
if(fd != NULL)
{
    fseek(fd, 0, SEEK_END);
    fileSize = (AT_UINT)ftell(fd);
    fseek(fd, 0, SEEK_SET);
    // Allocate memory and read the image into the memory buffer
    lpImage = (AT_BYTE*)malloc(fileSize);
    fread(lpImage, 1, fileSize, fd);
    // File is no longer needed - close it
    fclose(fd);
    
    // Load image from the memory
    nErrcount = IG_load_CCITT_mem(lpImage, fileSize, 2320, 3408,
        IG_COMPRESSION_CCITT_G4, IG_FILL_MSB, &hIGear );
    // Delete memory buffer
    free(lpImage);

    //...

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

Remarks:

This function creates an ImageGear image from raw CCITT Compressed data located in memory.

This function operates similarly to function IG_load_CCITT_FD. Note that lpImage must point to the start of the actual data (not to the start of any header information that may be present).

The functionality of this API call has been upgraded and supported by the new function IG_load_raw_mem. The reason that this new function has been created is that the old function restricted you to loading raw images that are stored with CCITT formatting.

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_mem instead.