ImageGear for C and C++ on Windows v20.0 - Updated
IG_image_create
API Reference Guide > Core Component API Reference > Core Component Functions Reference > General Image Functions > IG_image_create

This function creates a new image according to DIB information stored in a DIB info object.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_image_create(
       HIGDIBINFO hDIB,
       HIGEAR* lphIGear
);

Arguments:

Name Type Description
hDIB HIGDIBINFO DIB info object with parameters used to create image.
lphIGear HIGEAR* Returned HIGEAR handle of created image.

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

Timing, MFC PDFDemo

Example:

 
Copy Code
    // Create a new image with the same parameters as an existing image
    AT_ERRCOUNT nErrcount;  // Number of errors on stack
    HIGEAR hIGear;          // Handle of image
    HIGDIBINFO hDIB;        // DIB info handle of image
    HIGEAR hIGearCreated;   // Handle of created image

    // Load image file "picture.bmp" from working directory
    nErrcount = IG_load_file("picture.bmp", &hIGear);
    if(nErrcount == 0)
    {
        // Get DIB info of the existion image
        // DIB info can be also created and filled in manually
        nErrcount = IG_image_DIB_info_get(hIGear, &hDIB);
        if(nErrcount == 0)
        {
            nErrcount = IG_image_create(hDIB, &hIGearCreated);
            // Destroy DIB info 
            IG_DIB_info_delete(hDIB);
            // ...
            // Destroy the image
            IG_image_delete(hIGearCreated);
        }
        // Destroy the source image
        IG_image_delete(hIGear);
    }

Remarks:

Pixel data is allocated and initialized to black.

Is this page helpful?
Yes No
Thanks for your feedback.