API Reference Guide > Core Component API Reference > Core Component Functions Reference > DIB Functions > IG_DIB_area_set |
This function transfers pixels from the location pointed to by lpPixel into the rectangular portion of the image specified by rectangle lpRect.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_DIB_area_set ( HIGEAR hIGear, const LPAT_RECT lpRect, const LPAT_PIXEL lpPixel, AT_MODE nPixelFormat ); |
Name | Type | Description |
---|---|---|
hIGear | HIGEAR | ImageGear HIGEAR handle of image |
lpRect | const LPAT_RECT | Far pointer to an AT_RECT struct specifying the rectangular portion of the image bitmap to set |
lpPixel | LPAT_PIXEL | Far pointer to first byte of your pixel data |
nPixelFormat | AT_MODE | A constant such as IG_DIB_AREA_UNPACKED specifying in what form you are providing the pixels. The IG_DIB_AREA_... constants are listed in file accucnst.h. |
Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.
All pixel formats supported by ImageGear for C and C++.
Pixel Access
Copy Code
|
|
---|---|
HIGEAR hIGear; /* HIGEAR handle of image */ AT_RECT rcBlock; /* The rectangular block to set */ AT_PIXEL cPixelArray[400]; /* The pixels to set */ AT_DIMENSION nWid, nHi; /* Receives the width & height of an image */ UINT nBpp; /* Bits per pixel */ AT_ERRCOUNT nErrcount; /* Receives the returned error counts */ /* Sets the upper left 20 x 20 pixels, to cPixArray[]: */ rcBlock.top = rcBlock.left = 0; rcBlock.bottom = rcBlock.right = 20; /* 20x20 area, 400 pixels */ nErrcount = IG_image_dimensions_get ( hIGear, &nWid, &nHi, &nBpp ); */ if ( nErrcount == 0 ) /* If valid image, dimensions obtained: */ { if ( (nBpp <= 8) && (nWid >= 20) && (nHi >= 20) ) { /*Array is too small for 24-bit) */ INT row, col; pix; /* For the loops below */ AT_PIXEL nPixval; /* pixel value to set */ if (nBpp == 8) nPixval = 128; /* Value to set if 8-bit */ if (nBpp == 4) nPixval = 8; /* Value to set if 4-bit */ if (nBpp == 1) nPixval = 1; /* Pixel ON if 1-bit */ for ( pix=0,row=0; row<20; row++ ) /* For all pixels in */ for ( col=0; col<20; col++ )/* the 20 x 20 array: */ cPixelArray[pix++] = nPixval; /* Set unpacked in byte */ nErrcount = IG_DIB_area_set ( hIGear, &rcBlock, &cPixelArray[0], IG_DIB_AREA_UNPACKED ); } } |
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.
See also function IG_DIB_area_get().