Source PostScript (bezier_curve.pps)

Retour Texte non formaté
%% syntaxe : A1 A2 A3 scurveto /scurveto { [ 7 1 roll ] {jtoppoint} papply aload pop curveto } def /withcontrolpoints { /withc@ntr@lp@ints true def } def /withoutcontrolpoints { /withc@ntr@lp@ints false def } def withoutcontrolpoints %% syntaxe : [A1 A2 ... An] bezier_curve_ --> construit le chemin A1..An avec les points %% de controle donnes. nota : n mod 3 = 1 /bezier_curve_ { % dup 0 getp srlineto cdr cdr {scurveto} 6 6 Apply } def /bezier_curve* { 1 dict begin /startest true def bezier_curve end } def %% %% syntaxe : [A1 A2 ... An] bezier_curve --> trace la courbe A1..An avec les points %% %% de controle donnes. nota : n mod 3 = 1 %% /bezier_curve { %% gsave %% gsave %% withc@ntr@lp@ints {dup noir points} if %% grestore %% newpath %% dup 0 getp smoveto %% bezier_curve_ %% starfill %% stroke %% grestore %% } def %% 23-06-06 %% %% syntaxe : [A1 A2 ... An] string bezier_curve --> trace la courbe A1..An avec les points %% 23-06-06 %% %% de controle donnes. nota : n mod 3 = 1 %% 23-06-06 %% %% le parametre string est optionnel, il sert a gerer les terminaisons %% 23-06-06 %% %% de ligne %% 23-06-06 %% /bezier_curve { %% 23-06-06 %% gsave %% 23-06-06 %% 3 dict begin %% 23-06-06 %% dup isstring %% 23-06-06 %% { %% 23-06-06 %% /option exch def %% 23-06-06 %% /liste exch def %% 23-06-06 %% /n liste length 2 idiv 1 sub def %% 23-06-06 %% liste %% 23-06-06 %% } %% 23-06-06 %% if %% 23-06-06 %% gsave %% 23-06-06 %% withc@ntr@lp@ints {dup noir points} if %% 23-06-06 %% grestore %% 23-06-06 %% newpath %% 23-06-06 %% dup 0 getp smoveto %% 23-06-06 %% bezier_curve_ %% 23-06-06 %% starfill %% 23-06-06 %% currentlinewidth 0 eq {} {stroke} ifelse %% 23-06-06 %% %% 23-06-06 %% currentdict /option known %% 23-06-06 %% { %% 23-06-06 %% liste 1 getp %% 23-06-06 %% liste 1 getp %% 23-06-06 %% liste 0 getp milieu %% 23-06-06 %% liste 0 getp %% 23-06-06 %% liste n 1 sub getp %% 23-06-06 %% liste n 1 sub getp %% 23-06-06 %% liste n getp milieu %% 23-06-06 %% liste n getp %% 23-06-06 %% option %% 23-06-06 %% gere_arrowhead %% 23-06-06 %% } %% 23-06-06 %% if %% 23-06-06 %% grestore %% 23-06-06 %% } def %% syntaxe : [A1 A2 ... An] string bezier_curve --> trace la courbe A1..An avec les points %% de controle donnes. nota : n mod 3 = 1 %% le parametre string est optionnel, il sert a gerer les terminaisons %% de ligne /bezier_curve { gsave 3 dict begin dup isstring { /option exch def /liste exch def /n liste length 2 idiv 1 sub def liste } if gsave withc@ntr@lp@ints {dup noir points} if grestore newpath dup 0 getp smoveto bezier_curve_ starfill stockcurrentcpath newarrowpath currentlinewidth 0 eq {} {stroke} ifelse currentdict /option known { liste 1 getp liste 0 getp arrowpath0 liste n 1 sub getp liste n getp arrowpath1 option gere_arrowhead } if end grestore } def