[comp.windows.x] Visual help needed.. Multi-plane as a Monochrome

jim@athsys.uucp (Jim Becker) (09/13/88)

  
I know that this topic has been bandied about for a time, but I'm
having problems which I don't remember being discussed...

I am trying to get some Monochrome code working on Color, and am
having some problems trying to find/use a Visual of depth one on the
color machine. All the visuals are of depth eight, which is the extent
of the color planes.

My code currently wants to create stuff in Monochrome, and doesn't
behave correctly with the GC PlaneMask set to one.  I would like to
create my base windows with a depth of one, so all the other code
should work ok.

If I use all eight planes my XImages and Pixmaps don't show up, as
well as tiles and text. In short, only lines seem to be working !!

The original system I am using is a Sun 3/50, with the current target
being a VAXstation II/GPX w/ 16mb memory. The intended target machine
will be a Sumitomo Color system (don't know the flavor yet).


Any help would be appreciated -- I got real work yet to do!!

jim@EXPO.LCS.MIT.EDU (Jim Fulton) (09/13/88)

If the display only supports depth 8 visuals, then you probably won't be able
to create any depth 1 windows.

You'll need to ask specific questions.  Some things to watch out for, though:

     o  avoid any GX function other than GXcopy unless you really know what
	you're doing; one exception is inverting between two colors (in simple
	menus, for example):  set the foreground value in the GC to be the
	xor of the two colors and set the function to be GXxor.  Doing a 
	filled rectangle over an area made of up of those two colors will
	appear to toggle them.  But, if any other other colors get in the way
	you'll get trash.

     o  be cautious of thing that requires setting the planemask to any value
	besides AllPlanes; unless you have allocated planes, you're probably
	doing something wrong.

     o  stipples are single plane; tiles (backgrounds, borders, etc.) are
	multi-plane.

     o  when creating a pixmap from single plane (e.g. "bitmap") data, use
	XCreatePixmapFromBitmapData; this will be easier in R3 as there will
	a library of miscellaneous utility routines that will include a call
	for reading bitmap data from files.  Until then:

     o  if you have a bitmap (i.e. single-plane pixmap) that you need to turn 
	into a two color, multi-plane pixmap, create a scratch GC with 
	foreground and background set to the appropriate colors and 
	graphics_exposures set to False; create a pixmap of the appropriate
	size using XCreatePixmap; then, do an XCopyPlane from the bitmap
	to the pixmap and free the scratch GC.

     o  make no assumptions about what value BlackPixel and WhitePixel have.


Obviously, there are exceptions to each of the above.  Caveat hactor.


Jim Fulton
MIT X Consortium