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

This function calculates and returns the number of bytes required to hold a rectangular region selected from an image.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_DIB_area_size_get(
        HIGEAR hIGear, 
        LPAT_RECT lpRect, 
        AT_MODE nFormat, 
        LPAT_DIMENSION lpSize
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
lpRect LPAT_RECT A far pointer to a rectangular array of pixels from the image. Setting this to NULL selects the whole image.
nFormat AT_MODE A variable of type AT_MODE, such as IG_DIB_AREA_DIB, that defines how the data should be stored: packed or unpacked. (They are defined in accucnst.h)
lpSize LPAT_DIMENSION A far pointer to a variable that returns the size in bytes of the array of pixels.

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

Remarks:

You can use this function to determine the size of the block of memory to allocate to hold the pixel values from the rectangular region. This will help you to avoid data overflow. The value returned by lpSize includes the allocation of space for raster buffering at the end of each raster line. (See the section Device-Independent Bitmaps (DIB)Understanding Bitmap Images.)

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.

Use the format parameter to indicate the form in which you want to store the pixels:

Use: To:
IG_DIB_AREA_DIB Pad rows to long boundaries (the way they are stored in a DIB).
IG_DIB_AREA_UNPACKED Store pixels 1 per byte for 1, 4, 8-bit images, 1 per 3 bytes for a 24-bit image.