[comp.windows.open-look] Creating a 8-bit server image

chuck@trantor.harris-atd.com (Chuck Musciano) (11/22/90)

     Given a 1-bit pixmap, I need to create an 8-bit server image.  I did:

	Server_image	result;
	Pixmap		temp;
	XGCValues	gc_val;
	GC		gc;
	Display		*display;

	result = xv_create(NULL, SERVER_IMAGE,
			      XV_WIDTH, 16,
			      XV_HEIGHT, 16,
			      SERVER_IMAGE_DEPTH, window_depth,
			   NULL);
	display = (Display *) xv_get(librarian_base_frame->base_frame, XV_DISPLAY);
	temp = XCreatePixmap(display, xv_get(librarian_base_frame->base_frame, XV_XID), 16, 16, window_depth);
	gc_val.foreground = BlackPixel(display, DefaultScreen(display));
	gc_val.background = WhitePixel(display, DefaultScreen(display));
	gc = XCreateGC(display, temp, GCForeground | GCBackground, &gc_val);
	XCopyPlane(display, pixmap, temp, gc, 0, 0, 16, 16, 0, 0, 1);
	xv_set(result, SERVER_IMAGE_PIXMAP, temp, NULL);
	XFreeGC(display, gc);
	return(result);

The resulting Server_image has depth 0, obviously wrong.  If I do the same
operation, but just create and use a 1-bit deep server image, it works fine.
What am I doing wrong?  Is there a bug creating deep server images this way?

-- 

Chuck Musciano				ARPA  : chuck@trantor.harris-atd.com
Harris Corporation 			Usenet: ...!uunet!x102a!trantor!chuck
PO Box 37, MS 3A/1912			AT&T  : (407) 727-6131
Melbourne, FL 32902			FAX   : (407) 729-2537

A good newspaper is never good enough,
	but a lousy newspaper is a joy forever.		-- Garrison Keillor