From: Harald H. <h.h...@tu...> - 2004-07-17 14:30:49
|
On Fri, 16 Jul 2004, Ethan Merritt wrote: > > or using it for definition of a new function > > > > /NewPatternFill { > > ... > > } def > > > > the file can be loaded. May be the pattern fill code can test if > > NewPatternFill has already been used (by setting a boolean) and then call > > it once if needed. > > That is a very interesting idea, but I am not sure that we have > a mechanism in place to allow it. I have applied some changes to a sample file. Here is the gnuplot file: # ------ pattern-test.gpl ------------------------------------ set terminal postscript eps 'Times-Roman' 22 set output 'pattern-test.eps' set style fill pattern 1 border 1 plot x*x notitle with filledcurves y1=5 set output # ------ /pattern-test.gpl ------------------------------------ And here is the diff: # ------ pattern-test.diff ------------------------------------ --- pattern-test.original.eps Sat Jul 17 15:52:20 2004 +++ pattern-test2.eps Sat Jul 17 16:16:49 2004 @@ -287,6 +287,12 @@ /Tile8x8 {/PaintType 2 /PatternType 1 /TilingType 1 /BBox [0 0 8 8] /XStep 8 /Y Step 8} bind def /KeepColor {currentrgbcolor [/Pattern /DeviceRGB] setcolorspace} bind def +/PatternsUndefined true def +/DefinePatterns { + PatternsUndefined + { + gsave + 20 20 scale % reciprocal of 0.050 0.050: should be solved differently << Tile8x8 /PaintProc { 0.5 setlinewidth pop 0 0 M 8 8 L 0 8 M 8 0 L stroke } >> matrix makepattern @@ -331,13 +337,17 @@ -4 0 M 12 8 L -4 4 M 8 10 L stroke } >> matrix makepattern /Pat9 exch def -/Pattern1 {KeepColor Pat1 setpattern} bind def -/Pattern2 {KeepColor Pat2 setpattern} bind def -/Pattern3 {KeepColor Pat3 setpattern} bind def -/Pattern4 {KeepColor Landscape { Pat5 } { Pat4 } ifelse setpattern} bind def -/Pattern5 {KeepColor Landscape { Pat4 } { Pat5 } ifelse setpattern} bind def -/Pattern6 {KeepColor Landscape { Pat9 } { Pat6 } ifelse setpattern} bind def -/Pattern7 {KeepColor Landscape { Pat8 } { Pat7 } ifelse setpattern} bind def + grestore + /PatternsUndefined false def + } if +} def +/Pattern1 {DefinePatterns KeepColor Pat1 setpattern} def +/Pattern2 {DefinePatterns KeepColor Pat2 setpattern} def +/Pattern3 {DefinePatterns KeepColor Pat3 setpattern} def +/Pattern4 {DefinePatterns KeepColor Landscape { Pat5 } { Pat4 } ifelse setpatte rn} def +/Pattern5 {DefinePatterns KeepColor Landscape { Pat4 } { Pat5 } ifelse setpatte rn} def +/Pattern6 {DefinePatterns KeepColor Landscape { Pat9 } { Pat6 } ifelse setpatte rn} def +/Pattern7 {DefinePatterns KeepColor Landscape { Pat8 } { Pat7 } ifelse setpatte rn} def % %End of PostScript Level 2 code % # ------ /pattern-test.diff ------------------------------------ > I suppose this would need to > go into the term->graphics() routine, which is called to start a new > plot. Is there some way for a 'plot' command to pass any information > about requirements to a terminal driver at this point? With this patch, only the Postscript header is changed. But there is one problem: The original code defines the patterns before setting "0.050 0.050 scale" while the new code does it afterwards. Thus, I have included "gsave 20 20 scale" ... "grestore" to get the original scaling. Thus should be solved differently because somebody may want to change the 0.050 0.050 (as I do sometimes). > You may have meant that the test for initialization could be > made in the PostScript code itself, at the point where a call to > one of the Pattern<n> operators would first occur. > But so far my experimentation shows this does not work. > It does work to initialize at the start of a new %Page in > the document, however. See above: The problem was the global scaling of the document. > > Then, eps files that do not use patterns can be loaded > > while the ones the use them fail to be loaded by Illustrator 7. The > > Computer that runs Illustrator 11 is off, already. But Illustrator 11 has > > been able to load all eps files until now. Illustrator CS 11 can load the original and the new code including the patterns but it unfortunately shows the borders of the tiles (shall I send a screen shot?). Illustrator 7 now understands the patched files when not using one of the commands Pattern1, Pattern2, etc. Ghostscript 8.14 and 6.53 do understand the files including patterns. Unfortunately gv 3.5.8 ignores the patterns and shows an empty plot. But this may be a bug. It is a pity that gv is not developed anymore. -- Harald Harders Langer Kamp 8 Technische Universitaet Braunschweig D-38106 Braunschweig Institut fuer Werkstoffe Germany E-Mail: h.h...@tu... Tel: +49 (5 31) 3 91-3062 WWW : http://www.ifw.tu-bs.de Fax: +49 (5 31) 3 91-3058 |