📄 a dynamic lookup scheme for bursty access patterns_infocom2001.ps
字号:
currentdict end % newdict /foo exch % /foo newlict definefont % newfont} bind def% PATpcalc - calculates the starting point and width/height% of the tile fill for the shape/PATpcalc { % - PATpcalc nw nh px py PATDict /CurrentPattern get begin gsave % Set up the coordinate system to Pattern Space % and lock down pattern PatternGState /cm get setmatrix BBox aload pop pop pop translate % Determine the bounding box of the shape pathbbox % llx lly urx ury grestore % Determine (nw, nh) the # of cells to paint width and height PatHeight div ceiling % llx lly urx qh 4 1 roll % qh llx lly urx PatWidth div ceiling % qh llx lly qw 4 1 roll % qw qh llx lly PatHeight div floor % qw qh llx ph 4 1 roll % ph qw qh llx PatWidth div floor % ph qw qh pw 4 1 roll % pw ph qw qh 2 index sub cvi abs % pw ph qs qh-ph exch 3 index sub cvi abs exch % pw ph nw=qw-pw nh=qh-ph % Determine the starting point of the pattern fill %(px, py) 4 2 roll % nw nh pw ph PatHeight mul % nw nh pw py exch % nw nh py pw PatWidth mul exch % nw nh px py end} bind def% Save the original routines so that we can use them later on/oldfill /fill load def/oldeofill /eofill load def/oldstroke /stroke load def/oldshow /show load def/oldashow /ashow load def/oldwidthshow /widthshow load def/oldawidthshow /awidthshow load def/oldkshow /kshow load def% These defs are necessary so that subsequent procs don't bind in% the originals/fill { oldfill } bind def/eofill { oldeofill } bind def/stroke { oldstroke } bind def/show { oldshow } bind def/ashow { oldashow } bind def/widthshow { oldwidthshow } bind def/awidthshow { oldawidthshow } bind def/kshow { oldkshow } bind def/PATredef { MyAppDict begin { /fill { /clip load PATdraw newpath } bind def /eofill { /eoclip load PATdraw newpath } bind def /stroke { PATstroke } bind def /show { 0 0 null 0 0 6 -1 roll PATawidthshow } bind def /ashow { 0 0 null 6 3 roll PATawidthshow } bind def /widthshow { 0 0 3 -1 roll PATawidthshow } bind def /awidthshow { PATawidthshow } bind def /kshow { PATkshow } bind def } { /fill { oldfill } bind def /eofill { oldeofill } bind def /stroke { oldstroke } bind def /show { oldshow } bind def /ashow { oldashow } bind def /widthshow { oldwidthshow } bind def /awidthshow { oldawidthshow } bind def /kshow { oldkshow } bind def } ifelse end} bind deffalse PATredef% Conditionally define setcmykcolor if not available/setcmykcolor where { pop } { /setcmykcolor { 1 sub 4 1 roll 3 { 3 index add neg dup 0 lt { pop 0 } if 3 1 roll } repeat setrgbcolor - pop } bind def} ifelse/PATsc { % colorarray aload length % c1 ... cn length dup 1 eq { pop setgray } { 3 eq { setrgbcolor } { setcmykcolor } ifelse } ifelse} bind def/PATsg { % dict begin lw setlinewidth lc setlinecap lj setlinejoin ml setmiterlimit ds aload pop setdash cc aload pop setrgbcolor cm setmatrix end} bind def/PATDict 3 dict def/PATsp { true PATredef PATDict begin /CurrentPattern exch def % If it's an uncolored pattern, save the color CurrentPattern /PaintType get 2 eq { /PColor exch def } if /CColor [ currentrgbcolor ] def end} bind def% PATstroke - stroke with the current pattern/PATstroke { countdictstack save mark { currentpoint strokepath moveto PATpcalc % proc nw nh px py clip newpath PATfill } stopped { (*** PATstroke Warning: Path is too complex, stroking with gray) = cleartomark restore countdictstack exch sub dup 0 gt { { end } repeat } { pop } ifelse gsave 0.5 setgray oldstroke grestore } { pop restore pop } ifelse newpath} bind def/PATtcalc { % modmtx tilingtype PATtcalc tilematrix % Note: tiling types 2 and 3 are not supported gsave exch concat % tilingtype matrix currentmatrix exch % cmtx tilingtype % Tiling type 1 and 3: constant spacing 2 ne { % Distort the pattern so that it occupies % an integral number of device pixels dup 4 get exch dup 5 get exch % tx ty cmtx XStep 0 dtransform round exch round exch % tx ty cmtx dx.x dx.y XStep div exch XStep div exch % tx ty cmtx a b 0 YStep dtransform round exch round exch % tx ty cmtx a b dy.x dy.y YStep div exch YStep div exch % tx ty cmtx a b c d 7 -3 roll astore % { a b c d tx ty } } if grestore} bind def/PATusp { false PATredef PATDict begin CColor PATsc end} bind def% left4511 dict begin/PaintType 1 def/PatternType 1 def/TilingType 1 def/BBox [0 0 1 1] def/XStep 1 def/YStep 1 def/PatWidth 1 def/PatHeight 1 def/Multi 2 def/PaintData [ { clippath } bind { 32 32 true [ 32 0 0 -32 0 32 ] {<808080804040404020202020101010100808080804040404 020202020101010180808080404040402020202010101010 080808080404040402020202010101018080808040404040 202020201010101008080808040404040202020201010101 808080804040404020202020101010100808080804040404 0202020201010101>} imagemask } bind] def/PaintProc { pop exec fill} defcurrentdictend/P4 exch def% horizontal lines11 dict begin/PaintType 1 def/PatternType 1 def/TilingType 1 def/BBox [0 0 1 1] def/XStep 1 def/YStep 1 def/PatWidth 1 def/PatHeight 1 def/Multi 2 def/PaintData [ { clippath } bind { 16 8 true [ 16 0 0 -8 0 8 ] {< ffff000000000000ffff000000000000>} imagemask } bind] def/PaintProc { pop exec fill} defcurrentdictend/P9 exch def% vertical lines11 dict begin/PaintType 1 def/PatternType 1 def/TilingType 1 def/BBox [0 0 1 1] def/XStep 1 def/YStep 1 def/PatWidth 1 def/PatHeight 1 def/Multi 2 def/PaintData [ { clippath } bind { 8 16 true [ 8 0 0 -16 0 16 ] {<11111111111111111111111111111111>} imagemask } bind] def/PaintProc { pop exec fill} defcurrentdictend/P10 exch def% crosshatch lines11
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -