 Re: XCopyPlane Question
In-Reply-To: 's message of 14 Apr 1993 15:19:05 -0400
Organization: Kubota Pacific Computer Inc.
Lines: 88

> 
> I am trying to use XCopyPlane to copy a single plane 
> from a depth-8 pixmap to a depth-1 pixmap.  Everytime I
> try this, I see absolutely nothing displayed.  I know there
> is data in the depth-8 pixmap becuase I have checked by doing
> an XCopyArea to the screen.
> 
> I have been successful getting XCopyPlane to work if I use
> two pixmaps of depth-8.  Is there a problem with what I am
> trying to do??
> 
> Could someone please scan my code segment and let me know
> where I am going wrong...
> 
> I have created a XmDrawingArea widget called canvas. 
>  
>     w_id = XtWindow;
>     display = XtDisplay;
>     screen = DefaultScreen ;
>     pixmap8 = XCreatePixmap (display, RootWindow ,
>                     w_width, w_height, DefaultDepth );
>     pixmap1 = XCreatePixmap (display, RootWindow ,
>                     w_width, w_height, 1);
> 
>     w_gc8 = XCreateGC ;
>     w_gc1 = XCreateGC ;
> 
> --> Code to read xwd image into pixmap8 is omitted <----
> 

Have you set the foreground and background colors in w_gc1 to 
something other than 0 and 1?  The WhitePixel and BlackPixel macros
on your server may not return values suitable for depth 1 drawables.


>     /* Copy one plane into the depth-1 pixmap */
>     XCopyPlane ;
> 

Are you sure that the fifth plane of the data isn't all the same?  You could
have different pixel values in the image, but the fifth plane 
might all be the same value?


>     /* Using the depth-1 pixmap as the clipmask, copy it to the screen */
>     values.foreground = fg_color;
>     values.clip_x_origin = 0;
>     values.clip_y_origin = 0;
>     values.clip_mask = pixmap1;
>     mask = GCForeground | GCClipMask;
>     XChangeGC ;
> 
>     XFillRectangle ;
> 


If you just want to see the plane of data and want better performance,
don't use ClipMasks, just use pixmap1 as the stipple in a stippled
rectangle fill.  Many servers are very stupid about handling complex
clip lists, and turn a bitmap clip region into hundreds and hundreds of
little clipping rectangles, and clips every drawing primitive against every
one of these little triangles.


Actually, I must also ask the FAQ's #1 most popular reason why graphics
don't show up: do you wait for an expose event before drawing your
rectangle?



> Other Info:  X11R5 Patchlevel 10
>              Motif 1.2.1
>              Sun Sparc2 running SunOS 4.1.1
>              
> 
> Thanks in Advance!
> 
>  ----------------------------------------------------------------
>  Nancie P. Marin      NET:  
>  ENSCO Inc.           MAIL: 445 Pineda Ct.  Melbourne, Fl.  32940
>  254-4122        FAX:  254-3293
>  ----------------------------------------------------------------
--
Kenneth Whaley			  748-6347
Kubota Pacific Computer, Inc.	 Email: 
2630 Walsh Avenue
Santa Clara, CA.  95051
