Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uwm.edu!lll-winken!sun-barr!ccut!titcca!secisl!urushima From: urushima@secom.co.jp (Kenji Urushima) Newsgroups: comp.windows.x Subject: Please show me some applications by "XPM" utility. Message-ID: Date: 8 Aug 90 06:54:43 GMT Sender: news@secisl.secom.co.jp Distribution: comp Organization: SECOM Intelligent Systems Laboratory, Japan. Lines: 84 Dear Xperts, Some XPM file utilities by GROUPE BULL was posted in this news group before. XPM Read/Write Package for XPM file format: - int XWritePixmapFile(dpy, cmap, filename, pixmap, w, h); - int XReadPixmapFile(dpy, d, cmap, filename, w,h, depth,pixmap); - Pixmap XCreatePixmapFromData(dpy, d, cmap, w, h, depth, n, c, col, pix); So, I'm trying to make a application program which shows XPM file on display, but this doesn't work. The source code is below. Something wrong with this program ? Would you show me any ideas you have, or show me any XPM application program ? Thanks in advance, Kenji. ----- Kenji Urushima urushima@secom.co.jp (Japan) SECOM, 6-11-23 Shimorenjaku, Mitaka-si urushima%secom.co.jp@uunet.uu.net (USA) Tokyo 181 Japan. TEL +81-422-44-9912 urushima%secom.co.jp@mcvax.uucp(Europe) --------------- cut here ------------ xshowpixmap.c ------------------------- /* * xshowpixmap - show pixmap file * % cc xpm.c xshowpixmap.c -o xshowpixmap -lXaw -lXt -lX11 * * xpm.c - Read/Write Pixmap File Utility */ #include #include #include #include void main(argc, argv) int argc; char **argv; { Widget toplevel, w; Arg args[10]; Pixmap iconPixmap; unsigned int iconWidth, iconHeight; int iconXhot, iconYhot; toplevel = XtInitialize(NULL, "Bitmap", NULL, 0, &argc, argv); if( argc != 2) { fprintf(stderr, "Usage: %s bitmap_file\n", argv[0]); exit(1); } XReadPixmapFile(XtDisplay(toplevel), XtWindow(toplevel), DefaultColormap(XtDisplay(toplevel), XtWindow(toplevel)), argv[1], &iconWidth, &iconHeight, (int)DefaultDepth(XtDisplay(toplevel), XtWindow(toplevel)), &iconPixmap); XtSetArg( args[0], XtNbackgroundPixmap, iconPixmap ); XtSetArg( args[1], XtNwidth, iconWidth ); XtSetArg( args[2], XtNheight, iconHeight ); w = XtCreateManagedWidget(argv[0], widgetClass, toplevel, args, 3); XtRealizeWidget(toplevel); XtMainLoop(); }