Path: utzoo!attcan!uunet!lll-winken!lll-tis!ames!mailrus!cornell!uw-beaver!mit-eddie!bloom-beacon!sol.UUCP!laurie From: laurie@sol.UUCP (Laurie Clow) Newsgroups: comp.windows.x Subject: (none) Message-ID: <8806281731.AA01061@ws08.sag.uucp> Date: 28 Jun 88 17:31:40 GMT Sender: daemon@bloom-beacon.MIT.EDU Organization: Science Applications International Corporation Lines: 53 I have a problem with the clip_mask of the graphics context. First I create a window of depth 8, and two bitmaps. One is the size of the window and the other is a small bitmap containing a symbol. I also create a standard graphics context for writing to the window and a second graphics context for writing to the large bitmap. The foreground of the bitmap graphics context is 1 and the background is 0. I have a loop which notices ButtonPressed events then draws the symbol onto the window. It copys the symbol bitmap to the large bitmap at the location of the event then uses the large bitmap as a clip mask for a XFillRectangle to the window. Just before the XFillRectangle call I reset the foreground color to red, the clip_origin to 0,0 and the clip_mask to the large bitmap. This works correctly the first time I try to draw the symbol but nothing is drawn onto the window after that. If I change the clip_mask to None and fill in the rectangle where the symbol would be the fill rectangle is done correctly each time. I called XGetImage just before the XFillRectangle call to see the data in the large bitmap at the area where the symbol should be drawn. It appeared to be correct every time. I would like to know why the program is acting as though the large bitmap was clear after the first time that it was used. This is the initialization code for the drawables and graphics contexts w_id = XCreateWindow( display, w_parent, 0, 0, w_width, w_height, 0, DefaultDepth( display, screen ), InputOutput, DefaultVisual( display, screen ), 0, NULL ); m_id = XCreatePixmap( display, w_id, w_width, w_height, 1 ); s_id = XCreatePixmap( display, w_id, s_width, s_height, 1); values.function = GXclear; values.foreground = 1; values.background = 0; clip_gc = XCreateGC( display, w_id, 0, NULL ); solid_gc = XCreateGC( display, m_id, GCForeground | GCBackground, &values); clear_gc = XCreateGC( display, m_id, GCFunction, &values ); This is the code which is called at every button_pressed event XFillRectangle( display, m_id, clear_gc, 0, 0, w_width, w_height ); XCopyPlane( display, s_id, m_id, solid_gc, 0, 0, s_width, s_height, event->x, event->y, 1 ); gc_values.foreground = RED; gc_values.clip_x_origin = 0; gc_values.clip_y_origin = 0; gc_values.clip_mask = m_id; XChangeGC( display, clip_gc, GCForeground | GCClipXOrigin | GCClipYOrigin | GCClipMask, &gc_values ); XFillRectangle( display, w_id, clip_gc, 0, 0, w_width, w_height ); Laurie Clow UUCP: {ucbvax!ucsd,seismo}!esosun!sol!laurie ARPA: esosun!sol!laurie@seismo.css.gov