home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / windows / x / 18851 < prev    next >
Encoding:
Text File  |  1992-11-08  |  1.4 KB  |  42 lines

  1. Newsgroups: comp.windows.x
  2. Path: sparky!uunet!mcsun!sunic!ugle.unit.no!alf.uib.no!alf.uib.no!singg
  3. From: singg@alf.uib.no (Kurt George Gjerde)
  4. Subject: Load pixmap into pixmap
  5. Message-ID: <1992Nov7.142104.23123@alf.uib.no>
  6. Sender: usenet@alf.uib.no (Bergen University Newsaccount)
  7. Organization: University of Bergen, Norway
  8. Date: Sat, 7 Nov 92 14:21:04 GMT
  9. Lines: 31
  10.  
  11. I use the following code for loading a pixmap and drawing it inside
  12. another pixmap:
  13.  
  14.              userpixmap = XmGetPixmap(XtScreen(drawing_a),name,fg,bg);
  15.  
  16.              if (userpixmap==XmUNSPECIFIED_PIXMAP)
  17.                 reportError(drawing_a,"Can't find bitmap '%s'.",name,NULL,
  18.                             NULL,NULL);
  19.              else {
  20.  
  21.                 if (XGetGeometry(dpy,userpixmap, &d_root, &d_x, &d_y, &width,
  22.                              &height, &d_border_width, &d_depth)) {
  23.  
  24.                    image  = XGetImage(dpy, userpixmap, 0,0, width, height,
  25.                                        1, XYPixmap);
  26.  
  27.                    XPutImage(dpy,win, gc,image,0,0,posX,
  28.                              posY,image->width, image->height);
  29.                    XPutImage(dpy,pixmap, gc,image,0,0,posX,
  30.                              posY,image->width, image->height);
  31.  
  32.                    XFree(image);
  33.                 }
  34.                 XmDestroyPixmap(XtScreen(drawing_a),userpixmap);
  35.              }
  36.  
  37. Are there any faster ways to do this??
  38.  
  39.  
  40. Kurt.
  41.  
  42.