home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / windows / x / 21421 < prev    next >
Encoding:
Internet Message Format  |  1993-01-21  |  2.4 KB

  1. Path: sparky!uunet!olivea!sgigate!odin!fido!moab.wpd.sgi.com!akkana
  2. From: akkana@moab.wpd.sgi.com (Akkana Peck)
  3. Newsgroups: comp.windows.x
  4. Subject: Re: Changing the background of a pixmap
  5. Message-ID: <1jmoblINN7bt@fido.asd.sgi.com>
  6. Date: 21 Jan 93 18:00:21 GMT
  7. References: <ALSAGGAF.93Jan13171926@e40-008-4.mit.edu> <1993Jan19.201957.21870@pilot.dmg.ml.com> <1993Jan21.180752.10676@gecko.uucp>
  8. Organization: Silicon Graphics, Inc., Mountain View, CA
  9. Lines: 41
  10. NNTP-Posting-Host: moab.wpd.sgi.com
  11.  
  12. [Several people ask for a way to change the background of a pixmap]
  13.  
  14. In article <1993Jan21.180752.10676@gecko.uucp> lanzo@tekelec.com (Mark Lanzo) writes:
  15. >The answer basically is "you can't do it right now".
  16. >The problem is that the symbols are Pixmaps which just happen to be
  17. >initially generated from bitmaps using the foreground and background
  18. >color, but once they are created they remain intact.
  19. >
  20. >For most cases this makes sense.  If you had installed your own multi-color
  21. >pixmap, you certainly wouldn't want the widget suddenly altering some
  22. >pixels in the pixmap just because they happened to coincide with the 
  23. >widget's foreground or background colors.
  24.  
  25. But there's a case which seems to come up quite often: a multi-color
  26. pixmap where you want the background (the area outside the pixmap) to be
  27. the same as the background of the parent widget/window, but you want the
  28. rest of the pixmap to retain its own colors.
  29.  
  30. In Xlib, this is quite easy to do: make a bitmap containing the mask of
  31. the shape (everything in the pixmap that you don't consider
  32. "background"), then every time you draw the pixmap, first do an
  33. XSetClipMask() with that bitmap.
  34.  
  35. In Motif, it's harder -- you can do Xlib drawing onto a DrawnButton or
  36. DrawingArea, but if you want to use a Label or ToggleButton and use
  37. XmNlabelPixmap, you're out of luck.
  38.  
  39. Of course, if you only want to change the background *once* before you
  40. draw the pixmap the first time, that's easy too: figure out what the
  41. current background color is, turn the pixmap into an Image and loop over
  42. it changing the background color to the new color, then turn it back into
  43. a pixmap.
  44.  
  45. >Sounds like an enhancement request to me ... 
  46.  
  47. Seems to me that it would be very useful for Motif labels to offer an
  48. XmNlabelMask as well as XmNlabelPixmap.  For Xlib, I don't see that any
  49. enhancement is necessary (though a more standard format for file storage
  50. of color pixmaps would be a godsend!)
  51.  
  52.     ...Akkana       akkana@netcom.com
  53.