Документ взят из кэша поисковой машины. Адрес оригинального документа : http://crydee.sai.msu.ru/ftproot/pub/misc/doc/pm5/pm_fills.txt
Дата изменения: Fri May 12 10:35:40 1995
Дата индексирования: Mon Dec 24 05:00:59 2007
Кодировка:
Victor Chan forward this message to me regarding how to create PostScript
Fills. It is written by Olav Martin Kvern, a writer for Aldus Magazine.
Thanks also goes to Marc Cardwell for originally obtaining the document.

Enjoy!

Geof.
(gwp@cs.purdue.edu)
-------------------------------------------------------------------------

Son of Twice-Told-Tiles
by Olav Martin Kvern

In the Aldus Magazine article "Twice-Told Tiles," I showed how to
create a new kind of PostScript fill effect. In closing, I said that
you could put any object you could draw in FreeHand into the fill,
and that I'd show you how to do that. There wasn't room in the next
issue to show you, so I'm posting the instructions (this file) on
CompuServe.

To get the PostScript code you need, draw the object you want for
your custom fill in FreeHand, then export the file as an EPS. Next,
open the EPS file with a word processor and extract the drawing
commands from it. I'll help you find them.

Start FreeHand, and draw the object you want. Start by drawing a
simple shape. The more complex the shape you draw, the longer it'll
take to print your fill. If you put an imported TIFF file or a
graduated fill inside o ne of these fills, it'll take longer than
forever to print.

Once you've drawn the object, follow these steps:

1. First, our tiles need to be square. If the object isn't
square, group it inside a square. If the object is already square,
press Command-G (Macintosh) or Control-G (Windows) to group it.
We're grouping the object because grouped objects are a little
easier for to find in an EPS file.

2. Resize the object so that it's 100 points square.

3. Reposition your ruler zero point so that it's at the
lower-left corner of the page (unless you've moved your zero point
from its default position, it'll be there already).

4. Press Command-I (Macintosh) or Control-I (Windows) to
display the Group dialog box. Type -50 in the Horizontal and
Vertical text edit boxes. We do this to set the center of the tile
at the lower-left hand corner of your page, PostScript's 0, 0 point.
In effect, we're creating a tiny drawing page that's 100 points
square, with the zero point at its center. You can, actually, make
the object to any size you want, but, if you do, it won't scale
correctly - the procedures I presented last issue expect a
100-point-square tile.

5. If you want, you can attach a note to the object. Choose
"Set note." from the Attributes menu. In the Set note dialog box,
type a note to your self (something like "This is what you're
looking for"). When you export the illustration as an EPS, FreeHand
writes the note into your EPS f ile. This makes the objects you've
drawn a little easier to find.

6. Make sure there's nothing else on the page, and then export
the file as a generic EPS.

Next, we'll extract the drawing commands from the EPS file so that
we can graft them into a fill in the UserPrep file I showed you how
to create last issue.



1. Open the EPS file with your word processor. It's just ASCII
(or text-only), so any word processor can read it. Most word
processors have ways to open any file, regardless of its file type
(Macintosh) or extension (Windows).

2. Find the object you've drawn. Most of the EPS file is made
up of FreeHand's PostScript dictionaries. The actual objects you've
drawn will be very near the end of the file, between the line
"%%EndSetup" and befor e the line "%%Trailer." If you added a
attached a note to a path, the start of the path is on the line
following the note:

%%This is the first path
-50.000 -50.000 m

If you didn't use "Set note," the paths you've drawn will start on
the first line containing a pair of coordinates (numbers), followed
by a space, an "m" and a return. Like this:

-34.024 15.612 m

Most of the commands describing the paths are be coordinates,
followed by a single letter "m," "L," or "C." You can round some of
the coordinates, if you like, "50.0031" could easily become "50,"
for example. If you see "u," "U," "vmr," "vms," or "vmrs," delete
it. "u" and "U," by the way, are the start and end of a group,
respectively.

If the object you're creating is a simple path, replace any
occurrence of "s," "S," "f," or "F" (for fill and stroke,
respectively), with the word "format." The PostScript fill we created
last issue takes care of stroki ng and filling for you. If you're
working with a more complex object, lea ve these as is.

If you see any of FreeHand's color arrays (lines ending in "fc" or
"sc," such as "[0 .6 .5 .2] fc" or "[1 4] sc"), delete them unless
the array is white ("[0 0 0 0]"). You want to be able to set the
color of your fill using the pop-up in the Fill and line dialog box,
rather than having the c olors set in your UserPrep (if you don't,
leave the color arrays as is).

3. Now that you've selected the commands needed to draw your
graphic, you can copy them into a general-purpose routine for
repeating them.

Open the UserPrep file you created by following the directions in
"Twice- Told Tiles," and then insert the drawing code for your new
tile, as shown in the sidebar "More tiled fills" accompanying that
column. Save the file, making sure that you save it as text-only (or
ASCII).

To use your new PostScript fill, draw a closed path, then display
the Fill and line dialog box. Choose "PostScript" from the Fill
pop-up (Macintos h) or drop-down (Windows) menu. In the PostScript
text edit box, type the parameters for your fill in this order:

<[line weight] stroke or
fill>

for example

24 36 0 true 3 (stroke) snowflakes

or:

24 36 0 true (fill) snowflakes

Print your illustration. If everything's gone right, you'll see
your new PostScript fill. Because you started from a PostScript
fill that worked, any problems will be caused by an error in the
new tile. If you get an er ror message, check the drawing code for
the tile and/or simplify the tile , and try again.

Any Questions? Drop me a line on CompuServe at 76636,2535.