Article View: comp.lang.postscript
Article #4091Newbie PS questions
From: Eric W. Sink
Date: Fri, 13 Nov 1992 18:56
Date: Fri, 13 Nov 1992 18:56
57 lines
2915 bytes
2915 bytes
I'm just getting into PostScript (and enjoying it BTW). I'm just starting to think I understand BoundingBoxes, translate and scale, and coordinate systems. Here are a few questions and comments. Please let me know if I'm way off base. 1. Suppose my app reads in an EPS object, with the intent of integrating that object into a document. On faith, I believe that I can place that EPS object anywhere in my user coordinate space, at any size. My best guess for how to do this: gsave TX TY translate SX SY scale % insert actual EPS code here grestore In other words, by tacking a few lines just before and after the EPS code which I imported, I can size and place the graphic by just sticking it somewhere in the rest of the PS generated for my document. Is this right ? If so, how would I calculate TX and TY, SZ and SY ? I assume TX and TY are the location in coordinate space of the corner of the rectangle where I want to place the object. SX should be the width of the destination rectangle divided by the width of the bounding box as it appears in the EPS comment. SY is similar. Is this right ? 2. To better understand the translate and scale operators, I ask: Suppose you were writing a tiny subset PostScript interpreter, which supported only moveto, lineto, stroke, translate, and scale. How would you implement translate and scale? Each invocation of lineto and moveto adds to the current path. The coordinates which are added to that path are first modified by the CTM (HOW?). So, all I need to do in response to the translate and scale operators is to modify the CTM. Then, as moveto and lineto are used, they will modified through the CTM appropriately. 3. Is the following statement correct ? The %%BoundingBox comment in an EPS object has nothing to do with defining a coordinate system. It merely states the ranges of coordinates which will be used in the path construction operators within that object. The intent is that *applications* can read that comment and use it for its own calculations. The PS interpreter itself treats it like the comment it really is, and ignores it. Thanks in advance, -- Eric W. Sink, Spyglass | "You are the Pan." 1800 Woodfield Drive | - Rufio Savoy, IL 61826 | ---- e-sink@uiuc.edu ---------|---------- 217-355-6000 -----------------------
Technical Details
Message-ID:
<Bxo4MB.7rG@news.cso.uiuc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!fnnews.fnal.gov!mp.cs.niu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!ux2.cso.uiuc.edu!sinkShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!portal!lll-winken!fnnews.fnal.gov!mp.cs.niu.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!ux2.cso.uiuc.edu!sink From: e-sink@uiuc.edu (Eric W. Sink) Newsgroups: comp.lang.postscript Subject: Newbie PS questions Message-ID: <Bxo4MB.7rG@news.cso.uiuc.edu> Date: 13 Nov 92 18:56:30 GMT Sender: usenet@news.cso.uiuc.edu (Net Noise owner) Reply-To: e-sink@uiuc.edu Organization: University of Illinois at Urbana Lines: 57 Originator: sink@ux2.cso.uiuc.edu