🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.x
Article #24318

Re: Changing the background of a pixmap

#24318
From: Akkana Peck
Date: Thu, 21 Jan 1993 18:00
41 lines
2518 bytes
[Several people ask for a way to change the background of a pixmap]

In article <1993Jan21.180752.10676@gecko.uucp> lanzo@tekelec.com (Mark Lanzo) writes:
>The answer basically is "you can't do it right now".
>The problem is that the symbols are Pixmaps which just happen to be
>initially generated from bitmaps using the foreground and background
>color, but once they are created they remain intact.
>
>For most cases this makes sense.  If you had installed your own multi-color
>pixmap, you certainly wouldn't want the widget suddenly altering some
>pixels in the pixmap just because they happened to coincide with the 
>widget's foreground or background colors.

But there's a case which seems to come up quite often: a multi-color
pixmap where you want the background (the area outside the pixmap) to be
the same as the background of the parent widget/window, but you want the
rest of the pixmap to retain its own colors.

In Xlib, this is quite easy to do: make a bitmap containing the mask of
the shape (everything in the pixmap that you don't consider
"background"), then every time you draw the pixmap, first do an
XSetClipMask() with that bitmap.

In Motif, it's harder -- you can do Xlib drawing onto a DrawnButton or
DrawingArea, but if you want to use a Label or ToggleButton and use
XmNlabelPixmap, you're out of luck.

Of course, if you only want to change the background *once* before you
draw the pixmap the first time, that's easy too: figure out what the
current background color is, turn the pixmap into an Image and loop over
it changing the background color to the new color, then turn it back into
a pixmap.

>Sounds like an enhancement request to me ... 

Seems to me that it would be very useful for Motif labels to offer an
XmNlabelMask as well as XmNlabelPixmap.  For Xlib, I don't see that any
enhancement is necessary (though a more standard format for file storage
of color pixmaps would be a godsend!)

	...Akkana       akkana@netcom.com
Technical Details
Message-ID: <1jmoblINN7bt@fido.asd.sgi.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!sgigate!odin!fido!moab.wpd.sgi.com!akkana
References: <ALSAGGAF.93Jan13171926@e40-008-4.mit.edu> <1993Jan19.201957.21870@pilot.dmg.ml.com> <1993Jan21.180752.10676@gecko.uucp>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!olivea!sgigate!odin!fido!moab.wpd.sgi.com!akkana
From: akkana@moab.wpd.sgi.com (Akkana Peck)
Newsgroups: comp.windows.x
Subject: Re: Changing the background of a pixmap
Message-ID: <1jmoblINN7bt@fido.asd.sgi.com>
Date: 21 Jan 93 18:00:21 GMT
References: <ALSAGGAF.93Jan13171926@e40-008-4.mit.edu> <1993Jan19.201957.21870@pilot.dmg.ml.com> <1993Jan21.180752.10676@gecko.uucp>
Organization: Silicon Graphics, Inc., Mountain View, CA
Lines: 41
NNTP-Posting-Host: moab.wpd.sgi.com