Transzformációk
Transzformációs mátrix PS-ben:
Homogén koordinátákkal:
Ahol T a transzformációs mátrix:
PS-ben:
A grafikus állapot tartalmazza a Kurrens Trancformációs Mátrixot (CMT), amely megadja a felhsználói
térből az eszköztérbe való transzformációt.
Transzformációk:
Eltolás:
Forgatás:
Nagyítás:
Ált:
Pl.:
[ 72 0 0 72 0 0 ] concat
72 72 scale
Automatikus ciklus:
Tömb proc forall -
A tömb minden elemére végrehajtja a proc-ot ( 0-ás indexüvel kezdve )
pl.: 0 [13 29 3 -8 21 ] {add} forall 58
Példa:
%Variables
/LM 72 def
/RM 216 def
/ypos 720 def
/lineheight 11 def
%Procedures
/crlf
{ ypos lineheight sub
/ypos exch def
LM ypos moveto } def
/prtstr
{ dup stringwidth pop
currentpoint pop
add RM gt
{crlf} if
show } def
/format
{ { prtstr () show } forall
} def
%Main Program
/Times-Italic findfont 10 scalefont setfont
LM ypos moveto
%Text array:
[(Concience)(is)(the)(inner)(voice)
(that)(warns)(us)(somebody)(may)(be)
(looking)(- Mencken ) ]
format
showpage
Aload:
tömb aload tömb0...tömb(n-1) tömb
a tömb n elemét és a tömböt a verembe rakja
pl.:
[23 (ab)-6] aload 23 (ab)-6 [23(ab)-6]
Astore:
x1 ... x(n-1) tömb astore tömb
x1 ... x( n-1) -et elrakja a tömb-be.
pl.: (a)(bcd)(ef) 3 array astore [(a)(bcd)(ef)]
Példa:
%Variables & procedures
/LM 72 def
/newline
{ currentpoint 10 sub
exch pop LM exch
moveto } def
/PrintSample
{ aload pop
findfont 8 scalefont setfont
show newline } def
/Fontlist [
[(The five boxing wizards jump quickly.)
/Helvetica]
[(The five boxing wizards jump quickly.)
/Times-Roman]
[(The five boxing wizards jump quickly.)
/Symbol]
] def
%Begin Program
LM 600 moveto
FontList {Printsample) forall
showpage
a lap teteje