我目前正在为 Postscript 编译器编写徽标。我的 PS 输出代码似乎无效。任何想法可能是什么问题?或者 LOGO 的实际 PostScript 版本应该是什么样子?
LOGO输入码
PROC LDRAGON ( LEVEL )
IF LEVEL == 0 THEN
FORWARD 5
ELSE
LDRAGON ( LEVEL - 1 )
LEFT 90
RDRAGON ( LEVEL - 1 )
ENDIF
PROC RDRAGON ( LEVEL )
IF LEVEL == 0 THEN
FORWARD 5
ELSE
LDRAGON ( LEVEL - 1 )
RIGHT 90
RDRAGON ( LEVEL - 1 )
ENDIF
PROC MAIN (VOID)
LDRAGON ( 11 )
我的编译器中的代码。
%!PS-Adobe-3.0
/Xpos { 300 } def showpage
/Ypos { 500 } def
/Heading { 0 } def
/Arg { 0 } def
/Right {
Heading exch add Trueheading
/Heading exch def
} def
/Left {
Heading exch sub Trueheading
/Heading exch def
} defп
/Trueheading {
360 mod dup
0 lt { 360 add } if
} def
/Forward {
dup Heading sin mul
exch Heading cos mul
2 copy Newposition
rlineto
} def
/Newposition {
Heading 180 gt Heading 360 lt
and { neg } if exch
Heading 90 gt Heading 270 lt
and { neg } if exch
Ypos add /Ypos exch def
Xpos add /Xpos exch def
} def
/LEVEL { 11 } def
/LDRAGON{
LEVEL
0
eq
{
5 FORWARD }{
LEVEL
1
1
sub
LDRAGON
90
LEFT
LEVEL
1
sub
RDRAGON
} ifelse
} def
/MAIN {
11
LDRAGON
} def
Xpos Ypos moveto
MAIN
stroke
showpage