diff options
author | Taru Karttunen <taruti@taruti.net> | 2011-03-30 16:53:33 +0300 |
---|---|---|
committer | Taru Karttunen <taruti@taruti.net> | 2011-03-30 16:53:33 +0300 |
commit | e463eb40363ff4c68b1d903f4e0cdd0ac1c5977f (patch) | |
tree | d5e9f57c28f026cb21de3bd77cc10cd7f64aaa85 /sys/lib/postscript/prologues/postdmd.ps | |
parent | b41b9034225ab3e49980d9de55c141011b6383b0 (diff) |
Import sources from 2011-03-30 iso image - sys/lib
Diffstat (limited to 'sys/lib/postscript/prologues/postdmd.ps')
-rwxr-xr-x | sys/lib/postscript/prologues/postdmd.ps | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/sys/lib/postscript/prologues/postdmd.ps b/sys/lib/postscript/prologues/postdmd.ps new file mode 100755 index 000000000..fa312af02 --- /dev/null +++ b/sys/lib/postscript/prologues/postdmd.ps @@ -0,0 +1,124 @@ +% +% Version 3.3.2 prologue for DMD bitmap files. +% + +/#copies 1 store +/aspectratio 1 def +/formsperpage 1 def +/landscape false def +/magnification 1 def +/margin 0 def +/orientation 0 def +/rotation 1 def +/screenres 100 def +/xoffset 0 def +/yoffset 0 def + +/useclippath true def +/pagebbox [0 0 612 792] def + +/inch {72 mul} bind def +/min {2 copy gt {exch} if pop} bind def + +/setup { + counttomark 2 idiv {def} repeat pop + + landscape {/orientation 90 orientation add def} if + + pagedimensions + xcenter ycenter translate + orientation rotation mul rotate + xoffset inch yoffset inch translate + magnification dup aspectratio mul scale + + /height height margin sub def + /width width margin sub def +} def + +/pagedimensions { + useclippath { + /pagebbox [clippath pathbbox newpath] def + } if + pagebbox aload pop + 4 -1 roll exch 4 1 roll 4 copy + landscape {4 2 roll} if + sub /width exch def + sub /height exch def + add 2 div /xcenter exch def + add 2 div /ycenter exch def + userdict /gotpagebbox true put +} def + +/pagesetup {/page exch def} bind def + +/bitmap { + /scanlines exch def + /scanlength exch def + /flip exch def + /v8format exch def + + /bytelength scanlength 8 idiv def + /picstr bytelength string def + /lpicstr bytelength string def + /bytelength bytelength 1 sub def + + gsave + +% First the overall scaling. + + height scanlines div width scanlength div min + 72 screenres div min + dup scale + +% Followed by the one for the unit square. + + scanlength neg 2 div scanlines neg 2 div translate + scanlength scanlines scale + v8format {getv8bitmap} {getbitmap} ifelse + grestore +} bind def + +/getbitmap { + scanlength scanlines flip [scanlength 0 0 scanlines neg 0 scanlines] { + 0 { + currentfile token pop dup + 0 eq {pop pop exit} if + /charcount exch def + picstr 1 index charcount getinterval + /repl exch def + currentfile repl readhexstring pop pop + charcount add + currentfile token pop { + picstr 1 index repl putinterval + charcount add + } repeat + } loop + picstr + } imagemask +} bind def + +/getv8bitmap { + scanlength scanlines flip not [scanlength 0 0 scanlines neg 0 scanlines] { + 0 { + currentfile token pop dup + 0 eq {pop pop exit} if + /charcount exch def + picstr 1 index charcount getinterval + /repl exch def + currentfile repl readhexstring pop pop + charcount add + currentfile token pop { + picstr 1 index repl putinterval + charcount add + } repeat + } loop + 0 0 picstr { + exch lpicstr exch get xor + lpicstr exch 2 index exch put + 1 add dup + } forall + pop pop lpicstr + } imagemask +} bind def + +/done {/lastpage where {pop lastpage} if} def |