Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!lll-winken!lll-crg.llnl.gov From: chapman@lll-crg.llnl.gov (Carol Chapman) Newsgroups: comp.windows.x,ba.windows.x,llnl.x Subject: need help with garbaged pixmap--already read FAQ Summary: works fine on my workstation, doesn't on others Keywords: X11R4, Motif 1.1, VMS Message-ID: <96982@lll-winken.LLNL.GOV> Date: 9 May 91 01:35:41 GMT Sender: usenet@lll-winken.LLNL.GOV Followup-To: comp.windows.x Organization: Livermore National Laboratory Lines: 83 Nntp-Posting-Host: lll-crg.llnl.gov I am having a problem displaying rotated text as a pixmap. All works just fine on my workstation, but when I display my program on other work- stations (same architecture -- DEC 3100) the pixmap shows up as solid black. I read the FAQ re. garbaged pixmaps by Dave Lemke, and as far as I can tell, the enclosed code (which was written by Chris Craig) follows all of Lemke's suggestions. I really don't want to force the background to be a specific color, so I'm hoping one of you netters can tell me what's wrong and how to fix it. thanx in advance for any and all suggestions, carol P.S. My workstation is running VMS 5.3 while the others are running VMS 5.4, if that makes a difference. /**********************************************************************/ static void Rotate(dpy, d, gc, t) Display *dpy; Drawable d; GC gc; AtText *t; { Pixmap pixmap; XImage *image; XWindowAttributes wa; GC localgc; char *data; int i,j; unsigned long foreground; unsigned long background; int w,h; /* width, height */ . . . localgc = XCreateGC(dpy, d, 0L, NULL); XCopyGC(dpy, gc, GCFunction | GCPlaneMask | GCForeground | GCBackground | GCSubwindowMode | GCFillStyle | GCTile, localgc); /* * create a pixmap the size of the unrotated text * clear the pixmap to the background color * draw the text into it unrotated * get the text as an unrotated image * Since everything is unrotated, use w and h backwards */ pixmap = XCreatePixmap(dpy, d, h, w, wa.depth); foreground = gc->values.foreground; background = gc->values.background; XSetForeground(dpy,localgc,background); XFillRectangle(dpy,pixmap, localgc, 0,0,h,w); XSetForeground(dpy,localgc,foreground); Draw(dpy, pixmap, localgc, t->parsed, 0,t->parsed->ascent); image = XGetImage(dpy, pixmap, 0,0, h, w, AllPlanes, XYPixmap); /* * allocate enough memory for the rotated image * create the image. */ data = (char *)malloc(wa.depth * h * (w + 7)/8); t->rotated_image = XCreateImage(dpy, wa.visual, wa.depth, XYPixmap,0, data, w, h, 8, (w+7)/8); /* * rotate the image */ for(i=0; i < h; i++) for(j=0; j < w; j++) XPutPixel(t->rotated_image, j, h-i-1, XGetPixel(image, i,j)); t->rotated_depth = wa.depth; XDestroyImage(image); XFreePixmap(dpy, pixmap); XFreeGC(dpy, localgc); } Carol Chapman Tel. (415) 423-7876 Livermore National Laboratory NEW --> chapman@.llnl.gov P. O. Box 808, L-572 "Are you in charge here?" Livermore, CA 94550 "No, but I'm full of ideas!" -- Dr. Who