| Refresh | Home EGTry.com

scale and translate composition


scale translate scale translate

scale_translate.ps

%!

%translate and scale matrix [sx 0 0 sy tx ty]
%x2=sx*x1+tx
%y2=sy*y1+ty

/xdef {exch def} bind def
%usage: Box
/Box {
				-5 -5 moveto  %(left, bottom)
		    10 0  rlineto
			  0 10 rlineto
			  -10 0 rlineto
				0 -10 rlineto
				closepath
				stroke
} def

Box

0 0 moveto
100 100 lineto
stroke

gsave
100 100 translate
Box
grestore

gsave 
[0.5 0 0 0.5  100 100] setmatrix
Box 
grestore

showpage