------------------------------------------------------------------------------- Problems with Drawing Icons (bitmaps) under X windows The best source of X image handling is probably by example... See the source to the Xt widget I created for the XbmBrowser program. The Widget is called IconLabel and consists of three source files IconLabel.c IconLabel.h and IconLabelP.h Get it from the XbmBrowser sources... http://www.cit.gu.edu.au/~anthony/software/xbmbrowser5.1b.tar.gz The Changes file in these sources is probably your best source of info, as it details the trials and tribulations I when though to work out the handling of the images. The biggest problems was with bitmaps on monocrome displays.... =======8<-------- * On monocrome displays, the label widget can NOT tell the difference between a pixmap which has the colors assigned to it, and a bitmap which needs to be assigned the foreground and background colors. Both have the same number of bit planes in the image. As such on some monocrome displays (such as NCDs and Linix machines) pixmaps are inverted when displayed by the Xaw label widget. :-( =======8<-------- The IconLabel widget solves this with a "is_bitmap" resource option which specifies if the given image on a monocrome display is a pixmapl (which has had the black na dwhite colors assigned) or a raw bitmap (which is just foreground and background patterns, and may need to be inverted to convert those values to black and whiote colors). That is use different functions to draw image as a pixmap (already containing the colors to use) or a bitmap which uses the foreground and background color resources in the drawing process. =======8<--------CUT HERE----------axes/crowbars permitted--------------- if ( ilwp->is_bitmap && ilwp->pm_depth == 1 ) { /* is it a bitmap */ XCopyPlane(XtDisplay(w), ilwp->pixmap, XtWindow(w), gc, 0, 0, (int)ilwp->pm_rect.width, (int)ilwp->pm_rect.height, (int)ilwp->pm_rect.x, (int)ilwp->pm_rect.y, 1L ); } else { XCopyArea(XtDisplay(w), ilwp->pixmap, XtWindow(w), gc, 0, 0, (int)ilwp->pm_rect.width, (int)ilwp->pm_rect.height, (int)ilwp->pm_rect.x, (int)ilwp->pm_rect.y ); } =======8<--------CUT HERE----------axes/crowbars permitted--------------- -------------------------------------------------------------------------------