2009/11/19

PostScript ベジェ曲線

bezier-1.ps bezier-2.ps

 

bezier-1.ps

%!PS-Adobe-3.0
% PostScript実習マニュアル
% P.58 3.7 ベジェ曲線

% P.58 3.7.1 ベジェ曲線の基礎
/bezier {
    8 dict begin
        /y3 exch def
        /x3 exch def
        /y2 exch def
        /x2 exch def
        /y1 exch def
        /x1 exch def
        /y0 exch def
        /x0 exch def
        newpath
        x0 y0 moveto
        x1 y1 x2 y2 x3 y3 curveto
        0 0.8 1 setrgbcolor
        40 setlinewidth
        stroke
        newpath
        x0 y0 moveto
        x1 y1 lineto
        x2 y2 moveto
        x3 y3 lineto
        1 0 0 setrgbcolor
        1 setlinewidth
        stroke
    end
} def

140 450 100 650 500 750 300 450 bezier
140 150 100 350 300 150 500 450 bezier
showpage

bezier-2.ps

%!PS-Adobe-3.0
% PostScript実習マニュアル
% P.58 3.7 ベジェ曲線

% P59 3.7.3 ベジェ曲線の連結
/bezbez {
    14 dict begin
        /y6 exch def
        /x6 exch def
        /y5 exch def
        /x5 exch def
        /y4 exch def
        /x4 exch def
        /y3 exch def
        /x3 exch def
        /y2 exch def
        /x2 exch def
        /y1 exch def
        /x1 exch def
        /y0 exch def
        /x0 exch def
        newpath
        x0 y0 moveto
        x1 y1 x2 y2 x3 y3 curveto
        x4 y4 x5 y5 x6 y6 curveto
        0 1 0.8 setrgbcolor
        30 setlinewidth
        stroke
        newpath
        x0 y0 moveto
        x1 y1 lineto
        x2 y2 moveto
        x3 y3 lineto
        1 0 0 setrgbcolor
        1 setlinewidth
        stroke
        newpath
        x3 y3 moveto
        x4 y4 lineto
        x5 y5 moveto
        x6 y6 lineto
        0 0 1 setrgbcolor
        stroke
    end
} def

150 600 100 750 350 700 250 600 300 450 500 400 400 600 bezbez
150 300 100 450 350 400 250 300 100 150 500 100 400 300 bezbez
showpage

 

  • PostScript実習マニュアル
  • PostScript - PDF,Web まとめ
  • 0 件のコメント:

    コメントを投稿