[comp.windows.x] Pixmaps

stan@b17b.INGR.COM (stan) (06/07/90)

I need to create a pair of pixmaps( sensitive and insensensitive) for a Motif 
button.  The second pixmap will be just like the first, except it should be 
stippled using the background color.  To accomplish this, I am calling 
XCreatePixmapFromBitmapData twice, with the same data.  Then I call 
XFillRectangle with the appropriate gc to stipple the second pixmap.

I think I should be able to copy the first pixmap to the second 
( using memcpy or some other low level routine ) and then call XFillRectangle
on the new pixmap.  The problem here is I don't really know how much memory
the pixmap occupies.

It has also been suggested that I use XCreatePixmap and XCopyArea to create 
the second pixmap.  

Does anyone know which of these (or any other) methods would be faster?

--
      _____________________________________________________________________
     /				       \				   /
    /   Stan Hardy 			\  Disclaimer:          	  /	
   /   Intergraph Corporation            \  This is only an exhibition,  /
  /   Phone : (205) 730-1346	          \  not a competion.  Please,  /  
 /   Mail  : ..!uunet!ingr!b17c!c120g!stan \  no wagering.  	       /
/___________________________________________\_________________________/

mouse@LARRY.MCRCIM.MCGILL.EDU (der Mouse) (06/09/90)

> I need to create a pair of pixmaps( sensitive and insensensitive) for
> a Motif button.  The second pixmap will be just like the first,
> except it should be stippled using the background color.  To
> accomplish this, I am calling XCreatePixmapFromBitmapData twice, with
> the same data.  Then I call XFillRectangle with the appropriate gc to
> stipple the second pixmap.

That's perfectly reasonable, though as you imply you've noticed,
slightly inefficient (very inefficient if the thing is large).

> I think I should be able to copy the first pixmap to the second (
> using memcpy or some other low level routine ) and then call
> XFillRectangle on the new pixmap.  The problem here is I don't really
> know how much memory the pixmap occupies.

There is a much more serious problem: in general, you, the client, do
not have access to the memory occupied by the pixmap.  All you have is
an ID by which you identify the pixmap to the server in X requests.  (I
said "in general" because someone probably has a system where the
client and server can use shared memory if they're on the same machine.)

> It has also been suggested that I use XCreatePixmap and XCopyArea to
> create the second pixmap.

This is a much better way of doing it.  It's the method I'd recommend.
(Ie, XCreatePixmapFromBitmapData, XCreatePixmap, XCopyArea,
XFillRectangle (plus some GC setup calls).)

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

bouguett@boulder.Colorado.EDU (Athman Bouguettaya) (06/11/90)

This question might have been asked before but I spent a fair
amount of time trying to figure out how I could use a pixmap 
directly to set for instance the background of a window.  I copied
the gif file from an ftp site.  I then used giftoxwud to get an x
dump.  I then used the xwudtoppm to get a pixmap.  One more thing,
The X manuals I have do not have anything about reading a Pixmap.
Thank you in advance for your help.

-Athman

kucharsk@number6.Solbourne.COM (William Kucharski) (06/11/90)

In article <22090@boulder.Colorado.EDU> bouguett@boulder.Colorado.EDU (Athman Bouguettaya) writes:
 >This question might have been asked before but I spent a fair
 >amount of time trying to figure out how I could use a pixmap 
 >directly to set for instance the background of a window.  I copied
 >the gif file from an ftp site.  I then used giftoxwud to get an x
 >dump.  I then used the xwudtoppm to get a pixmap.  One more thing,
 >The X manuals I have do not have anything about reading a Pixmap.
 >Thank you in advance for your help.
 >
 >-Athman

Ppm format within the pbmplus utilities is NOT an X pixmap format but a
P)ortable P)ixM)ap format.  You have to use some type of utility to convert
data from the ppm format into an X format.  Unfortunately there is no current
standard X pixmap file format, but I believe there is work going on to create
one.
--
===============================================================================
| Internet:   kucharsk@Solbourne.COM	      |	William Kucharski             |
| uucp:	...!{boulder,sun,uunet}!stan!kucharsk |	Solbourne Computer, Inc.      |
= The opinions above are mine alone and NOT those of Solbourne Computer, Inc. =