cs00wsc@unccvax.uncc.edu (Wen-Shiang Chin) (08/02/90)
Hi, I am using X11 and OFS/Motif to write graphics application. Is there any function available to set the viewport of a drawable. If not, can you suggest any good method to implement it. Thanks in advance. Wen S. Chin
mouse@LARRY.MCRCIM.MCGILL.EDU (08/10/90)
> I am using X11 and OFS/Motif to write graphics application. Is there > any function available to set the viewport of a drawable[?] "Actually, it's kind of hard to say." What's a viewport? If you mean what I suspect you mean (the ability to specify an arbitrary rectangle in some "virtual" coordinate space, which gets translated-&-scaled to fit the actual window), no, X does not even have such a notion. > If not, can you suggest any good method to implement it. Well, gee, you could always keep a handful of variables around and do the scaling yourself. It's a little tedious - you need to provide a "virtual" version of each of the X drawing routines you use - but I see no reason why it wouldn't be perfectly workable. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu
jimf@SABER.COM (08/10/90)
|Well, gee, you could always keep a handful of variables around and do |the scaling yourself. It's a little tedious - you need to provide a |"virtual" version of each of the X drawing routines you use - but I see |no reason why it wouldn't be perfectly workable. If you build yourself a library that implements a retained graphics environment (ie it remembers shapes and their orientations until you destroy them) it's not too tedious, and the application will become simpler to boot. When porting a large application from SGI GL to X11 a couple of years ago, we did exactly that. This technique has other advantages -- you only need to tune one area to make painting or repainting faster, or to fix weirdnesses in the X rendering model. With only a fair amount of effort we managed to get almost-reasonable rendering of screens with 100,000+ shapes (`shape' meant text, lines, ellipses, rectangles, and polygons -- but mostly ellipses and polygons) on a color Sun 386i/250 under X11R2. Repair times were very fast, and having the objects in local structures meant that implementing `pick' was easy and had good performance even on that dog of a machine. An added bonus is that porting such a library to other graphical environments is a snap. We ported the above mentioned library from X11R2 to SGI GL in well under a day and tuned it in less than a week. jim frost saber software jimf@saber.com