russ@DASH.MITRE.ORG (Russell Leighton) (11/07/89)
In xnews, `readcanvas' scales the images to the unit square. Given this how do I find out what the actual size of the canvas is? I cannot use `getcanvasshape pathbbox' because it will return 0 0 1 1. Russ. ARPA: russ@dash.mitre.org Russell Leighton MITRE Signal Processing Lab 7525 Colshire Dr. McLean, Va. 22102 USA
rxb@ASC.SLB.COM (Rafael Bracho) (11/08/89)
Regarding Russell Leighton's request: >In xnews, `readcanvas' scales the images to the unit square. >Given this how do I find out what the actual size of >the canvas is? I cannot use `getcanvasshape pathbbox' >because it will return 0 0 1 1. Do the following (assume can is the result of readcanvas): gsave can setcanvas 1 1 dtransform abs exch abs grestore The result will be the width and height of the canvas. Note that I used the undocumented (at least in the pre-FCS documentation) function 'abs' in both numbers although only the height will be negative. This is because I don't know if NeWS 3.0 will have its internal origin in the upper right hand corner, due to some X.12 requirements. {:-) Rafael Bracho rxb@asc.slb.com
russ@dash.mitre.org (Russell Leighton) (11/08/89)
Thanks for your response: >In xnews, `readcanvas' scales the images to the unit square. >Given this how do I find out what the actual size of >the canvas is? I cannot use `getcanvasshape pathbbox' >because it will return 0 0 1 1. Do the following (assume can is the result of readcanvas): gsave can setcanvas 1 1 dtransform abs exch abs grestore The result will be the width and height of the canvas. Note that I used the undocumented (at least in the pre-FCS documentation) function 'abs' in both numbers although only the height will be negative. This is because I don't know if NeWS 3.0 will have its internal origin in the upper right hand corner, due to some X.12 requirements. {:-) Rafael Bracho rxb@asc.slb.com This is another response I got: Try something like this: readcanvas % c dup % c c setcanvas % c initclip clippath pathbbox % c x y w h This works under 1.1, but not under xnews. In fact, it causes a horrible crash under a beta version of xnews. Instead, use the new call, getbbox: readcanvas dup % c c false getbbox % c x y w h John Martin Philips Labs jcm@philabs.philips.com tel (914) 945-6406 Russ.