ImageGear for C and C++ on Windows v19.4 - Updated
IG_DIB_row_set
API Reference Guide > Core Component API Reference > Core Component Functions Reference > DIB Functions > IG_DIB_row_set

This function writes a consecutive row of nLength pixels that begin at lpPixel, into image hIGear`s DIB image bitmap.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_DIB_row_set ( 
        HIGEAR hIGear, 
        AT_PIXPOS nXpos, 
        AT_PIXPOS nYpos, 
        AT_DIMENSION nLength, 
        const 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 raster line. First pixel on line is pixel number 0.
nYpos AT_PIXPOS Raster line number. 0 is top line.
nLength AT_DIMENSION Number of consecutive pixels to transfer.
lpPixel const LPVOID Far pointer to byte at which the pixels to transfer begin.
nFormat AT_MODE Format in which the raster data is stored: 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:

See the example for function IG_DIB_row_get().

Remarks:

The row is written into raster line nYpos, beginning at pixel offset nXpos. If nFormat is set to IG_PIXEL_UNPACKED, and the image is 1-bit or 4-bit, your pixels to be transferred should be one to a byte, right justified (that is, in the least significant bits). If a 24-bit image, each pixel should occupy 3 bytes, ordered Blue-Green-Red. (See the section Device-Independent Bitmaps (DIB) for more details on pixel storage in DIBs.)

(If (nXpos + nLength) is greater than the width of the image as indicated in the DIB header, an error will result.

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. 

If the image you are modifying is 1-bit, you will probably need to convert the image from run-end encoded to a standard DIB, before you can set pixel values. Please see the section Accessing Image Pixels for details.