This function creates an ImageGear image from the raw image data of the file whose File handle is fd.
Declaration:
Copy Code | |
---|---|
AT_ERRCOUNT ACCUAPI IG_load_raw_FD( AT_INT fd, AT_DIMENSION nWidth, AT_DIMENSION nHeight, UINT nBitsPerPixel, AT_MODE nFillOrder, AT_MODE nCompression, 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 | The width, in pixels, of the image. |
nHeight | AT_DIMENSION | The height, in pixels, of the image. |
nBitsPerPixel | UINT | The Bits Per Pixel of the raw data to load. |
nFillOrder | AT_MODE |
Set to the fill order used in the image: Least Significant Bit first (LSB) or Most Significant Bit first (MSB). Use one of the ImageGear - defined constants: IG_FILL_LSB or IG_FILL_MSB.
|
nCompression | AT_MODE | Compression used by the RAW image data. Set to one of enumIGCompressions constants. |
lphIGear | LPHIGEAR | Returns a HIGEAR handle to the raw image data just loaded. |
Return Value:
Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.Supported Raster Image Formats:
- Indexed RGB - 1, 4, 8 bpp
- Grayscale - 12, 16 bpp
- RGB - 24 bpp
- CMYK - 32 bpp
Sample:
FlashPix
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_raw_FD((AT_INT)fd, 2320, 3408, 1, IG_FILL_MSB, IG_COMPRESSION_CCITT_G4, &hIGear); //... // Destroy the image if(IG_image_is_valid(hIGear)) { IG_image_delete(hIGear); } CloseHandle(fd); } |
Remarks:
A raw image file contains no header or identifying information. You must supply this function with all of the information needed to correctly parse the image data, including the compression, byte fill order, width, height, and bit depth. Currently, this function can be used to read raw image data from the following types of files: ABIC, CCITT - Group 3, Group 3 2D, Group 4, LZW, and raw uncompressed data.
The ABIC and LZW compression types are available as separate components to ImageGear. See ImageGear Components for details on working with ImageGear components. |
The pointer must be positioned at the start of the data. (For example, your application should read or seek past any header that is present.)
Additionally, you can specify row and pixel alignment for the loading of uncompressed images using ALIGNMENT and UNCOMPRESSED_PACKED image control parameters, respectively. See RAW format reference for more information.
For uncompressed images only, ImageGear's Load Raw functions consider the coordinates (0,0) to refer to the lower-left corner of the bitmap. |