[comp.lang.postscript] ESPF

mp1w+@ANDREW.CMU.EDU (Marc Russell Pawliger) (03/13/88)

In the documents from Adobe about ESPF they say that the %%BoundingBox must be
included in the prolog.  Do the lower-left and upper-right coordinates in the
comment refer to absoulte bounding coordinates, or are they `relocatable'?

If I have a 2" x 3" graphic, can I give the coordinates as (0,0) and (600,900)
[assuming 300 dpi], or do I have to give the coordinates where the graphic will
actually be drawn?  All the code for the graphic is relative-offset from the
current point anyway...


                        Thanks,
                            Marc

ted@mitre-bedford.ARPA (Edward J. Ede) (03/14/88)

In article <AWCMg=y00hcqQ99lNJ@andrew.cmu.edu> mp1w+@ANDREW.CMU.EDU (Marc Russell Pawliger) writes:
>In the documents from Adobe about ESPF they say that the %%BoundingBox must be
>included in the prolog.  Do the lower-left and upper-right coordinates in the
>comment refer to absoulte bounding coordinates, or are they `relocatable'?

They are not relocatable.

>
>If I have a 2" x 3" graphic, can I give the coordinates as (0,0) and (600,900)
>[assuming 300 dpi], or do I have to give the coordinates where the graphic will

Think device independence.... Use points, not pixels.

>actually be drawn?  All the code for the graphic is relative-offset from the
>current point anyway...
>

The graphic should be placed at an absolute location.  With it fixed
in place the %%BoundingBox comment accurately describes its position
and size.  If you then want to include this image into another image,
you can use the BoundingBox info to do the appropriate translate,
scale, and rotate.  These three operators are all that you need to get
the included image in the right spot with the proper size and
orientation.  Its generally a good idea to put a save and restore
around the image.  A clip region may also come in handy.

Ted Ede -- ted@mitre-bedford.arpa -- The MITRE Corporation -- Burlington Road  
|        -- Bedford MA, 01730 -- Mail Stop B015 -- (617) 271-2524 --        |
|                   - this line intentionally left blank -                  |
+---------------------------------------------------------------------------+

barnett@vdsvax.steinmetz.ge.com (Bruce G. Barnett) (03/14/88)

If you are calculating bounding boxes, you may wish to get
BBfig - originally written by Ned Batchelder and posted to 
comp.text and net.sources in April 87.

You print out your PostScript diagram using bbfig, and the
printer calculates the bounding box.

Or I can send you a copy.
-- 
	Bruce G. Barnett 	<barnett@ge-crd.ARPA> <barnett@steinmetz.UUCP>
				uunet!steinmetz!barnett

liam@cs.qmc.ac.uk (William Roberts) (03/16/88)

Sender:

Followup-To:

Distribution:


In article <AWCMg=y00hcqQ99lNJ@andrew.cmu.edu> mp1w+@ANDREW.CMU.EDU (Marc Russell Pawliger) writes:
>In the documents from Adobe about ESPF they say that the %%BoundingBox must be
>included in the prolog.  Do the lower-left and upper-right coordinates in the
>comment refer to absoulte bounding coordinates, or are they `relocatable'?

The answer is that they are absolute and given in points. The
idea is that you are declaring where on the page your program
will make black or white marks, assuming it is sent to a
standard PostScript printer.

>If I have a 2" x 3" graphic, can I give the coordinates as (0,0) and (600,900)
>[assuming 300 dpi], or do I have to give the coordinates where the graphic will
>actually be drawn?  All the code for the graphic is relative-offset from the
>current point anyway...

You give the bounding box as

        %%BoundingBox: 0 0 144 216

because that is where is will actually be drawn.

The bounding box is very useful if you can provide it; the
psfig software uses it to work out the necessary coordinate
transformation to place the graphic in the desired point in a
troff document, and to scale it etc as instructed.

WARNING: if your code puts the graphic in different places
according to such things as the page type, the value of the
/Product string in statusdict (blech!) or even the current
clipping path, then you can't reasonably put any bounding box
at all! Take this as a hint about the portability of your code....
-- 

William Roberts         ARPA: liam@cs.qmc.ac.uk  (gw: cs.ucl.edu)
Queen Mary College      UUCP: liam@qmc-cs.UUCP
LONDON, UK              Tel:  01-980 4811 ext 3933