返回列表 回复 发帖

PostScript 时钟示例

#!usr/bin/perl
$GS="/usr/local/bin/gs";
$|=1;
print "contest-type:image/gif","\n\n";
($seconds,$minutes,$hour)=localtime(time);
if($hour>12){
        $hour-=12;
        $ampm="pm";
} elsif ($hour==0){
        $hour=12;
        $ampm="noon";
}
else{
        $ampm="am";
}
$time=sprintf("%02d:%02d:%02d %s",$hour,$minutes,$seconds,$ampm);
$x=80;
$y=15;
open (GS,"|$GS -sDEVICE=jpeg -sOutputFile=- -q -g${x}x${y} - 2>/dev/null");
print GS <<End_of_PS;
%! PS-Adobe-3.0 EPSF-3.0
%% BoundingBox: 0 0 $x $y
%% EndComments
/Times-Roman findfont 14 scalefont setfont
/red {1 0 0 setrgbcolor} def
/black {0 0 0 setrgbcolor} def
black clippath fill
0 0 moveto
($time) red show
showpage
End_of_PS
close (GS);
exit(0);           
^^^^^^^^^^^^^^^^^^^^^^^^^the end
OS:solaris7
Perl:perl5.003
GS(ghostscript):gs5.50
通过。
返回列表