ImageGear for C and C++ on Linux v19.10 - Updated
IG_DIB_pixel_get
API Reference Guide > Core Component API Reference > Core Component Functions Reference > DIB Functions > IG_DIB_pixel_get

This function obtains the pixel at coordinates (nXpos, nYpos), storing it right justified (that is, in the least significant bits) at the location pointed to by lpPixel.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_DIB_pixel_get ( 
        HIGEAR hIGear, 
        AT_PIXPOS nXpos, 
        AT_PIXPOS nYpos, 
        LPAT_PIXEL lpPixel
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
nXpos AT_PIXPOS X offset (in pixels) from beginning of raster line. First pixel on line is pixel number 0.
nYpos AT_PIXPOS Raster line number. 0 is top line.
lpPixel LPAT_PIXEL Far pointer to byte at which to store pixel (or to a 3-byte area if a 24-bit pixel).

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++. 

Pixel Access, FlashPix

Example:

 
Copy Code
HIGEAR hIGear; /* HIGEAR handle of image                                         */
AT_PIXEL                cPixelValue[3];/* 3 bytes in case 24-bit image                                                          */
                /* Get value of the upper-leftmost pixel in image:                                                              */
IG_DIB_pixel_get ( hIGear, 0, 0, &cPixelValue[0] );

Remarks:

If the pixel is 1-bit or 4-bit, the remaining bits of the byte will be set to zeroes.

If the pixel is 24-bit, 3 bytes are returned. These will be in the order Blue-Green-Red (unless you have changed the order of the image bitmap bytes such as by calling function IG_IP_swap_red_blue()).

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.