ImageGear for C and C++ on Linux v20.0 - Updated
Load and Display an Image
User Guide > Getting Started > Samples > Load and Display an Image

The Filters sample is a fully functional Motif-based GUI sample that demonstrates all major operations that can be accomplished using ImageGear. This section provides information about how to display an image with the most common parameters by invoking just two ImageGear functions.

Although all ImageGear functions are based on pure Xlib and XToolkit capabilities and do not require additional libraries, the Filters sample uses Motif 1.2 libraries to demonstrate several advanced ImageGear functions. Motif can be found at

According to the Motif programming concept, a Callback function, wndDrawImage_callback, in the filters.c module is called every time a window must be updated. The IG_dspl_update_rect_set() function passes a pointer to a structure with information that is part of the window to ImageGear. After that, IG_dspl_image_draw() should be called to make the actual drawing in this area.

The following is a segment from the filters.c module that demonstrates this:

Copy Code

void wndDrawImage_callback( Widget w, XtPointer data, XtPointer call_data )
XmDrawingAreaCallbackStruct*cbs =
XExposeEvent*event = (XExposeEvent*)cbs->event;
/* Redisplay only on last event of the series */
if( IG_image_is_valid( hIGear ) )
/* Set the dirty rectangle for repaint */
UpdateRect.x = event->x;
UpdateRect.y = event->y;
UpdateRect.width = event->width;
UpdateRect.height = event->height;
IG_dspl_update_rect_set( hIGear, IG_GRP_DEFAULT, &UpdateRect );
/* Repaint window on expose events */
IG_dspl_image_draw( hIGear, IG_GRP_DEFAULT, XtWindow(w),
XDefaultGCOfScreen(XtScreen(w)), NULL );

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