% % ps2bits.ps % % Assumes /width & /height are set from outside. % % Test: % % news_server '(ps2bits.ps) (r) file cvx exec' > temp % 0 0 moveto width height lineto stroke % ^D % % or % % echo 'clippath fill' | news_server '(ps2bits.ps) (r) file cvx exec' > temp % /framebuffer (/dev/bwtwo0 574 0 578 449) createdevice def framebuffer dup setcanvas startkeyboardandmouse /?def { systemdict 2 index known { pop pop } { def } ifelse } def /run { (r) file cvx exec } ?def /[ systemdict /mark get ?def /] { counttomark array astore exch pop } ?def /rect {dup 0 exch rlineto exch 0 rlineto neg 0 exch rlineto closepath } ?def /width 200 ?def /height 400 ?def /depth 1 ?def /can framebuffer newcanvas def framebuffer setcanvas 0 0 moveto width height rect can reshapecanvas can begin /Retained true def /Transparent false def end %/can % width height depth [width 0 0 height neg 0 height] {256 string} % buildimage def can setcanvas clippath 1 setgray fill 0 setgray /stdin (%stdin) (r) file def /stdout (%stdout) (w) file def /stderr (%stderr) (w) file def (%stdin) run clippath stdout writecanvas