ImageGear for C and C++ on Linux v18.10 - Updated
IG_initialize
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Linux Initialize and Close Functions > IG_initialize

This function initializes the ImageGear library and must be called before any other ImageGear function is used.

The first parameter is a pointer to the X Windows display obtained from calling XOpenDisplay() (or equivalent). Set the display parameter to NULL if your application does not display any images, or use X Window System capabilities.

Use the second parameter, nColors, to specify the number of colors that ImageGear should allocate for PseudoColor displays. Normally, you set this number to 256.

Declaration:

 
Copy Code

AT_ERRCODE IG_initialize(
     LPVOID lpDisplay,
     UINT nColors,
     LPVOID lpPrivateColormap
);

Arguments:

Name Type Description
lpDisplay LPVOID X Windows display pointer or NULL.
nColors UINT The number of colors to allocate for PseudoColor displays.
lpPrivateColormap LPVOID This argument currently isn’t used, but is reserved for future use. Must be set to NULL for now.

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

This function does not process image pixels.

Example:

The use of this depends upon whether the program has a display or not. The first example program has a display; the second does not:

 
Copy Code

/* Initialize ImageGear */
nErrCount = IG_initialize(display, 256, NULL);
/* Initialize ImageGear with no display */
nErrCount = IG_initialize(NULL, 0, NULL);

Sample:

ImageGearDemo

See Also:

IG_close()