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

This function sets the pixel data you supply into the DIB image bitmap column specified by nX.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_DIB_column_set ( 
        HIGEAR hIGear, 
        AT_PIXPOS nX, 
        AT_PIXPOS nY1, 
        AT_PIXPOS nY2, 
        const LPAT_PIXEL lpPixel, 
        AT_DIMENSION nNumPixels 
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
nX AT_PIXPOS X offset (X coord) of the vertical pixel column to be set.
nY1 AT_PIXPOS Raster line number at which the vertical column starts.
nY2 AT_PIXPOS Raster line number at which the column ends.
lpPixel const LPAT_PIXEL Far pointer to first byte of your pixel data.
nNumPixels AT_DIMENSION Number of pixels (not bytes) to transfer.

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 cPixArray[400];  /* Receives the returned pixels      */
AT_PIXPOS nCol,  nYtop,  nYbot; /* Column and rows to get          */
AT_DIMENSION nFetched;  /* Holds the count of pixels retrieved*/
AT_ERRCOUNT nErrcount;  /* Receives the returned error counts */
/* Restore the pixels saved by the call in example IG_DIB_column_get:   */
nCol  = 0;   /* Restores to image's left boundary */
nYtop = 10;  nYbot = 59;   /* 50 pixels, from lines 10 thru 59*/
nFetched = nYbot - Top + 1;
nErrcount = IG_DIB_column_set ( hIGear, nCol, nYtop, nYbot, &cPixArray[0],nFetched );

Remarks:

The pixel at nX is set in pixel rows nY1 through nY2 inclusive. nNumPixels is the number of pixels to set, and should equal (nY2-nY1+1).

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 is 1-bit or 4-bit, your pixels should be one to a byte and right justified, beginning at lpPixel. If the image is 24-bit, each pixel should occupy 3 bytes, in Blue-Green-Red order.

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.