2009/11/18

PostScript 色, setrgbcolor, setcmykcolor, setgray, 線, setlinecap, setlinejoin, setlinemilter, setdash

setrgbcolor.pscmykcolor.ps setgray.ps cap.psjoin.psmiter.ps dash.ps rowdash.ps

 

 setrgbcolor.ps

% P.50 3.4 色 3.4.2 加法混色
% red green blue setrgbcolor

% rgb
/hline {
    5 dict begin
        /blue exch def
        /green exch def
        /red exch def
        /y exch def
        /x exch def
        newpath
        x y moveto
        30 0 rlineto
        30 setlinewidth
        red green blue setrgbcolor
        stroke
    end
} def

/hundredlines {
    4 dict begin
        /red 0 def
        300 40 660 {
            /y exch def
            /green 0 def
            100 40 460 {
                /x exch def
                x y red green 0 hline
                /green green 0.1 add def
            } for
            /red red 0.1 add def
        } for
    end
} def
hundredlines
showpage

cmykcolor.ps 

% P.51 3.4.3 減法混色
% cyan magenta yellow black setcmykcolor

/hline {
    6 dict begin
        /black exch def
        /yellow exch def
        /magenta exch def
        /cyan exch def
        /y exch def
        /x exch def
        newpath
        x y moveto
        30 0 rlineto
        30 setlinewidth
        cyan magenta yellow black setcmykcolor
        stroke
    end
} def

/hundredlines {
    4 dict begin
        /cyan 0 def
        300 40 660 {
            /y exch def
            /magenta 0 def
            100 40 460 {
                /x exch def
                x y cyan magenta 0 0 hline
                /magenta magenta 0.1 add def
            } for
            /cyan cyan 0.1 add def
        } for
    end
} def
hundredlines
showpage

setgray.ps

% setgray
/dline {
    newpath
    150 100 moveto
    300 600 rlineto
    40 setlinewidth
    stroke
} def

/hline {
    2 dict begin
        /gray exch def
        /y exch def
        newpath
        100 y moveto
        400 0 rlineto
        30 setlinewidth
        gray setgray
        stroke
        end
}def

/elevenlines {
    3 dict begin
        /gray 0 def
        200 40 600 {
            /y exch def
            y gray hline
            /gray gray 0.1 add def
        } for
    end
} def

dline
elevenlines
showpage

cap.ps

% cap
/hline {
    2 dict begin
        /cap exch def
        /y exch def
        newpath
        150 y moveto
        300 0 rlineto
        100 setlinewidth
        0.5 1 1 setrgbcolor
        cap setlinecap
        stroke
        newpath
        150 y moveto
        300 0 rlineto
        1 setlinewidth
        1 0 0 setrgbcolor
        0 setlinecap
        stroke
    end
}def

650 0 hline
500 1 hline
350 2 hline
showpage

join.ps

% join
/harpoon {
    2 dict begin
        /join exch def
        /y exch def
        newpath
        150 y moveto
        250 0 rlineto
        -150 120 rlineto
        80 setlinewidth
        0.5 1 1 setrgbcolor
        join setlinejoin
        stroke
        newpath
        150 y moveto
        250 0 rlineto
        -150 120 rlineto
        1 setlinewidth
        1 0 0 setrgbcolor
        0 setlinejoin
        stroke
    end
}def

600 0 harpoon
400 1 harpoon
200 2 harpoon
showpage

miter.ps 

% join
/harpoon {
    2 dict begin
        /join exch def
        /y exch def
        newpath
        150 y moveto
        250 0 rlineto
        -150 120 rlineto
        80 setlinewidth
        0.5 1 1 setrgbcolor
        join setlinejoin
        stroke
        newpath
        150 y moveto
        250 0 rlineto
        -150 120 rlineto
        1 setlinewidth
        1 0 0 setrgbcolor
        0 setlinejoin
        stroke
    end
}def

600 0 harpoon
400 1 harpoon
200 2 harpoon
showpage

dash.ps

% dash
/vline {
    newpath
    100 150 moveto
    100 750 lineto
    500 150 moveto
    500 750 lineto
    1 0 0 setrgbcolor
    stroke
} def

/hline {
    3 dict begin
        /offset exch def
        /array exch def
        /y exch def
        newpath
        100 y moveto
        400 0 rlineto
        0 0.4 0.8 setrgbcolor
        40 setlinewidth
        array offset setdash
        stroke
    end
}def

vline
700 [] 0 hline
600 [ 30 10 ] 0 hline
500 [ 20 ] 0 hline
400 [ 10 20 30 ] 0 hline
300 [ 50 10 10 10 ] 0 hline
200 [ 50 10 10 10 ] 20 hline
showpage

rowdash.ps

% roudash
newpath
100 200 moveto
400 0 rlineto
-200 500 rlineto
closepath
60 setlinewidth
0.4 0.8 0 setrgbcolor
1 setlinecap
1 setlinejoin
[200 80] 0 setdash
stroke
showpage

 

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

    コメントを投稿