greg@klg.UUCP ( KL Group Inc.) (01/07/91)
How are Xlib developers handling the problem of printing high-quality output of the images rendered on the display using Xlib? Ideally, I'd like a library with an API similar to Xlib, which would create a Postscript file. So when the user says "Print", the same sequence of Xlib calls which created the image on screen, would be "sent" to this library. The library would generate a Postscript file suitable for printing. Of course, this ideal library would have to deal with mapping X fonts to one of the available Postscript fonts. And it would have to deal with mapping from color to mono. And it would have to map from any arbitrary resolution to normalized Postscript coordinates. Does such a beast exist? Is anyone working on something like this? Grabbing a bitmap from the X Server and twisting it into a Postscript bitmap isn't good enough. As much as possible, I'd like to create resolution independent postscript from Xlib. TIA, Greg Kiessling - KL Group Inc. (416) 594-1026
mouse@larry.mcrcim.mcgill.EDU (01/09/91)
> How are Xlib developers handling the problem of printing high-quality > output of the images rendered on the display using Xlib? What do you mean when you say "images"? If you mean pictures like the famous mandrill picture, that's one thing. If you mean something like an xterm session, that's something else. If you mean arbitrary X graphics, that's yet another thing. > Ideally, I'd like a library with an API similar to Xlib, which would > create a Postscript file. (Why do you assume that "[i]deally", "printing" equals "PostScript"? See the last piece I quote below, and my response.) I rather suspect you are dreaming. The X and PostScript rendering models are sufficiently different that this will be extremely difficult at best. As a simple example, consider an X program that does the following: Clear a window to the background color, whatever that is. Create a GC whose function is GXxor and whose foreground color is the XOR of the app's foreground and background. Draw a short fat rectangle with this GC. Draw a tall skinny rectangle, overlapping the other one, with the same GC. Now, what PostScript code do you propose the library generate? Of course, you could always implement some subset, perhaps those things that can be done easily in both X and PostScript. I suspect you will find that such a library is too weak to be useful for very much. (I may be wrong. Anybody actually tried it?) In short, X is a pixel-based model. PostScript bends over backwards to avoid any hint of being pixel-based, and does a fairly thorough job of it. Of course you'll have problems! > The library would generate a Postscript file suitable for printing. A real trick when the printer speaks only Impress :-) der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu
fgreco@govt.shearson.COM (Frank Greco) (01/10/91)
> > How are Xlib developers handling the problem of printing high-quality > output of the images rendered on the display using Xlib? > > Ideally, I'd like a library with an API similar to Xlib, which would > create a Postscript file. So when the user says "Print", the same > sequence of Xlib calls which created the image on screen, would be > "sent" to this library. The library would generate a Postscript > file suitable for printing. > > Of course, this ideal library would have to deal with mapping X fonts > to one of the available Postscript fonts. And it would have to deal > with mapping from color to mono. And it would have to map from any > arbitrary resolution to normalized Postscript coordinates. > > Does such a beast exist? Is anyone working on something like this? > > Grabbing a bitmap from the X Server and twisting it into a Postscript > bitmap isn't good enough. As much as possible, I'd like to create > resolution independent postscript from Xlib. 1.) I would assume that in your repaint procedure(s) you traverse some sort of display data structure (e.g., tree, list) using Xlib fn's to draw. If "print" is requested, you would have to traverse your data structure, producing Postscript primitives instead of Xlib... That's the "easy" part (at least for vector-style drawing) however, rendering resolution-independent fonts is going to be very problematic for *true* WYSIWIG-stuff. 2.) If you're running on OpenWindows, you can use the NeWS wire service in an XView canvas to send NeWS/PS snippets to do all your on-screen drawing. Then, with a very small amount of NeWS/PS pgming, you send the same sequence to a Postscript printer (or NeWSprinter). Mapping from color to mono is straightforward in this suggestion. 3.) If you have the Display Postscript extension on your X server...see #2 Frank G.