PostScript语言教程(四、程序变量使用)

4.1、变量定义
POSTSCRIPT 变量
变量的定义是将比那两名和值用def进行关联类似

/ppi 75 def   %将ppi定义为75
/ppi ppi 1 add def  %将ppi + 1的值定义为ppi ppi = 75 + 1 = 86

POSTSCRIPT 程序块

/inch {72 mul} def

4.2、使用程序和变量

方块

/box
{
72 0 rlineto
0 72 rlineto
-72 0 rlineto
closepath
}def

newpath
252 324 moveto box
.4 setgray fill

  

/inch {72 mul}def

/box 
{
newpath moveto
1 inch 0 rlineto
0 1 inch rlineto
-1 inch 0 rlineto
closepath
}def

/fillbox
{
setgray fill
}def

3.5 inch 4.5 inch box
0 fillbox
2.75 inch 5 inch box
.4 fillbox

  

 

转载于:https://www.cnblogs.com/Ansing/p/7443813.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值