ImageGear for C and C++ on Windows v20.5 - Updated
IG_DIB_row_get
API Reference Guide > Core Component API Reference > Core Component Functions Reference > DIB Functions > IG_DIB_row_get

This function obtains a consecutive row of nLength pixels beginning at coordinates (nXpos, xYpos) in the image bitmap.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_DIB_row_get ( 
        HIGEAR hIGear, 
        AT_PIXPOS nXpos, 
        AT_PIXPOS nYpos, 
        AT_DIMENSION nLength, 
        LPVOID lpPixel, 
        AT_MODE nFormat 
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
nXpos AT_PIXPOS X offset (in pixels) from beginning of the raster line. First pixel on line is pixel number 0. Specify as -1 to obtain the entire raster line of pixels.
nYpos AT_PIXPOS Raster line number (0 is top line).
nLength AT_DIMENSION Number of consecutive pixels to obtain (entire raster line if nXpos = -1).
lpPixel LPVOID Far pointer to first byte of your area, at which the pixels obtained are to be stored.
nFormat AT_MODE Format in which the raster data is read: IG_PIXEL_PACKED, IG_PIXEL_UNPACKED, IG_PIXEL_RLE.

Return Value:

Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

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

Sample:

Pixel Access

Example:

 
Copy Code
HIGEAR            hIGear;                /* HIGEAR handle of image                                                       */
AT_PIXEL                 cPixelValue[300];                      /* To hold 100 pixels, in case 24-bit*/
AT_PIXPOS                nRow;          /* Index for the loop below                                                     */
AT_DIMENSION             nRowLen;               /* How much of row to copy                                                      */
AT_ERRCOUNT              nErrcount;             /* Holds the returned error count                                                       */
/* Obtain leftmost 100 pixels of top raster of image:                                                                                   */
nRowLen = 100;
nErrcount = IG_DIB_row_get ( hIGear, 0, 0, nRowLen, &cPixelValue[0], IG_PIXEL_UNPACKED );
/* Make leftmost 100 pixels of next 9 rows identical:                   */
for ( nRow = 1; nRow < 10; nRow++ )
        nErrcount = IG_DIB_row_set (hIGear, 0, nRow, 
                nRowLen, cPixelValue, IG_PIXEL_UNPACKED);

Remarks:

If nFormat is set to IG_PIXEL_UNPACKED, and the image is 1 or 4-bit, the pixels obtained are stored right justified, one to a byte, beginning at your byte pointed to by lpPixel. The unused bits of the bytes are set to zero. If the pixels are 24-bit, 3 bytes per pixel are returned, ordered Blue-Green-Red. A total of nLength pixels is transferred. (See the section Device-Independent Bitmaps (DIB)Understanding Bitmap Images for more details on pixel storage in DIBs.)

ImageGear's pixel access functions consider the coordinates (0,0) to refer to the upper left-hand corner of the bitmap data. They do not follow the DIB's orientation, which considers (0,0) to refer to the lower left-hand corner of the bitmap.
Is this page helpful?
Yes No
Thanks for your feedback.