home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume4 / 8to1 next >
SHell self-extracting ARchive  |  1989-02-03  |  27.7 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: SHell self-extracting ARchive (archive/shar).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file news text default
99% file C source, ASCII text default
100% checkBytes Printable ASCII default
100% dexmagic PrintFox/Pagefox WEAK default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime message/news default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 61 74 68 3a 20 78 61 | 6e 74 68 21 6e 69 63 2e |Path: xa|nth!nic.|
|00000010| 4d 52 2e 4e 45 54 21 68 | 61 6c 21 6e 63 6f 61 73 |MR.NET!h|al!ncoas|
|00000020| 74 21 61 6c 6c 62 65 72 | 79 0a 46 72 6f 6d 3a 20 |t!allber|y.From: |
|00000030| 72 61 69 6e 62 6f 77 40 | 73 62 63 73 2e 73 75 6e |rainbow@|sbcs.sun|
|00000040| 79 73 62 2e 65 64 75 0a | 4e 65 77 73 67 72 6f 75 |ysb.edu.|Newsgrou|
|00000050| 70 73 3a 20 63 6f 6d 70 | 2e 73 6f 75 72 63 65 73 |ps: comp|.sources|
|00000060| 2e 6d 69 73 63 0a 53 75 | 62 6a 65 63 74 3a 20 76 |.misc.Su|bject: v|
|00000070| 30 34 69 31 32 37 3a 20 | 53 55 4e 20 72 61 73 74 |04i127: |SUN rast|
|00000080| 65 72 20 66 69 6c 65 20 | 63 6f 6c 6f 72 20 74 6f |er file |color to|
|00000090| 20 6d 6f 6e 6f 20 63 6f | 6e 76 65 72 74 65 72 2e | mono co|nverter.|
|000000a0| 0a 4d 65 73 73 61 67 65 | 2d 49 44 3a 20 3c 38 38 |.Message|-ID: <88|
|000000b0| 31 30 31 35 31 39 35 39 | 2e 41 41 32 35 35 36 36 |10151959|.AA25566|
|000000c0| 40 73 62 67 72 61 64 31 | 3e 0a 44 61 74 65 3a 20 |@sbgrad1|>.Date: |
|000000d0| 32 32 20 4f 63 74 20 38 | 38 20 30 31 3a 31 36 3a |22 Oct 8|8 01:16:|
|000000e0| 34 30 20 47 4d 54 0a 53 | 65 6e 64 65 72 3a 20 61 |40 GMT.S|ender: a|
|000000f0| 6c 6c 62 65 72 79 40 6e | 63 6f 61 73 74 2e 55 55 |llbery@n|coast.UU|
|00000100| 43 50 0a 52 65 70 6c 79 | 2d 54 6f 3a 20 72 61 69 |CP.Reply|-To: rai|
|00000110| 6e 62 6f 77 40 73 62 63 | 73 2e 73 75 6e 79 73 62 |nbow@sbc|s.sunysb|
|00000120| 2e 65 64 75 0a 4c 69 6e | 65 73 3a 20 39 33 39 0a |.edu.Lin|es: 939.|
|00000130| 41 70 70 72 6f 76 65 64 | 3a 20 61 6c 6c 62 65 72 |Approved|: allber|
|00000140| 79 40 6e 63 6f 61 73 74 | 2e 55 55 43 50 0a 0a 50 |y@ncoast|.UUCP..P|
|00000150| 6f 73 74 69 6e 67 2d 6e | 75 6d 62 65 72 3a 20 56 |osting-n|umber: V|
|00000160| 6f 6c 75 6d 65 20 34 2c | 20 49 73 73 75 65 20 31 |olume 4,| Issue 1|
|00000170| 32 37 0a 53 75 62 6d 69 | 74 74 65 64 2d 62 79 3a |27.Submi|tted-by:|
|00000180| 20 22 41 2e 20 4e 6f 6e | 79 6d 6f 75 73 22 20 3c | "A. Non|ymous" <|
|00000190| 72 61 69 6e 62 6f 77 40 | 73 62 63 73 2e 73 75 6e |rainbow@|sbcs.sun|
|000001a0| 79 73 62 2e 65 64 75 3e | 0a 41 72 63 68 69 76 65 |ysb.edu>|.Archive|
|000001b0| 2d 6e 61 6d 65 3a 20 38 | 74 6f 31 0a 0a 23 21 20 |-name: 8|to1..#! |
|000001c0| 2f 62 69 6e 2f 73 68 0a | 23 20 54 68 69 73 20 69 |/bin/sh.|# This i|
|000001d0| 73 20 61 20 73 68 65 6c | 6c 20 61 72 63 68 69 76 |s a shel|l archiv|
|000001e0| 65 2e 20 20 52 65 6d 6f | 76 65 20 61 6e 79 74 68 |e. Remo|ve anyth|
|000001f0| 69 6e 67 20 62 65 66 6f | 72 65 20 74 68 69 73 20 |ing befo|re this |
|00000200| 6c 69 6e 65 2c 20 74 68 | 65 6e 20 75 6e 70 61 63 |line, th|en unpac|
|00000210| 6b 0a 23 20 69 74 20 62 | 79 20 73 61 76 69 6e 67 |k.# it b|y saving|
|00000220| 20 69 74 20 69 6e 74 6f | 20 61 20 66 69 6c 65 20 | it into| a file |
|00000230| 61 6e 64 20 74 79 70 69 | 6e 67 20 22 73 68 20 66 |and typi|ng "sh f|
|00000240| 69 6c 65 22 2e 20 20 54 | 6f 20 6f 76 65 72 77 72 |ile". T|o overwr|
|00000250| 69 74 65 20 65 78 69 73 | 74 69 6e 67 0a 23 20 66 |ite exis|ting.# f|
|00000260| 69 6c 65 73 2c 20 74 79 | 70 65 20 22 73 68 20 66 |iles, ty|pe "sh f|
|00000270| 69 6c 65 20 2d 63 22 2e | 20 20 59 6f 75 20 63 61 |ile -c".| You ca|
|00000280| 6e 20 61 6c 73 6f 20 66 | 65 65 64 20 74 68 69 73 |n also f|eed this|
|00000290| 20 61 73 20 73 74 61 6e | 64 61 72 64 20 69 6e 70 | as stan|dard inp|
|000002a0| 75 74 20 76 69 61 0a 23 | 20 75 6e 73 68 61 72 2c |ut via.#| unshar,|
|000002b0| 20 6f 72 20 62 79 20 74 | 79 70 69 6e 67 20 22 73 | or by t|yping "s|
|000002c0| 68 20 3c 66 69 6c 65 22 | 2c 20 65 2e 67 2e 2e 20 |h <file"|, e.g.. |
|000002d0| 20 49 66 20 74 68 69 73 | 20 61 72 63 68 69 76 65 | If this| archive|
|000002e0| 20 69 73 20 63 6f 6d 70 | 6c 65 74 65 2c 20 79 6f | is comp|lete, yo|
|000002f0| 75 0a 23 20 77 69 6c 6c | 20 73 65 65 20 74 68 65 |u.# will| see the|
|00000300| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 6d 65 73 73 61 | followi|ng messa|
|00000310| 67 65 20 61 74 20 74 68 | 65 20 65 6e 64 3a 0a 23 |ge at th|e end:.#|
|00000320| 09 09 22 45 6e 64 20 6f | 66 20 61 72 63 68 69 76 |.."End o|f archiv|
|00000330| 65 20 31 20 28 6f 66 20 | 31 29 2e 22 0a 23 20 43 |e 1 (of |1).".# C|
|00000340| 6f 6e 74 65 6e 74 73 3a | 20 20 4d 61 6b 65 66 69 |ontents:| Makefi|
|00000350| 6c 65 20 52 45 41 44 4d | 45 20 38 74 6f 31 2e 63 |le READM|E 8to1.c|
|00000360| 20 73 63 6c 6f 61 64 2e | 63 0a 23 20 57 72 61 70 | scload.|c.# Wrap|
|00000370| 70 65 64 20 62 79 20 72 | 61 69 6e 62 6f 77 40 73 |ped by r|ainbow@s|
|00000380| 62 67 72 61 64 31 20 6f | 6e 20 53 61 74 20 4f 63 |bgrad1 o|n Sat Oc|
|00000390| 74 20 31 35 20 31 35 3a | 35 32 3a 31 31 20 31 39 |t 15 15:|52:11 19|
|000003a0| 38 38 0a 50 41 54 48 3d | 2f 62 69 6e 3a 2f 75 73 |88.PATH=|/bin:/us|
|000003b0| 72 2f 62 69 6e 3a 2f 75 | 73 72 2f 75 63 62 20 3b |r/bin:/u|sr/ucb ;|
|000003c0| 20 65 78 70 6f 72 74 20 | 50 41 54 48 0a 69 66 20 | export |PATH.if |
|000003d0| 74 65 73 74 20 2d 66 20 | 4d 61 6b 65 66 69 6c 65 |test -f |Makefile|
|000003e0| 20 2d 61 20 22 24 7b 31 | 7d 22 20 21 3d 20 22 2d | -a "${1|}" != "-|
|000003f0| 63 22 20 3b 20 74 68 65 | 6e 20 0a 20 20 65 63 68 |c" ; the|n . ech|
|00000400| 6f 20 73 68 61 72 3a 20 | 57 69 6c 6c 20 6e 6f 74 |o shar: |Will not|
|00000410| 20 6f 76 65 72 2d 77 72 | 69 74 65 20 65 78 69 73 | over-wr|ite exis|
|00000420| 74 69 6e 67 20 66 69 6c | 65 20 5c 22 4d 61 6b 65 |ting fil|e \"Make|
|00000430| 66 69 6c 65 5c 22 0a 65 | 6c 73 65 0a 65 63 68 6f |file\".e|lse.echo|
|00000440| 20 73 68 61 72 3a 20 45 | 78 74 72 61 63 74 69 6e | shar: E|xtractin|
|00000450| 67 20 5c 22 4d 61 6b 65 | 66 69 6c 65 5c 22 20 5c |g \"Make|file\" \|
|00000460| 28 31 36 32 20 63 68 61 | 72 61 63 74 65 72 73 5c |(162 cha|racters\|
|00000470| 29 0a 73 65 64 20 22 73 | 2f 5e 58 2f 2f 22 20 3e |).sed "s|/^X//" >|
|00000480| 4d 61 6b 65 66 69 6c 65 | 20 3c 3c 27 45 4e 44 5f |Makefile| <<'END_|
|00000490| 4f 46 5f 4d 61 6b 65 66 | 69 6c 65 27 0a 58 42 41 |OF_Makef|ile'.XBA|
|000004a0| 53 45 5f 44 49 52 20 3d | 20 24 28 50 57 44 29 0a |SE_DIR =| $(PWD).|
|000004b0| 58 43 46 4c 41 47 53 20 | 20 20 3d 20 2d 4f 0a 58 |XCFLAGS | = -O.X|
|000004c0| 4c 49 42 53 20 20 20 20 | 20 3d 20 2d 6c 70 69 78 |LIBS | = -lpix|
|000004d0| 72 65 63 74 0a 58 0a 58 | 0a 58 0a 58 73 63 6c 6f |rect.X.X|.X.Xsclo|
|000004e0| 61 64 3a 20 38 74 6f 31 | 0a 58 09 24 28 43 43 29 |ad: 8to1|.X.$(CC)|
|000004f0| 20 24 28 43 46 4c 41 47 | 53 29 20 2d 6f 20 73 63 | $(CFLAG|S) -o sc|
|00000500| 6c 6f 61 64 20 73 63 6c | 6f 61 64 2e 63 20 24 28 |load scl|oad.c $(|
|00000510| 4c 49 42 53 29 0a 58 0a | 58 38 74 6f 31 3a 0a 58 |LIBS).X.|X8to1:.X|
|00000520| 09 24 28 43 43 29 20 24 | 28 43 46 4c 41 47 53 29 |.$(CC) $|(CFLAGS)|
|00000530| 20 2d 6f 20 38 74 6f 31 | 20 38 74 6f 31 2e 63 20 | -o 8to1| 8to1.c |
|00000540| 24 28 4c 49 42 53 29 0a | 58 0a 58 0a 45 4e 44 5f |$(LIBS).|X.X.END_|
|00000550| 4f 46 5f 4d 61 6b 65 66 | 69 6c 65 0a 69 66 20 74 |OF_Makef|ile.if t|
|00000560| 65 73 74 20 31 36 32 20 | 2d 6e 65 20 60 77 63 20 |est 162 |-ne `wc |
|00000570| 2d 63 20 3c 4d 61 6b 65 | 66 69 6c 65 60 3b 20 74 |-c <Make|file`; t|
|00000580| 68 65 6e 0a 20 20 20 20 | 65 63 68 6f 20 73 68 61 |hen. |echo sha|
|00000590| 72 3a 20 5c 22 4d 61 6b | 65 66 69 6c 65 5c 22 20 |r: \"Mak|efile\" |
|000005a0| 75 6e 70 61 63 6b 65 64 | 20 77 69 74 68 20 77 72 |unpacked| with wr|
|000005b0| 6f 6e 67 20 73 69 7a 65 | 21 0a 66 69 0a 23 20 65 |ong size|!.fi.# e|
|000005c0| 6e 64 20 6f 66 20 6f 76 | 65 72 77 72 69 74 69 6e |nd of ov|erwritin|
|000005d0| 67 20 63 68 65 63 6b 0a | 66 69 0a 69 66 20 74 65 |g check.|fi.if te|
|000005e0| 73 74 20 2d 66 20 52 45 | 41 44 4d 45 20 2d 61 20 |st -f RE|ADME -a |
|000005f0| 22 24 7b 31 7d 22 20 21 | 3d 20 22 2d 63 22 20 3b |"${1}" !|= "-c" ;|
|00000600| 20 74 68 65 6e 20 0a 20 | 20 65 63 68 6f 20 73 68 | then . | echo sh|
|00000610| 61 72 3a 20 57 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |ar: Will| not ove|
|00000620| 72 2d 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |r-write |existing|
|00000630| 20 66 69 6c 65 20 5c 22 | 52 45 41 44 4d 45 5c 22 | file \"|README\"|
|00000640| 0a 65 6c 73 65 0a 65 63 | 68 6f 20 73 68 61 72 3a |.else.ec|ho shar:|
|00000650| 20 45 78 74 72 61 63 74 | 69 6e 67 20 5c 22 52 45 | Extract|ing \"RE|
|00000660| 41 44 4d 45 5c 22 20 5c | 28 31 32 30 39 20 63 68 |ADME\" \|(1209 ch|
|00000670| 61 72 61 63 74 65 72 73 | 5c 29 0a 73 65 64 20 22 |aracters|\).sed "|
|00000680| 73 2f 5e 58 2f 2f 22 20 | 3e 52 45 41 44 4d 45 20 |s/^X//" |>README |
|00000690| 3c 3c 27 45 4e 44 5f 4f | 46 5f 52 45 41 44 4d 45 |<<'END_O|F_README|
|000006a0| 27 0a 58 20 20 20 54 68 | 65 20 70 72 6f 67 72 61 |'.X Th|e progra|
|000006b0| 6d 20 38 74 6f 31 20 63 | 6f 6e 76 65 72 74 73 20 |m 8to1 c|onverts |
|000006c0| 61 20 38 2d 62 69 74 20 | 64 65 70 74 68 20 73 75 |a 8-bit |depth su|
|000006d0| 6e 20 72 61 73 74 65 72 | 20 66 69 6c 65 20 28 62 |n raster| file (b|
|000006e0| 6f 74 68 20 63 6f 6c 6f | 72 2c 20 0a 58 20 20 20 |oth colo|r, .X |
|000006f0| 69 2e 65 2e 20 72 67 62 | 20 61 72 65 20 64 69 66 |i.e. rgb| are dif|
|00000700| 66 65 72 65 6e 74 2c 20 | 61 6e 64 20 67 72 65 79 |ferent, |and grey|
|00000710| 2c 20 69 2e 65 2e 20 72 | 67 62 20 61 72 65 20 74 |, i.e. r|gb are t|
|00000720| 68 65 20 73 61 6d 65 2c | 20 61 6e 64 20 62 6f 74 |he same,| and bot|
|00000730| 68 20 0a 58 20 20 20 73 | 74 61 6e 64 61 72 64 20 |h .X s|tandard |
|00000740| 66 6f 72 6d 61 74 20 61 | 6e 64 20 62 79 74 65 2d |format a|nd byte-|
|00000750| 65 6e 63 6f 64 65 64 20 | 66 6f 72 6d 61 74 29 20 |encoded |format) |
|00000760| 74 6f 20 61 20 31 2d 62 | 69 74 20 64 65 70 74 68 |to a 1-b|it depth|
|00000770| 20 6d 6f 6e 6f 20 73 75 | 6e 0a 58 20 20 20 72 61 | mono su|n.X ra|
|00000780| 73 74 65 72 20 66 69 6c | 65 2e 20 49 66 20 79 6f |ster fil|e. If yo|
|00000790| 75 72 20 63 6f 6c 6f 72 | 20 69 6d 61 67 65 20 68 |ur color| image h|
|000007a0| 61 73 20 6e 6f 20 63 6f | 6c 6f 72 6d 61 70 2c 20 |as no co|lormap, |
|000007b0| 74 68 69 73 20 70 72 6f | 67 72 61 6d 20 77 6f 75 |this pro|gram wou|
|000007c0| 6c 64 0a 58 20 20 20 70 | 72 6f 76 69 64 65 20 61 |ld.X p|rovide a|
|000007d0| 20 64 65 66 61 75 6c 74 | 20 67 72 65 79 20 73 63 | default| grey sc|
|000007e0| 61 6c 65 20 63 6f 6c 6f | 72 20 6d 61 70 2e 20 49 |ale colo|r map. I|
|000007f0| 74 20 69 6d 70 6c 65 6d | 65 6e 74 73 20 73 65 76 |t implem|ents sev|
|00000800| 65 72 61 6c 20 68 61 6c | 66 74 6f 6e 65 0a 58 20 |eral hal|ftone.X |
|00000810| 20 20 61 6c 67 6f 72 69 | 74 68 6d 73 20 66 72 6f | algori|thms fro|
|00000820| 6d 20 44 69 67 69 74 61 | 6c 20 48 61 6c 66 74 6f |m Digita|l Halfto|
|00000830| 6e 65 73 20 62 79 20 44 | 6f 74 20 44 69 66 66 75 |nes by D|ot Diffu|
|00000840| 73 69 6f 6e 20 69 6e 20 | 61 63 6d 20 54 72 61 6e |sion in |acm Tran|
|00000850| 73 61 63 74 69 6f 6e 73 | 20 0a 58 20 20 20 6f 6e |sactions| .X on|
|00000860| 20 47 72 61 70 68 69 63 | 73 2c 20 73 75 63 68 20 | Graphic|s, such |
|00000870| 61 73 20 65 72 72 6f 72 | 20 64 69 66 66 75 73 69 |as error| diffusi|
|00000880| 6f 6e 2c 20 6f 72 64 65 | 72 65 64 20 64 69 74 68 |on, orde|red dith|
|00000890| 65 72 20 61 6e 64 20 64 | 6f 74 20 64 69 66 66 75 |er and d|ot diffu|
|000008a0| 73 69 6f 6e 0a 58 20 20 | 20 77 69 74 68 20 61 6e |sion.X | with an|
|000008b0| 64 20 77 69 74 68 6f 75 | 74 20 65 64 67 65 20 65 |d withou|t edge e|
|000008c0| 6e 68 61 6e 63 65 6d 65 | 6e 74 2e 20 20 4a 75 73 |nhanceme|nt. Jus|
|000008d0| 74 20 74 79 70 65 20 38 | 74 6f 31 2c 20 69 74 20 |t type 8|to1, it |
|000008e0| 77 69 6c 6c 20 67 69 76 | 65 20 79 6f 75 0a 58 20 |will giv|e you.X |
|000008f0| 20 20 74 68 65 20 75 73 | 61 67 65 2e 0a 58 0a 58 | the us|age..X.X|
|00000900| 20 20 20 54 68 65 20 70 | 72 6f 67 72 61 6d 20 22 | The p|rogram "|
|00000910| 73 63 6c 6f 61 64 22 20 | 69 73 20 6c 69 6b 65 20 |scload" |is like |
|00000920| 53 75 6e 27 73 20 22 73 | 63 72 65 65 6e 6c 6f 61 |Sun's "s|creenloa|
|00000930| 64 22 20 70 72 6f 67 72 | 61 6d 2c 20 62 75 74 20 |d" progr|am, but |
|00000940| 6d 6f 72 65 0a 58 20 20 | 20 65 6e 74 65 72 74 61 |more.X | enterta|
|00000950| 69 6e 69 6e 67 2c 20 61 | 6e 64 20 61 63 74 75 61 |ining, a|nd actua|
|00000960| 6c 6c 79 20 62 65 74 74 | 65 72 20 74 68 61 6e 20 |lly bett|er than |
|00000970| 73 63 72 65 65 6e 6c 6f | 61 64 2e 20 49 74 27 73 |screenlo|ad. It's|
|00000980| 20 77 72 69 74 74 65 6e | 0a 58 20 20 20 62 79 20 | written|.X by |
|00000990| 52 61 79 6d 6f 6e 64 20 | 4b 72 65 69 73 65 6c 2c |Raymond |Kreisel,|
|000009a0| 20 74 68 65 20 61 75 74 | 68 6f 72 20 6f 66 20 54 | the aut|hor of T|
|000009b0| 6f 75 63 68 75 70 2e 0a | 58 0a 58 0a 58 20 20 20 |ouchup..|X.X.X |
|000009c0| 54 68 65 20 70 72 6f 67 | 72 61 6d 20 38 74 6f 31 |The prog|ram 8to1|
|000009d0| 20 77 61 73 20 77 72 69 | 74 74 65 6e 20 62 79 20 | was wri|tten by |
|000009e0| 3a 0a 58 0a 58 09 48 6f | 6e 67 20 4d 69 6e 20 0a |:.X.X.Ho|ng Min .|
|000009f0| 58 09 43 6f 6d 70 75 74 | 65 72 20 53 63 69 65 6e |X.Comput|er Scien|
|00000a00| 63 65 20 44 65 70 61 72 | 74 6d 65 6e 74 0a 58 20 |ce Depar|tment.X |
|00000a10| 20 20 09 53 55 4e 59 20 | 61 74 20 53 74 6f 6e 79 | .SUNY |at Stony|
|00000a20| 20 42 72 6f 6f 6b 20 0a | 58 09 65 2d 6d 61 69 6c | Brook .|X.e-mail|
|00000a30| 20 61 64 64 72 65 73 73 | 20 3a 20 0a 58 09 09 55 | address| : .X..U|
|00000a40| 55 43 50 3a 20 7b 61 6c | 6c 65 67 72 61 2c 20 70 |UCP: {al|legra, p|
|00000a50| 68 69 6c 61 62 73 2c 20 | 70 79 72 61 6d 69 64 2c |hilabs, |pyramid,|
|00000a60| 20 72 65 73 65 61 72 63 | 68 7d 21 73 62 63 73 21 | researc|h}!sbcs!|
|00000a70| 72 61 69 6e 62 6f 77 0a | 58 09 09 41 52 50 41 2d |rainbow.|X..ARPA-|
|00000a80| 49 6e 74 65 72 6e 65 74 | 3a 20 72 61 69 6e 62 6f |Internet|: rainbo|
|00000a90| 77 40 73 62 63 73 2e 73 | 75 6e 79 73 62 2e 65 64 |w@sbcs.s|unysb.ed|
|00000aa0| 75 0a 58 09 09 43 53 6e | 65 74 3a 20 72 61 69 6e |u.X..CSn|et: rain|
|00000ab0| 62 6f 77 40 73 75 6e 79 | 2d 73 62 0a 58 0a 58 20 |bow@suny|-sb.X.X |
|00000ac0| 20 20 45 76 65 72 79 6f | 6e 65 20 69 73 20 77 65 | Everyo|ne is we|
|00000ad0| 6c 63 6f 6d 65 20 74 6f | 20 77 72 69 74 65 20 74 |lcome to| write t|
|00000ae0| 6f 20 6d 65 20 69 66 20 | 79 6f 75 20 6c 69 6b 65 |o me if |you like|
|00000af0| 20 74 68 65 20 70 72 6f | 67 72 61 6d 20 6f 72 20 | the pro|gram or |
|00000b00| 6e 6f 74 2e 0a 58 20 20 | 20 41 6e 64 20 77 65 6c |not..X | And wel|
|00000b10| 63 6f 6d 65 20 74 6f 20 | 6f 70 74 69 6d 69 7a 65 |come to |optimize|
|00000b20| 20 74 68 65 20 63 6f 64 | 65 2c 20 61 73 20 49 20 | the cod|e, as I |
|00000b30| 68 61 76 65 6e 27 74 20 | 66 6f 6f 6c 65 64 20 77 |haven't |fooled w|
|00000b40| 69 74 68 20 69 74 20 74 | 6f 0a 58 20 20 20 6d 61 |ith it t|o.X ma|
|00000b50| 6b 65 20 69 74 20 65 66 | 66 69 63 69 65 6e 74 20 |ke it ef|ficient |
|00000b60| 79 65 74 2e 0a 58 0a 58 | 09 09 45 6e 6a 6f 79 21 |yet..X.X|..Enjoy!|
|00000b70| 09 09 09 09 09 09 09 0a | 58 0a 45 4e 44 5f 4f 46 |........|X.END_OF|
|00000b80| 5f 52 45 41 44 4d 45 0a | 69 66 20 74 65 73 74 20 |_README.|if test |
|00000b90| 31 32 30 39 20 2d 6e 65 | 20 60 77 63 20 2d 63 20 |1209 -ne| `wc -c |
|00000ba0| 3c 52 45 41 44 4d 45 60 | 3b 20 74 68 65 6e 0a 20 |<README`|; then. |
|00000bb0| 20 20 20 65 63 68 6f 20 | 73 68 61 72 3a 20 5c 22 | echo |shar: \"|
|00000bc0| 52 45 41 44 4d 45 5c 22 | 20 75 6e 70 61 63 6b 65 |README\"| unpacke|
|00000bd0| 64 20 77 69 74 68 20 77 | 72 6f 6e 67 20 73 69 7a |d with w|rong siz|
|00000be0| 65 21 0a 66 69 0a 23 20 | 65 6e 64 20 6f 66 20 6f |e!.fi.# |end of o|
|00000bf0| 76 65 72 77 72 69 74 69 | 6e 67 20 63 68 65 63 6b |verwriti|ng check|
|00000c00| 0a 66 69 0a 69 66 20 74 | 65 73 74 20 2d 66 20 38 |.fi.if t|est -f 8|
|00000c10| 74 6f 31 2e 63 20 2d 61 | 20 22 24 7b 31 7d 22 20 |to1.c -a| "${1}" |
|00000c20| 21 3d 20 22 2d 63 22 20 | 3b 20 74 68 65 6e 20 0a |!= "-c" |; then .|
|00000c30| 20 20 65 63 68 6f 20 73 | 68 61 72 3a 20 57 69 6c | echo s|har: Wil|
|00000c40| 6c 20 6e 6f 74 20 6f 76 | 65 72 2d 77 72 69 74 65 |l not ov|er-write|
|00000c50| 20 65 78 69 73 74 69 6e | 67 20 66 69 6c 65 20 5c | existin|g file \|
|00000c60| 22 38 74 6f 31 2e 63 5c | 22 0a 65 6c 73 65 0a 65 |"8to1.c\|".else.e|
|00000c70| 63 68 6f 20 73 68 61 72 | 3a 20 45 78 74 72 61 63 |cho shar|: Extrac|
|00000c80| 74 69 6e 67 20 5c 22 38 | 74 6f 31 2e 63 5c 22 20 |ting \"8|to1.c\" |
|00000c90| 5c 28 31 36 39 33 39 20 | 63 68 61 72 61 63 74 65 |\(16939 |characte|
|00000ca0| 72 73 5c 29 0a 73 65 64 | 20 22 73 2f 5e 58 2f 2f |rs\).sed| "s/^X//|
|00000cb0| 22 20 3e 38 74 6f 31 2e | 63 20 3c 3c 27 45 4e 44 |" >8to1.|c <<'END|
|00000cc0| 5f 4f 46 5f 38 74 6f 31 | 2e 63 27 0a 58 2f 2a 2a |_OF_8to1|.c'.X/**|
|00000cd0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000ce0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000cf0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000d00| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00000d10| 2a 2a 2a 2a 2a 2a 2a 2a | 0a 58 20 43 6f 70 79 72 |********|.X Copyr|
|00000d20| 69 67 68 74 20 28 63 29 | 20 31 39 38 38 20 62 79 |ight (c)| 1988 by|
|00000d30| 20 48 6f 6e 67 20 4d 69 | 6e 0a 58 0a 58 20 20 20 | Hong Mi|n.X.X |
|00000d40| 63 6f 6d 70 69 6c 65 20 | 3a 20 63 63 20 2d 4f 20 |compile |: cc -O |
|00000d50| 2d 6f 20 38 74 6f 31 20 | 38 74 6f 31 2e 63 20 2d |-o 8to1 |8to1.c -|
|00000d60| 6c 70 69 78 72 65 63 74 | 20 0a 58 0a 58 20 20 20 |lpixrect| .X.X |
|00000d70| 54 68 65 20 70 72 6f 67 | 72 61 6d 20 38 74 6f 31 |The prog|ram 8to1|
|00000d80| 20 63 6f 6e 76 65 72 74 | 73 20 61 20 38 2d 62 69 | convert|s a 8-bi|
|00000d90| 74 20 64 65 70 74 68 20 | 73 75 6e 20 72 61 73 74 |t depth |sun rast|
|00000da0| 65 72 20 66 69 6c 65 20 | 28 62 6f 74 68 20 63 6f |er file |(both co|
|00000db0| 6c 6f 72 2c 20 0a 58 20 | 20 20 69 2e 65 2e 20 72 |lor, .X | i.e. r|
|00000dc0| 67 62 20 61 72 65 20 64 | 69 66 66 65 72 65 6e 74 |gb are d|ifferent|
|00000dd0| 2c 20 61 6e 64 20 67 72 | 65 79 2c 20 69 2e 65 2e |, and gr|ey, i.e.|
|00000de0| 20 72 67 62 20 61 72 65 | 20 74 68 65 20 73 61 6d | rgb are| the sam|
|00000df0| 65 2c 20 61 6e 64 20 62 | 6f 74 68 20 0a 58 20 20 |e, and b|oth .X |
|00000e00| 20 73 74 61 6e 64 61 72 | 64 20 66 6f 72 6d 61 74 | standar|d format|
|00000e10| 20 61 6e 64 20 62 79 74 | 65 2d 65 6e 63 6f 64 65 | and byt|e-encode|
|00000e20| 64 20 66 6f 72 6d 61 74 | 29 20 74 6f 20 61 20 31 |d format|) to a 1|
|00000e30| 2d 62 69 74 20 64 65 70 | 74 68 20 6d 6f 6e 6f 20 |-bit dep|th mono |
|00000e40| 73 75 6e 0a 58 20 20 20 | 72 61 73 74 65 72 20 66 |sun.X |raster f|
|00000e50| 69 6c 65 2e 20 49 66 20 | 79 6f 75 72 20 63 6f 6c |ile. If |your col|
|00000e60| 6f 72 20 69 6d 61 67 65 | 20 68 61 73 20 6e 6f 20 |or image| has no |
|00000e70| 63 6f 6c 6f 72 6d 61 70 | 2c 20 74 68 69 73 20 70 |colormap|, this p|
|00000e80| 72 6f 67 72 61 6d 20 77 | 6f 75 6c 64 0a 58 20 20 |rogram w|ould.X |
|00000e90| 20 70 72 6f 76 69 64 65 | 20 61 20 64 65 66 61 75 | provide| a defau|
|00000ea0| 6c 74 20 67 72 65 79 20 | 73 63 61 6c 65 20 63 6f |lt grey |scale co|
|00000eb0| 6c 6f 72 20 6d 61 70 2e | 20 49 74 20 69 6d 70 6c |lor map.| It impl|
|00000ec0| 65 6d 65 6e 74 73 20 73 | 65 76 65 72 61 6c 20 68 |ements s|everal h|
|00000ed0| 61 6c 66 74 6f 6e 65 0a | 58 20 20 20 61 6c 67 6f |alftone.|X algo|
|00000ee0| 72 69 74 68 6d 73 20 66 | 72 6f 6d 20 44 69 67 69 |rithms f|rom Digi|
|00000ef0| 74 61 6c 20 48 61 6c 66 | 74 6f 6e 65 73 20 62 79 |tal Half|tones by|
|00000f00| 20 44 6f 74 20 44 69 66 | 66 75 73 69 6f 6e 20 69 | Dot Dif|fusion i|
|00000f10| 6e 20 61 63 6d 20 54 72 | 61 6e 73 61 63 74 69 6f |n acm Tr|ansactio|
|00000f20| 6e 73 20 0a 58 20 20 20 | 6f 6e 20 47 72 61 70 68 |ns .X |on Graph|
|00000f30| 69 63 73 2c 20 73 75 63 | 68 20 61 73 20 65 72 72 |ics, suc|h as err|
|00000f40| 6f 72 20 64 69 66 66 75 | 73 69 6f 6e 2c 20 6f 72 |or diffu|sion, or|
|00000f50| 64 65 72 65 64 20 64 69 | 74 68 65 72 20 61 6e 64 |dered di|ther and|
|00000f60| 20 64 6f 74 20 64 69 66 | 66 75 73 69 6f 6e 0a 58 | dot dif|fusion.X|
|00000f70| 20 20 20 77 69 74 68 20 | 61 6e 64 20 77 69 74 68 | with |and with|
|00000f80| 6f 75 74 20 65 64 67 65 | 20 65 6e 68 61 6e 63 65 |out edge| enhance|
|00000f90| 6d 65 6e 74 2e 20 20 4a | 75 73 74 20 74 79 70 65 |ment. J|ust type|
|00000fa0| 20 38 74 6f 31 2c 20 69 | 74 20 77 69 6c 6c 20 67 | 8to1, i|t will g|
|00000fb0| 69 76 65 20 79 6f 75 0a | 58 20 20 20 74 68 65 20 |ive you.|X the |
|00000fc0| 75 73 61 67 65 2e 0a 58 | 0a 58 20 20 20 54 68 69 |usage..X|.X Thi|
|00000fd0| 73 20 70 72 6f 67 72 61 | 6d 20 77 61 73 20 77 72 |s progra|m was wr|
|00000fe0| 69 74 74 65 6e 20 62 79 | 20 3a 0a 58 0a 58 09 48 |itten by| :.X.X.H|
|00000ff0| 6f 6e 67 20 4d 69 6e 20 | 0a 58 09 43 6f 6d 70 75 |ong Min |.X.Compu|
|00001000| 74 65 72 20 53 63 69 65 | 6e 63 65 20 44 65 70 61 |ter Scie|nce Depa|
|00001010| 72 74 6d 65 6e 74 0a 58 | 20 20 20 09 53 55 4e 59 |rtment.X| .SUNY|
|00001020| 20 61 74 20 53 74 6f 6e | 79 20 42 72 6f 6f 6b 20 | at Ston|y Brook |
|00001030| 0a 58 09 65 2d 6d 61 69 | 6c 20 61 64 64 72 65 73 |.X.e-mai|l addres|
|00001040| 73 20 3a 20 0a 58 09 09 | 55 55 43 50 3a 20 7b 61 |s : .X..|UUCP: {a|
|00001050| 6c 6c 65 67 72 61 2c 20 | 70 68 69 6c 61 62 73 2c |llegra, |philabs,|
|00001060| 20 70 79 72 61 6d 69 64 | 2c 20 72 65 73 65 61 72 | pyramid|, resear|
|00001070| 63 68 7d 21 73 62 63 73 | 21 72 61 69 6e 62 6f 77 |ch}!sbcs|!rainbow|
|00001080| 0a 58 09 09 41 52 50 41 | 2d 49 6e 74 65 72 6e 65 |.X..ARPA|-Interne|
|00001090| 74 3a 20 72 61 69 6e 62 | 6f 77 40 73 62 63 73 2e |t: rainb|ow@sbcs.|
|000010a0| 73 75 6e 79 73 62 2e 65 | 64 75 0a 58 09 09 43 53 |sunysb.e|du.X..CS|
|000010b0| 6e 65 74 3a 20 72 61 69 | 6e 62 6f 77 40 73 75 6e |net: rai|nbow@sun|
|000010c0| 79 2d 73 62 0a 58 0a 58 | 20 20 20 45 76 65 72 79 |y-sb.X.X| Every|
|000010d0| 6f 6e 65 20 69 73 20 77 | 65 6c 63 6f 6d 65 20 74 |one is w|elcome t|
|000010e0| 6f 20 77 72 69 74 65 20 | 74 6f 20 6d 65 20 69 66 |o write |to me if|
|000010f0| 20 79 6f 75 20 6c 69 6b | 65 20 74 68 65 20 70 72 | you lik|e the pr|
|00001100| 6f 67 72 61 6d 20 6f 72 | 20 6e 6f 74 2e 0a 58 20 |ogram or| not..X |
|00001110| 20 20 41 6e 64 20 77 65 | 6c 63 6f 6d 65 20 74 6f | And we|lcome to|
|00001120| 20 6f 70 74 69 6d 69 7a | 65 20 74 68 65 20 63 6f | optimiz|e the co|
|00001130| 64 65 2c 20 61 73 20 49 | 20 68 61 76 65 6e 27 74 |de, as I| haven't|
|00001140| 20 66 6f 6f 6c 65 64 20 | 77 69 74 68 20 69 74 20 | fooled |with it |
|00001150| 74 6f 0a 58 20 20 20 6d | 61 6b 65 20 69 74 20 65 |to.X m|ake it e|
|00001160| 66 66 69 63 69 65 6e 74 | 20 79 65 74 2e 0a 58 0a |fficient| yet..X.|
|00001170| 58 09 09 45 6e 6a 6f 79 | 21 09 09 09 09 09 09 09 |X..Enjoy|!.......|
|00001180| 0a 58 0a 58 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |.X.X****|********|
|00001190| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000011a0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000011b0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000011c0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000011d0| 2f 0a 58 0a 58 0a 58 0a | 58 23 69 6e 63 6c 75 64 |/.X.X.X.|X#includ|
|000011e0| 65 20 3c 73 74 64 69 6f | 2e 68 3e 0a 58 23 69 6e |e <stdio|.h>.X#in|
|000011f0| 63 6c 75 64 65 20 3c 73 | 79 73 2f 74 79 70 65 73 |clude <s|ys/types|
|00001200| 2e 68 3e 0a 58 23 69 6e | 63 6c 75 64 65 20 3c 70 |.h>.X#in|clude <p|
|00001210| 69 78 72 65 63 74 2f 70 | 69 78 72 65 63 74 2e 68 |ixrect/p|ixrect.h|
|00001220| 3e 0a 58 23 69 6e 63 6c | 75 64 65 20 3c 70 69 78 |>.X#incl|ude <pix|
|00001230| 72 65 63 74 2f 6d 65 6d | 76 61 72 2e 68 3e 0a 58 |rect/mem|var.h>.X|
|00001240| 23 69 6e 63 6c 75 64 65 | 20 3c 70 69 78 72 65 63 |#include| <pixrec|
|00001250| 74 2f 70 72 5f 75 74 69 | 6c 2e 68 3e 0a 58 23 69 |t/pr_uti|l.h>.X#i|
|00001260| 6e 63 6c 75 64 65 20 3c | 70 69 78 72 65 63 74 2f |nclude <|pixrect/|
|00001270| 70 72 5f 69 6f 2e 68 3e | 0a 58 23 69 6e 63 6c 75 |pr_io.h>|.X#inclu|
|00001280| 64 65 20 3c 72 61 73 74 | 65 72 66 69 6c 65 2e 68 |de <rast|erfile.h|
|00001290| 3e 0a 58 0a 58 23 64 65 | 66 69 6e 65 20 4f 52 44 |>.X.X#de|fine ORD|
|000012a0| 45 52 20 20 20 31 36 20 | 20 20 20 20 20 2f 2a 20 |ER 16 | /* |
|000012b0| 64 69 74 68 65 72 20 6d | 61 74 72 69 78 20 6f 72 |dither m|atrix or|
|000012c0| 64 65 72 20 2a 2f 0a 58 | 23 64 65 66 69 6e 65 20 |der */.X|#define |
|000012d0| 57 48 49 54 45 20 20 20 | 30 20 20 20 20 20 20 20 |WHITE |0 |
|000012e0| 2f 2a 20 62 61 63 6b 67 | 72 6f 75 6e 64 20 63 6f |/* backg|round co|
|000012f0| 6c 6f 72 20 2a 2f 0a 58 | 23 64 65 66 69 6e 65 20 |lor */.X|#define |
|00001300| 42 4c 41 43 4b 20 20 20 | 7e 30 20 20 20 20 20 20 |BLACK |~0 |
|00001310| 2f 2a 20 66 6f 72 65 67 | 72 6f 75 6e 64 20 63 6f |/* foreg|round co|
|00001320| 6c 6f 72 20 2a 2f 0a 58 | 23 64 65 66 69 6e 65 20 |lor */.X|#define |
|00001330| 46 41 4c 53 45 09 30 0a | 58 23 64 65 66 69 6e 65 |FALSE.0.|X#define|
|00001340| 20 54 52 55 45 09 31 0a | 58 23 64 65 66 69 6e 65 | TRUE.1.|X#define|
|00001350| 20 41 4c 50 48 41 09 37 | 0a 58 23 64 65 66 69 6e | ALPHA.7|.X#defin|
|00001360| 65 20 42 45 54 41 09 33 | 0a 58 23 64 65 66 69 6e |e BETA.3|.X#defin|
|00001370| 65 20 47 41 4d 4d 41 09 | 35 0a 58 23 64 65 66 69 |e GAMMA.|5.X#defi|
|00001380| 6e 65 20 44 45 4c 54 41 | 09 31 0a 58 0a 58 73 68 |ne DELTA|.1.X.Xsh|
|00001390| 6f 72 74 09 2a 2a 41 2c | 20 2a 2a 42 3b 0a 58 69 |ort.**A,| **B;.Xi|
|000013a0| 6e 74 09 6f 72 64 65 72 | 65 64 5f 64 69 74 68 65 |nt.order|ed_dithe|
|000013b0| 72 5b 38 5d 5b 38 5d 20 | 3d 20 7b 20 30 2c 20 33 |r[8][8] |= { 0, 3|
|000013c0| 32 2c 20 20 38 2c 20 34 | 30 2c 20 20 32 2c 20 33 |2, 8, 4|0, 2, 3|
|000013d0| 34 2c 20 31 30 2c 20 34 | 32 2c 0a 58 09 09 09 09 |4, 10, 4|2,.X....|
|000013e0| 34 38 2c 20 31 36 2c 20 | 35 36 2c 20 32 34 2c 20 |48, 16, |56, 24, |
|000013f0| 35 30 2c 20 31 38 2c 20 | 35 38 2c 20 32 36 2c 0a |50, 18, |58, 26,.|
|00001400| 58 09 09 09 09 31 32 2c | 20 34 34 2c 20 20 34 2c |X....12,| 44, 4,|
|00001410| 20 33 36 2c 20 31 34 2c | 20 34 36 2c 20 20 36 2c | 36, 14,| 46, 6,|
|00001420| 20 33 38 2c 0a 58 09 09 | 09 09 36 30 2c 20 32 38 | 38,.X..|..60, 28|
|00001430| 2c 20 35 32 2c 20 32 30 | 2c 20 36 32 2c 20 33 30 |, 52, 20|, 62, 30|
|00001440| 2c 20 35 34 2c 20 32 32 | 2c 0a 58 09 09 09 09 20 |, 54, 22|,.X.... |
|00001450| 33 2c 20 33 35 2c 20 31 | 31 2c 20 34 33 2c 20 20 |3, 35, 1|1, 43, |
|00001460| 31 2c 20 33 33 2c 20 20 | 39 2c 20 34 31 2c 0a 58 |1, 33, |9, 41,.X|
|00001470| 09 09 09 09 35 31 2c 20 | 31 39 2c 20 35 39 2c 20 |....51, |19, 59, |
|00001480| 32 37 2c 20 34 39 2c 20 | 31 37 2c 20 35 37 2c 20 |27, 49, |17, 57, |
|00001490| 32 35 2c 0a 58 09 09 09 | 09 31 35 2c 20 34 37 2c |25,.X...|.15, 47,|
|000014a0| 20 20 37 2c 20 33 39 2c | 20 31 33 2c 20 34 35 2c | 7, 39,| 13, 45,|
|000014b0| 20 20 35 2c 20 33 37 2c | 0a 58 09 09 09 09 36 33 | 5, 37,|.X....63|
|000014c0| 2c 20 33 31 2c 20 35 35 | 2c 20 32 33 2c 20 36 31 |, 31, 55|, 23, 61|
|000014d0| 2c 20 32 39 2c 20 35 33 | 2c 20 32 31 20 7d 3b 0a |, 29, 53|, 21 };.|
|000014e0| 58 69 6e 74 09 64 6f 74 | 5f 64 69 66 66 75 73 69 |Xint.dot|_diffusi|
|000014f0| 6f 6e 5b 38 5d 5b 38 5d | 20 3d 20 7b 09 33 34 2c |on[8][8]| = {.34,|
|00001500| 20 34 38 2c 20 34 30 2c | 20 33 32 2c 20 32 39 2c | 48, 40,| 32, 29,|
|00001510| 20 31 35 2c 20 32 33 2c | 20 33 31 2c 0a 58 09 09 | 15, 23,| 31,.X..|
|00001520| 09 09 34 32 2c 20 35 38 | 2c 20 35 36 2c 20 35 33 |..42, 58|, 56, 53|
|00001530| 2c 20 32 31 2c 20 20 35 | 2c 20 20 37 2c 20 31 30 |, 21, 5|, 7, 10|
|00001540| 2c 0a 58 09 09 09 09 35 | 30 2c 20 36 32 2c 20 36 |,.X....5|0, 62, 6|
|00001550| 31 2c 20 34 35 2c 20 31 | 33 2c 20 20 31 2c 20 20 |1, 45, 1|3, 1, |
|00001560| 32 2c 20 31 38 2c 0a 58 | 09 09 09 09 33 38 2c 20 |2, 18,.X|....38, |
|00001570| 34 36 2c 20 35 34 2c 20 | 33 37 2c 20 32 35 2c 20 |46, 54, |37, 25, |
|00001580| 31 37 2c 20 20 39 2c 20 | 32 36 2c 0a 58 09 09 09 |17, 9, |26,.X...|
|00001590| 09 32 38 2c 20 31 34 2c | 20 32 32 2c 20 33 30 2c |.28, 14,| 22, 30,|
|000015a0| 20 33 35 2c 20 34 39 2c | 20 34 31 2c 20 33 33 2c | 35, 49,| 41, 33,|
|000015b0| 0a 58 09 09 09 09 32 30 | 2c 20 20 34 2c 20 20 36 |.X....20|, 4, 6|
|000015c0| 2c 20 31 31 2c 20 34 33 | 2c 20 35 39 2c 20 35 37 |, 11, 43|, 59, 57|
|000015d0| 2c 20 35 32 2c 0a 58 09 | 09 09 09 31 32 2c 20 20 |, 52,.X.|...12, |
|000015e0| 30 2c 20 20 33 2c 20 31 | 39 2c 20 35 31 2c 20 36 |0, 3, 1|9, 51, 6|
|000015f0| 33 2c 20 36 30 2c 20 34 | 34 2c 0a 58 09 09 09 09 |3, 60, 4|4,.X....|
|00001600| 32 34 2c 20 31 36 2c 20 | 20 38 2c 20 32 37 2c 20 |24, 16, | 8, 27, |
|00001610| 33 39 2c 20 34 37 2c 20 | 35 35 2c 20 33 36 20 7d |39, 47, |55, 36 }|
|00001620| 3b 0a 58 69 6e 74 09 72 | 65 76 65 72 73 65 5f 6d |;.Xint.r|everse_m|
|00001630| 61 74 72 69 78 5b 36 34 | 5d 20 3d 20 7b 09 34 39 |atrix[64|] = {.49|
|00001640| 2c 20 32 31 2c 20 32 32 | 2c 20 35 30 2c 20 34 31 |, 21, 22|, 50, 41|
|00001650| 2c 20 31 33 2c 20 34 32 | 2c 20 31 34 2c 0a 58 09 |, 13, 42|, 14,.X.|
|00001660| 09 09 09 35 38 2c 20 33 | 30 2c 20 31 35 2c 20 34 |...58, 3|0, 15, 4|
|00001670| 33 2c 20 34 38 2c 20 32 | 30 2c 20 33 33 2c 20 20 |3, 48, 2|0, 33, |
|00001680| 35 2c 20 0a 58 09 09 09 | 09 35 37 2c 20 32 39 2c |5, .X...|.57, 29,|
|00001690| 20 32 33 2c 20 35 31 2c | 20 34 30 2c 20 31 32 2c | 23, 51,| 40, 12,|
|000016a0| 20 33 34 2c 20 20 36 2c | 0a 58 09 09 09 09 35 36 | 34, 6,|.X....56|
|000016b0| 2c 20 32 38 2c 20 33 31 | 2c 20 35 39 2c 20 33 32 |, 28, 31|, 59, 32|
|000016c0| 2c 20 20 34 2c 20 33 35 | 2c 20 20 37 2c 0a 58 09 |, 4, 35|, 7,.X.|
|000016d0| 09 09 09 20 33 2c 20 33 | 39 2c 20 20 30 2c 20 33 |... 3, 3|9, 0, 3|
|000016e0| 36 2c 20 36 33 2c 20 32 | 37 2c 20 32 34 2c 20 36 |6, 63, 2|7, 24, 6|
|000016f0| 30 2c 0a 58 09 09 09 09 | 20 32 2c 20 33 38 2c 20 |0,.X....| 2, 38, |
|00001700| 20 38 2c 20 34 34 2c 20 | 35 35 2c 20 31 39 2c 20 | 8, 44, |55, 19, |
|00001710| 32 35 2c 20 36 31 2c 0a | 58 09 09 09 09 20 31 2c |25, 61,.|X.... 1,|
|00001720| 20 33 37 2c 20 31 36 2c | 20 35 32 2c 20 34 37 2c | 37, 16,| 52, 47,|
|00001730| 20 31 31 2c 20 32 36 2c | 20 36 32 2c 0a 58 09 09 | 11, 26,| 62,.X..|
|00001740| 09 09 31 30 2c 20 34 36 | 2c 20 20 39 2c 20 34 35 |..10, 46|, 9, 45|
|00001750| 2c 20 35 34 2c 20 31 38 | 2c 20 31 37 2c 20 35 33 |, 54, 18|, 17, 53|
|00001760| 20 7d 3b 0a 58 0a 58 0a | 58 6d 61 69 6e 28 61 72 | };.X.X.|Xmain(ar|
|00001770| 67 63 2c 20 61 72 67 76 | 29 0a 58 69 6e 74 09 61 |gc, argv|).Xint.a|
|00001780| 72 67 63 3b 0a 58 63 68 | 61 72 09 2a 61 72 67 76 |rgc;.Xch|ar.*argv|
|00001790| 5b 5d 3b 0a 58 7b 0a 58 | 72 65 67 69 73 74 65 72 |[];.X{.X|register|
|000017a0| 20 63 6f 6c 6f 72 6d 61 | 70 5f 74 20 09 09 63 6f | colorma|p_t ..co|
|000017b0| 6c 6f 72 6d 61 70 3b 0a | 58 72 65 67 69 73 74 65 |lormap;.|Xregiste|
|000017c0| 72 20 75 6e 73 69 67 6e | 65 64 20 63 68 61 72 09 |r unsign|ed char.|
|000017d0| 09 2a 6d 61 70 3b 0a 58 | 72 65 67 69 73 74 65 72 |.*map;.X|register|
|000017e0| 20 73 74 72 75 63 74 20 | 72 61 73 74 65 72 66 69 | struct |rasterfi|
|000017f0| 6c 65 09 72 68 3b 0a 58 | 72 65 67 69 73 74 65 72 |le.rh;.X|register|
|00001800| 20 50 69 78 72 65 63 74 | 20 09 09 2a 70 72 20 3d | Pixrect| ..*pr =|
|00001810| 20 30 3b 0a 58 72 65 67 | 69 73 74 65 72 20 69 6e | 0;.Xreg|ister in|
|00001820| 74 09 09 09 69 2c 20 64 | 65 66 61 75 6c 74 5f 6d |t...i, d|efault_m|
|00001830| 61 70 20 3d 20 46 41 4c | 53 45 3b 0a 58 69 6e 74 |ap = FAL|SE;.Xint|
|00001840| 09 09 09 09 6f 70 74 69 | 6f 6e 3b 0a 58 0a 58 09 |....opti|on;.X.X.|
|00001850| 69 66 20 28 28 61 72 67 | 63 20 3e 20 34 29 20 7c |if ((arg|c > 4) ||
|00001860| 7c 20 28 61 72 67 63 20 | 3c 20 32 29 29 20 7b 0a || (argc |< 2)) {.|
|00001870| 58 09 20 20 20 66 70 72 | 69 6e 74 66 28 73 74 64 |X. fpr|intf(std|
|00001880| 65 72 72 2c 20 22 55 73 | 61 67 65 3a 20 25 73 20 |err, "Us|age: %s |
|00001890| 6f 70 74 69 6f 6e 20 5b | 69 6e 66 69 6c 65 20 5b |option [|infile [|
|000018a0| 6f 75 74 66 69 6c 65 5d | 5d 5c 6e 22 2c 20 61 72 |outfile]|]\n", ar|
|000018b0| 67 76 5b 30 5d 29 3b 0a | 58 09 20 20 20 66 70 72 |gv[0]);.|X. fpr|
|000018c0| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 6f 70 |intf(std|err, "op|
|000018d0| 74 69 6f 6e 20 3a 20 30 | 20 2d 2d 20 65 72 72 6f |tion : 0| -- erro|
|000018e0| 72 20 64 69 66 66 75 73 | 69 6f 6e 20 66 6f 72 20 |r diffus|ion for |
|000018f0| 67 72 65 79 20 73 63 61 | 6c 65 5c 6e 22 29 3b 0a |grey sca|le\n");.|
|00001900| 58 09 20 20 20 66 70 72 | 69 6e 74 66 28 73 74 64 |X. fpr|intf(std|
|00001910| 65 72 72 2c 20 22 20 20 | 20 20 20 20 20 20 20 31 |err, " | 1|
|00001920| 20 2d 2d 20 6f 72 64 65 | 72 65 64 20 64 69 74 68 | -- orde|red dith|
|00001930| 65 72 20 66 6f 72 20 67 | 72 65 79 20 73 63 61 6c |er for g|rey scal|
|00001940| 65 5c 6e 22 29 3b 0a 58 | 09 20 20 20 66 70 72 69 |e\n");.X|. fpri|
|00001950| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 20 20 20 |ntf(stde|rr, " |
|00001960| 20 20 20 20 20 20 32 20 | 2d 2d 20 64 6f 74 20 64 | 2 |-- dot d|
|00001970| 69 66 66 75 73 69 6f 6e | 20 66 6f 72 20 67 72 65 |iffusion| for gre|
|00001980| 79 20 73 63 61 6c 65 5c | 6e 22 29 3b 0a 58 09 20 |y scale\|n");.X. |
|00001990| 20 20 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 | fprint|f(stderr|
|000019a0| 2c 20 22 20 20 20 20 20 | 20 20 20 20 33 20 2d 2d |, " | 3 --|
|000019b0| 20 65 72 72 6f 72 20 64 | 69 66 66 75 73 69 6f 6e | error d|iffusion|
|000019c0| 20 66 6f 72 20 67 72 65 | 79 20 73 63 61 6c 65 20 | for gre|y scale |
|000019d0| 77 69 74 68 20 65 64 67 | 65 20 65 6e 68 61 6e 63 |with edg|e enhanc|
|000019e0| 65 6d 65 6e 74 5c 6e 22 | 29 3b 0a 58 09 20 20 20 |ement\n"|);.X. |
|000019f0| 66 70 72 69 6e 74 66 28 | 73 74 64 65 72 72 2c 20 |fprintf(|stderr, |
|00001a00| 22 20 20 20 20 20 20 20 | 20 20 34 20 2d 2d 20 6f |" | 4 -- o|
|00001a10| 72 64 65 72 65 64 20 64 | 69 74 68 65 72 20 66 6f |rdered d|ither fo|
|00001a20| 72 20 67 72 65 79 20 73 | 63 61 6c 65 20 77 69 74 |r grey s|cale wit|
|00001a30| 68 20 65 64 67 65 20 65 | 6e 68 61 6e 63 65 6d 65 |h edge e|nhanceme|
|00001a40| 6e 74 5c 6e 22 29 3b 0a | 58 09 20 20 20 66 70 72 |nt\n");.|X. fpr|
|00001a50| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 20 20 |intf(std|err, " |
|00001a60| 20 20 20 20 20 20 20 35 | 20 2d 2d 20 64 6f 74 20 | 5| -- dot |
|00001a70| 64 69 66 66 75 73 69 6f | 6e 20 66 6f 72 20 67 72 |diffusio|n for gr|
|00001a80| 65 79 20 73 63 61 6c 65 | 20 77 69 74 68 20 65 64 |ey scale| with ed|
|00001a90| 67 65 20 65 6e 68 61 6e | 63 65 6d 65 6e 74 5c 6e |ge enhan|cement\n|
|00001aa0| 22 29 3b 0a 58 09 20 20 | 20 66 70 72 69 6e 74 66 |");.X. | fprintf|
|00001ab0| 28 73 74 64 65 72 72 2c | 20 22 20 20 20 20 20 20 |(stderr,| " |
|00001ac0| 20 20 20 36 20 2d 2d 20 | 65 72 72 6f 72 20 64 69 | 6 -- |error di|
|00001ad0| 66 66 75 73 69 6f 6e 20 | 66 6f 72 20 63 6f 6c 6f |ffusion |for colo|
|00001ae0| 72 5c 6e 22 29 3b 0a 58 | 09 20 20 20 66 70 72 69 |r\n");.X|. fpri|
|00001af0| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 20 20 20 |ntf(stde|rr, " |
|00001b00| 20 20 20 20 20 20 37 20 | 2d 2d 20 6f 72 64 65 72 | 7 |-- order|
|00001b10| 65 64 20 64 69 74 68 65 | 72 20 66 6f 72 20 63 6f |ed dithe|r for co|
|00001b20| 6c 6f 72 5c 6e 22 29 3b | 0a 58 09 20 20 20 66 70 |lor\n");|.X. fp|
|00001b30| 72 69 6e 74 66 28 73 74 | 64 65 72 72 2c 20 22 20 |rintf(st|derr, " |
|00001b40| 20 20 20 20 20 20 20 20 | 38 20 2d 2d 20 64 6f 74 | |8 -- dot|
|00001b50| 20 64 69 66 66 75 73 69 | 6f 6e 20 66 6f 72 20 63 | diffusi|on for c|
|00001b60| 6f 6c 6f 72 5c 6e 22 29 | 3b 0a 58 09 20 20 20 66 |olor\n")|;.X. f|
|00001b70| 70 72 69 6e 74 66 28 73 | 74 64 65 72 72 2c 20 22 |printf(s|tderr, "|
|00001b80| 20 20 20 20 20 20 20 20 | 20 39 20 2d 2d 20 65 72 | | 9 -- er|
|00001b90| 72 6f 72 20 64 69 66 66 | 75 73 69 6f 6e 20 66 6f |ror diff|usion fo|
|00001ba0| 72 20 63 6f 6c 6f 72 20 | 77 69 74 68 20 65 64 67 |r color |with edg|
|00001bb0| 65 20 65 6e 68 61 6e 63 | 65 6d 65 6e 74 5c 6e 22 |e enhanc|ement\n"|
|00001bc0| 29 3b 0a 58 09 20 20 20 | 66 70 72 69 6e 74 66 28 |);.X. |fprintf(|
|00001bd0| 73 74 64 65 72 72 2c 20 | 22 20 20 20 20 20 20 20 |stderr, |" |
|00001be0| 20 31 30 20 2d 2d 20 6f | 72 64 65 72 65 64 20 64 | 10 -- o|rdered d|
|00001bf0| 69 74 68 65 72 20 66 6f | 72 20 63 6f 6c 6f 72 20 |ither fo|r color |
|00001c00| 77 69 74 68 20 65 64 67 | 65 20 65 6e 68 61 6e 63 |with edg|e enhanc|
|00001c10| 65 6d 65 6e 74 5c 6e 22 | 29 3b 0a 58 09 20 20 20 |ement\n"|);.X. |
|00001c20| 66 70 72 69 6e 74 66 28 | 73 74 64 65 72 72 2c 20 |fprintf(|stderr, |
|00001c30| 22 20 20 20 20 20 20 20 | 20 31 31 20 2d 2d 20 64 |" | 11 -- d|
|00001c40| 6f 74 20 64 69 66 66 75 | 73 69 6f 6e 20 66 6f 72 |ot diffu|sion for|
|00001c50| 20 63 6f 6c 6f 72 20 77 | 69 74 68 20 65 64 67 65 | color w|ith edge|
|00001c60| 20 65 6e 68 61 6e 63 65 | 6d 65 6e 74 5c 6e 22 29 | enhance|ment\n")|
|00001c70| 3b 0a 58 09 20 20 20 65 | 78 69 74 28 31 29 3b 0a |;.X. e|xit(1);.|
|00001c80| 58 09 7d 0a 58 0a 58 09 | 73 73 63 61 6e 66 28 61 |X.}.X.X.|sscanf(a|
|00001c90| 72 67 76 5b 31 5d 2c 20 | 22 25 64 22 2c 20 26 6f |rgv[1], |"%d", &o|
|00001ca0| 70 74 69 6f 6e 29 3b 0a | 58 0a 58 09 2f 2a 20 6f |ption);.|X.X./* o|
|00001cb0| 70 65 6e 20 74 68 65 20 | 69 6e 70 75 74 20 66 69 |pen the |input fi|
|00001cc0| 6c 65 20 69 66 20 73 70 | 65 63 69 66 69 65 64 20 |le if sp|ecified |
|00001cd0| 2a 2f 0a 58 09 69 66 20 | 28 28 61 72 67 63 20 3e |*/.X.if |((argc >|
|00001ce0| 20 32 29 20 26 26 20 28 | 66 72 65 6f 70 65 6e 28 | 2) && (|freopen(|
|00001cf0| 61 72 67 76 5b 32 5d 2c | 20 22 72 22 2c 20 73 74 |argv[2],| "r", st|
|00001d00| 64 69 6e 29 20 3d 3d 20 | 4e 55 4c 4c 29 29 20 7b |din) == |NULL)) {|
|00001d10| 0a 58 09 20 20 20 66 70 | 72 69 6e 74 66 28 73 74 |.X. fp|rintf(st|
|00001d20| 64 65 72 72 2c 20 22 63 | 61 6e 27 74 20 6f 70 65 |derr, "c|an't ope|
|00001d30| 6e 20 69 6e 66 69 6c 65 | 20 25 73 20 66 6f 72 20 |n infile| %s for |
|00001d40| 72 65 61 64 21 5c 6e 22 | 2c 20 61 72 67 76 5b 32 |read!\n"|, argv[2|
|00001d50| 5d 29 3b 0a 58 09 20 20 | 20 65 78 69 74 28 31 29 |]);.X. | exit(1)|
|00001d60| 3b 0a 58 09 7d 0a 58 0a | 58 09 2f 2a 20 6f 70 65 |;.X.}.X.|X./* ope|
|00001d70| 6e 20 74 68 65 20 6f 75 | 74 70 75 74 20 66 69 6c |n the ou|tput fil|
|00001d80| 65 20 69 66 20 73 70 65 | 63 69 66 69 65 64 20 2a |e if spe|cified *|
|00001d90| 2f 0a 58 09 69 66 20 28 | 28 61 72 67 63 20 3e 20 |/.X.if (|(argc > |
|00001da0| 33 29 20 26 26 20 28 66 | 72 65 6f 70 65 6e 28 61 |3) && (f|reopen(a|
|00001db0| 72 67 76 5b 33 5d 2c 20 | 22 77 22 2c 20 73 74 64 |rgv[3], |"w", std|
|00001dc0| 6f 75 74 29 20 3d 3d 20 | 4e 55 4c 4c 29 29 20 7b |out) == |NULL)) {|
|00001dd0| 0a 58 09 20 20 20 66 70 | 72 69 6e 74 66 28 73 74 |.X. fp|rintf(st|
|00001de0| 64 65 72 72 2c 20 22 63 | 61 6e 27 74 20 6f 70 65 |derr, "c|an't ope|
|00001df0| 6e 20 6f 75 74 66 69 6c | 65 20 25 73 20 66 6f 72 |n outfil|e %s for|
|00001e00| 20 77 72 69 74 65 21 5c | 6e 22 2c 20 61 72 67 76 | write!\|n", argv|
|00001e10| 5b 33 5d 29 3b 0a 58 09 | 20 20 20 65 78 69 74 28 |[3]);.X.| exit(|
|00001e20| 31 29 3b 0a 58 09 7d 0a | 58 0a 58 09 2f 2a 20 4c |1);.X.}.|X.X./* L|
|00001e30| 6f 61 64 20 74 68 65 20 | 69 6e 70 75 74 20 72 61 |oad the |input ra|
|00001e40| 73 74 65 72 66 69 6c 65 | 20 68 65 61 64 65 72 20 |sterfile| header |
|00001e50| 2a 2f 0a 58 09 69 66 20 | 28 70 72 5f 6c 6f 61 64 |*/.X.if |(pr_load|
|00001e60| 5f 68 65 61 64 65 72 28 | 73 74 64 69 6e 2c 20 26 |_header(|stdin, &|
|00001e70| 72 68 29 29 20 7b 0a 58 | 09 20 20 20 66 70 72 69 |rh)) {.X|. fpri|
|00001e80| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 72 65 61 |ntf(stde|rr, "rea|
|00001e90| 64 20 72 61 73 74 65 72 | 66 69 6c 65 20 68 65 61 |d raster|file hea|
|00001ea0| 64 65 72 20 65 72 72 6f | 72 5c 6e 22 29 3b 0a 58 |der erro|r\n");.X|
|00001eb0| 09 20 20 20 65 78 69 74 | 28 31 29 3b 0a 58 09 7d |. exit|(1);.X.}|
|00001ec0| 0a 58 09 20 20 20 0a 58 | 09 69 66 20 28 72 68 2e |.X. .X|.if (rh.|
|00001ed0| 72 61 73 5f 64 65 70 74 | 68 20 21 3d 20 38 29 20 |ras_dept|h != 8) |
|00001ee0| 7b 0a 58 09 20 20 20 66 | 70 72 69 6e 74 66 28 73 |{.X. f|printf(s|
|00001ef0| 74 64 65 72 72 2c 20 22 | 69 6e 70 75 74 20 66 69 |tderr, "|input fi|
|00001f00| 6c 65 20 69 73 20 6e 6f | 74 20 61 20 38 20 62 69 |le is no|t a 8 bi|
|00001f10| 74 73 20 64 65 65 70 5c | 6e 22 29 3b 0a 58 09 20 |ts deep\|n");.X. |
|00001f20| 20 20 65 78 69 74 28 31 | 29 3b 0a 58 09 7d 0a 58 | exit(1|);.X.}.X|
|00001f30| 0a 58 09 2f 2a 20 4c 6f | 61 64 20 74 68 65 20 63 |.X./* Lo|ad the c|
|00001f40| 6f 6c 6f 72 6d 61 70 20 | 2a 2f 0a 58 09 63 6f 6c |olormap |*/.X.col|
|00001f50| 6f 72 6d 61 70 2e 74 79 | 70 65 20 3d 20 52 4d 54 |ormap.ty|pe = RMT|
|00001f60| 5f 4e 4f 4e 45 3b 0a 58 | 09 69 66 20 28 70 72 5f |_NONE;.X|.if (pr_|
|00001f70| 6c 6f 61 64 5f 63 6f 6c | 6f 72 6d 61 70 28 73 74 |load_col|ormap(st|
|00001f80| 64 69 6e 2c 20 26 72 68 | 2c 20 26 63 6f 6c 6f 72 |din, &rh|, &color|
|00001f90| 6d 61 70 29 29 20 7b 0a | 58 09 20 20 20 66 70 72 |map)) {.|X. fpr|
|00001fa0| 69 6e 74 66 28 73 74 64 | 65 72 72 2c 20 22 72 65 |intf(std|err, "re|
|00001fb0| 61 64 20 72 61 73 74 65 | 72 66 69 6c 65 20 68 65 |ad raste|rfile he|
|00001fc0| 61 64 65 72 20 65 72 72 | 6f 72 5c 6e 22 29 3b 0a |ader err|or\n");.|
|00001fd0| 58 09 20 20 20 65 78 69 | 74 28 31 29 3b 0a 58 09 |X. exi|t(1);.X.|
|00001fe0| 7d 0a 58 0a 58 09 69 66 | 20 28 63 6f 6c 6f 72 6d |}.X.X.if| (colorm|
|00001ff0| 61 70 2e 74 79 70 65 20 | 21 3d 20 52 4d 54 5f 4e |ap.type |!= RMT_N|
|00002000| 4f 4e 45 20 26 26 0a 58 | 09 28 63 6f 6c 6f 72 6d |ONE &&.X|.(colorm|
|00002010| 61 70 2e 74 79 70 65 20 | 21 3d 20 52 4d 54 5f 45 |ap.type |!= RMT_E|
|00002020| 51 55 41 4c 5f 52 47 42 | 20 7c 7c 20 63 6f 6c 6f |QUAL_RGB| || colo|
|00002030| 72 6d 61 70 2e 6c 65 6e | 67 74 68 20 3c 20 32 35 |rmap.len|gth < 25|
|00002040| 36 29 29 20 7b 0a 58 09 | 20 20 20 66 70 72 69 6e |6)) {.X.| fprin|
|00002050| 74 66 28 73 74 64 65 72 | 72 2c 22 69 6e 70 75 74 |tf(stder|r,"input|
|00002060| 20 68 61 73 20 75 6e 73 | 75 70 70 6f 72 74 65 64 | has uns|upported|
|00002070| 20 63 6f 6c 6f 72 6d 61 | 70 20 74 79 70 65 20 6f | colorma|p type o|
|00002080| 72 20 6c 65 6e 67 74 68 | 5c 6e 22 29 3b 0a 58 09 |r length|\n");.X.|
|00002090| 20 20 20 65 78 69 74 28 | 31 29 3b 0a 58 09 7d 0a | exit(|1);.X.}.|
|000020a0| 58 0a 58 09 69 66 20 28 | 28 63 6f 6c 6f 72 6d 61 |X.X.if (|(colorma|
|000020b0| 70 2e 74 79 70 65 20 3d | 3d 20 52 4d 54 5f 4e 4f |p.type =|= RMT_NO|
|000020c0| 4e 45 29 20 26 26 20 28 | 63 6f 6c 6f 72 6d 61 70 |NE) && (|colormap|
|000020d0| 2e 6c 65 6e 67 74 68 20 | 3d 3d 20 30 29 29 20 7b |.length |== 0)) {|
|000020e0| 0a 58 09 20 20 20 64 65 | 66 61 75 6c 74 5f 6d 61 |.X. de|fault_ma|
|000020f0| 70 20 3d 20 54 52 55 45 | 3b 0a 58 09 20 20 20 6d |p = TRUE|;.X. m|
|00002100| 61 70 20 3d 20 28 75 6e | 73 69 67 6e 65 64 20 63 |ap = (un|signed c|
|00002110| 68 61 72 20 2a 29 20 6d | 61 6c 6c 6f 63 28 32 35 |har *) m|alloc(25|
|00002120| 36 29 3b 0a 58 09 20 20 | 20 66 6f 72 20 28 69 3d |6);.X. | for (i=|
|00002130| 30 3b 20 69 3c 32 35 36 | 3b 20 69 2b 2b 29 0a 58 |0; i<256|; i++).X|
|00002140| 09 09 6d 61 70 5b 69 5d | 20 3d 20 69 3b 0a 58 09 |..map[i]| = i;.X.|
|00002150| 7d 0a 58 09 20 20 20 0a | 58 09 69 66 20 28 72 68 |}.X. .|X.if (rh|
|00002160| 2e 72 61 73 5f 74 79 70 | 65 20 21 3d 20 52 54 5f |.ras_typ|e != RT_|
|00002170| 4f 4c 44 20 26 26 20 72 | 68 2e 72 61 73 5f 74 79 |OLD && r|h.ras_ty|
|00002180| 70 65 20 21 3d 20 52 54 | 5f 53 54 41 4e 44 41 52 |pe != RT|_STANDAR|
|00002190| 44 20 26 26 0a 58 09 21 | 28 70 72 20 3d 20 70 72 |D &&.X.!|(pr = pr|
|000021a0| 5f 6c 6f 61 64 5f 69 6d | 61 67 65 28 73 74 64 69 |_load_im|age(stdi|
|000021b0| 6e 2c 20 26 72 68 2c 20 | 26 63 6f 6c 6f 72 6d 61 |n, &rh, |&colorma|
|000021c0| 70 29 29 29 20 7b 0a 58 | 09 20 20 20 66 70 72 69 |p))) {.X|. fpri|
|000021d0| 6e 74 66 28 73 74 64 65 | 72 72 2c 20 22 65 72 72 |ntf(stde|rr, "err|
|000021e0| 6f 72 20 72 65 61 64 69 | 6e 67 20 72 61 73 74 65 |or readi|ng raste|
|000021f0| 72 66 69 6c 65 5c 6e 22 | 29 3b 0a 58 09 20 20 20 |rfile\n"|);.X. |
|00002200| 65 78 69 74 28 31 29 3b | 0a 58 09 7d 0a 58 0a 58 |exit(1);|.X.}.X.X|
|00002210| 09 2f 2a 20 57 72 69 74 | 65 20 6e 65 77 20 68 65 |./* Writ|e new he|
|00002220| 61 64 65 72 20 2a 2f 0a | 58 09 72 68 2e 72 61 73 |ader */.|X.rh.ras|
|00002230| 5f 74 79 70 65 20 3d 20 | 52 54 5f 53 54 41 4e 44 |_type = |RT_STAND|
|00002240| 41 52 44 3b 0a 58 09 72 | 68 2e 72 61 73 5f 64 65 |ARD;.X.r|h.ras_de|
|00002250| 70 74 68 20 3d 20 31 3b | 0a 58 09 72 68 2e 72 61 |pth = 1;|.X.rh.ra|
|00002260| 73 5f 6c 65 6e 67 74 68 | 20 3d 20 6d 70 72 5f 6c |s_length| = mpr_l|
|00002270| 69 6e 65 62 79 74 65 73 | 28 72 68 2e 72 61 73 5f |inebytes|(rh.ras_|
|00002280| 77 69 64 74 68 2c 20 31 | 29 20 2a 20 72 68 2e 72 |width, 1|) * rh.r|
|00002290| 61 73 5f 68 65 69 67 68 | 74 3b 0a 58 09 72 68 2e |as_heigh|t;.X.rh.|
|000022a0| 72 61 73 5f 6d 61 70 74 | 79 70 65 20 3d 20 52 4d |ras_mapt|ype = RM|
|000022b0| 54 5f 4e 4f 4e 45 3b 0a | 58 09 72 68 2e 72 61 73 |T_NONE;.|X.rh.ras|
|000022c0| 5f 6d 61 70 6c 65 6e 67 | 74 68 20 3d 20 30 3b 0a |_mapleng|th = 0;.|
|000022d0| 58 0a 58 09 69 66 20 28 | 70 72 5f 64 75 6d 70 5f |X.X.if (|pr_dump_|
|000022e0| 68 65 61 64 65 72 28 73 | 74 64 6f 75 74 2c 20 26 |header(s|tdout, &|
|000022f0| 72 68 2c 20 28 63 6f 6c | 6f 72 6d 61 70 5f 74 20 |rh, (col|ormap_t |
|00002300| 2a 29 20 30 29 20 3d 3d | 20 50 49 58 5f 45 52 52 |*) 0) ==| PIX_ERR|
|00002310| 29 20 7b 0a 58 09 20 20 | 20 66 70 72 69 6e 74 66 |) {.X. | fprintf|
|00002320| 28 73 74 64 65 72 72 2c | 20 22 65 72 72 6f 72 20 |(stderr,| "error |
|00002330| 73 61 76 69 6e 67 20 72 | 61 73 74 65 72 20 66 69 |saving r|aster fi|
|00002340| 6c 65 20 68 65 61 64 65 | 72 21 5c 6e 22 29 3b 0a |le heade|r!\n");.|
|00002350| 58 09 20 20 20 65 78 69 | 74 28 31 29 3b 0a 58 09 |X. exi|t(1);.X.|
|00002360| 7d 0a 58 0a 58 09 69 66 | 20 28 72 68 2e 72 61 73 |}.X.X.if| (rh.ras|
|00002370| 5f 77 69 64 74 68 20 3c | 3d 20 30 20 7c 7c 20 72 |_width <|= 0 || r|
|00002380| 68 2e 72 61 73 5f 68 65 | 69 67 68 74 20 3c 3d 20 |h.ras_he|ight <= |
|00002390| 30 29 0a 58 09 20 20 20 | 65 78 69 74 28 31 29 3b |0).X. |exit(1);|
|000023a0| 0a 58 09 65 6c 73 65 20 | 7b 0a 58 09 09 41 20 3d |.X.else |{.X..A =|
|000023b0| 20 28 73 68 6f 72 74 20 | 2a 2a 29 20 6d 61 6c 6c | (short |**) mall|
|000023c0| 6f 63 28 28 72 68 2e 72 | 61 73 5f 77 69 64 74 68 |oc((rh.r|as_width|
|000023d0| 2b 33 29 2a 73 69 7a 65 | 6f 66 28 73 68 6f 72 74 |+3)*size|of(short|
|000023e0| 20 2a 29 29 3b 0a 58 09 | 09 42 20 3d 20 28 73 68 | *));.X.|.B = (sh|
|000023f0| 6f 72 74 20 2a 2a 29 20 | 6d 61 6c 6c 6f 63 28 28 |ort **) |malloc((|
|00002400| 72 68 2e 72 61 73 5f 77 | 69 64 74 68 2b 33 29 2a |rh.ras_w|idth+3)*|
|00002410| 73 69 7a 65 6f 66 28 73 | 68 6f 72 74 20 2a 29 29 |sizeof(s|hort *))|
|00002420| 3b 0a 58 09 09 66 6f 72 | 28 69 3d 30 3b 20 69 3c |;.X..for|(i=0; i<|
|00002430| 72 68 2e 72 61 73 5f 77 | 69 64 74 68 2b 33 3b 20 |rh.ras_w|idth+3; |
|00002440| 69 2b 2b 29 20 7b 0a 58 | 09 09 20 20 20 41 5b 69 |i++) {.X|.. A[i|
|00002450| 5d 20 3d 20 28 73 68 6f | 72 74 20 2a 29 6d 61 6c |] = (sho|rt *)mal|
|00002460| 6c 6f 63 28 28 72 68 2e | 72 61 73 5f 68 65 69 67 |loc((rh.|ras_heig|
|00002470| 68 74 2b 33 29 2a 73 69 | 7a 65 6f 66 28 73 68 6f |ht+3)*si|zeof(sho|
|00002480| 72 74 29 29 3b 0a 58 09 | 09 20 20 20 42 5b 69 5d |rt));.X.|. B[i]|
|00002490| 20 3d 20 28 73 68 6f 72 | 74 20 2a 29 6d 61 6c 6c | = (shor|t *)mall|
|000024a0| 6f 63 28 28 72 68 2e 72 | 61 73 5f 68 65 69 67 68 |oc((rh.r|as_heigh|
|000024b0| 74 2b 33 29 2a 73 69 7a | 65 6f 66 28 73 68 6f 72 |t+3)*siz|eof(shor|
|000024c0| 74 29 29 3b 0a 58 09 09 | 7d 0a 58 09 7d 0a 58 0a |t));.X..|}.X.}.X.|
|000024d0| 58 09 69 66 20 28 21 64 | 65 66 61 75 6c 74 5f 6d |X.if (!d|efault_m|
|000024e0| 61 70 29 0a 58 09 20 20 | 20 6d 61 70 20 3d 20 63 |ap).X. | map = c|
|000024f0| 6f 6c 6f 72 6d 61 70 2e | 6d 61 70 5b 30 5d 3b 0a |olormap.|map[0];.|
|00002500| 58 0a 58 09 69 66 20 28 | 70 72 29 0a 58 09 20 20 |X.X.if (|pr).X. |
|00002510| 20 73 77 69 74 63 68 20 | 28 6f 70 74 69 6f 6e 29 | switch |(option)|
|00002520| 20 7b 0a 58 09 20 20 20 | 20 20 20 63 61 73 65 20 | {.X. | case |
|00002530| 36 20 20 3a 20 6d 61 70 | 20 3d 20 28 75 6e 73 69 |6 : map| = (unsi|
|00002540| 67 6e 65 64 20 63 68 61 | 72 20 2a 29 20 6d 61 6c |gned cha|r *) mal|
|00002550| 6c 6f 63 28 32 35 36 29 | 3b 0a 58 09 09 09 63 6f |loc(256)|;.X...co|
|00002560| 6c 6f 72 5f 6d 61 70 5f | 33 5f 74 6f 5f 31 28 63 |lor_map_|3_to_1(c|
|00002570| 6f 6c 6f 72 6d 61 70 2c | 20 6d 61 70 29 3b 20 0a |olormap,| map); .|
|00002580| 58 09 20 20 20 20 20 20 | 63 61 73 65 20 30 20 20 |X. |case 0 |
|00002590| 3a 09 65 72 72 6f 72 5f | 64 69 66 66 75 73 69 6f |:.error_|diffusio|
|000025a0| 6e 5f 69 6d 61 67 65 28 | 72 68 2e 72 61 73 5f 77 |n_image(|rh.ras_w|
|000025b0| 69 64 74 68 2c 20 72 68 | 2e 72 61 73 5f 68 65 69 |idth, rh|.ras_hei|
|000025c0| 67 68 74 2c 0a 58 09 09 | 09 6d 61 70 2c 20 28 75 |ght,.X..|.map, (u|
|000025d0| 5f 63 68 61 72 20 2a 29 | 20 6d 70 72 5f 64 28 70 |_char *)| mpr_d(p|
|000025e0| 72 29 2d 3e 6d 64 5f 69 | 6d 61 67 65 2c 20 73 74 |r)->md_i|mage, st|
|000025f0| 64 6f 75 74 2c 20 0a 58 | 09 09 09 30 2c 20 6d 70 |dout, .X|...0, mp|
|00002600| 72 5f 64 28 70 72 29 2d | 3e 6d 64 5f 6c 69 6e 65 |r_d(pr)-|>md_line|
|00002610| 62 79 74 65 73 20 2d 20 | 72 68 2e 72 61 73 5f 77 |bytes - |rh.ras_w|
|00002620| 69 64 74 68 29 3b 0a 58 | 09 09 09 62 72 65 61 6b |idth);.X|...break|
|00002630| 3b 0a 58 09 20 20 20 20 | 20 20 63 61 73 65 20 37 |;.X. | case 7|
|00002640| 20 20 3a 20 6d 61 70 20 | 3d 20 28 75 6e 73 69 67 | : map |= (unsig|
|00002650| 6e 65 64 20 63 68 61 72 | 20 2a 29 20 6d 61 6c 6c |ned char| *) mall|
|00002660| 6f 63 28 32 35 36 29 3b | 0a 58 09 09 09 63 6f 6c |oc(256);|.X...col|
|00002670| 6f 72 5f 6d 61 70 5f 33 | 5f 74 6f 5f 31 28 63 6f |or_map_3|_to_1(co|
|00002680| 6c 6f 72 6d 61 70 2c 20 | 6d 61 70 29 3b 0a 58 09 |lormap, |map);.X.|
|00002690| 20 20 20 20 20 20 63 61 | 73 65 20 31 20 20 3a 20 | ca|se 1 : |
|000026a0| 6f 72 64 65 72 65 64 5f | 64 69 74 68 65 72 5f 69 |ordered_|dither_i|
|000026b0| 6d 61 67 65 28 72 68 2e | 72 61 73 5f 77 69 64 74 |mage(rh.|ras_widt|
|000026c0| 68 2c 20 72 68 2e 72 61 | 73 5f 68 65 69 67 68 74 |h, rh.ra|s_height|
|000026d0| 2c 0a 58 09 09 09 6d 61 | 70 2c 20 28 75 5f 63 68 |,.X...ma|p, (u_ch|
|000026e0| 61 72 20 2a 29 20 6d 70 | 72 5f 64 28 70 72 29 2d |ar *) mp|r_d(pr)-|
|000026f0| 3e 6d 64 5f 69 6d 61 67 | 65 2c 20 73 74 64 6f 75 |>md_imag|e, stdou|
|00002700| 74 2c 0a 58 09 09 09 30 | 2c 20 6d 70 72 5f 64 28 |t,.X...0|, mpr_d(|
|00002710| 70 72 29 2d 3e 6d 64 5f | 6c 69 6e 65 62 79 74 65 |pr)->md_|linebyte|
|00002720| 73 20 2d 20 72 68 2e 72 | 61 73 5f 77 69 64 74 68 |s - rh.r|as_width|
|00002730| 29 3b 0a 58 09 09 09 62 | 72 65 61 6b 3b 0a 58 09 |);.X...b|reak;.X.|
|00002740| 20 20 20 20 20 20 63 61 | 73 65 20 38 20 20 3a 20 | ca|se 8 : |
|00002750| 6d 61 70 20 3d 20 28 75 | 6e 73 69 67 6e 65 64 20 |map = (u|nsigned |
|00002760| 63 68 61 72 20 2a 29 20 | 6d 61 6c 6c 6f 63 28 32 |char *) |malloc(2|
|00002770| 35 36 29 3b 0a 58 09 09 | 09 63 6f 6c 6f 72 5f 6d |56);.X..|.color_m|
|00002780| 61 70 5f 33 5f 74 6f 5f | 31 28 63 6f 6c 6f 72 6d |ap_3_to_|1(colorm|
|00002790| 61 70 2c 20 6d 61 70 29 | 3b 0a 58 09 20 20 20 20 |ap, map)|;.X. |
|000027a0| 20 20 63 61 73 65 20 32 | 20 20 3a 20 64 6f 74 5f | case 2| : dot_|
|000027b0| 64 69 66 66 75 73 69 6f | 6e 5f 69 6d 61 67 65 28 |diffusio|n_image(|
|000027c0| 72 68 2e 72 61 73 5f 77 | 69 64 74 68 2c 20 72 68 |rh.ras_w|idth, rh|
|000027d0| 2e 72 61 73 5f 68 65 69 | 67 68 74 2c 0a 58 09 09 |.ras_hei|ght,.X..|
|000027e0| 09 6d 61 70 2c 20 28 75 | 5f 63 68 61 72 20 2a 29 |.map, (u|_char *)|
|000027f0| 20 6d 70 72 5f 64 28 70 | 72 29 2d 3e 6d 64 5f 69 | mpr_d(p|r)->md_i|
|00002800| 6d 61 67 65 2c 20 73 74 | 64 6f 75 74 2c 20 0a 58 |mage, st|dout, .X|
|00002810| 09 09 09 30 2c 20 6d 70 | 72 5f 64 28 70 72 29 2d |...0, mp|r_d(pr)-|
|00002820| 3e 6d 64 5f 6c 69 6e 65 | 62 79 74 65 73 20 2d 20 |>md_line|bytes - |
|00002830| 72 68 2e 72 61 73 5f 77 | 69 64 74 68 29 3b 0a 58 |rh.ras_w|idth);.X|
|00002840| 09 09 09 62 72 65 61 6b | 3b 0a 58 09 20 20 20 20 |...break|;.X. |
|00002850| 20 20 63 61 73 65 20 39 | 20 20 3a 20 6d 61 70 20 | case 9| : map |
|00002860| 3d 20 28 75 6e 73 69 67 | 6e 65 64 20 63 68 61 72 |= (unsig|ned char|
|00002870| 20 2a 29 20 6d 61 6c 6c | 6f 63 28 32 35 36 29 3b | *) mall|oc(256);|
|00002880| 0a 58 09 09 09 63 6f 6c | 6f 72 5f 6d 61 70 5f 33 |.X...col|or_map_3|
|00002890| 5f 74 6f 5f 31 28 63 6f | 6c 6f 72 6d 61 70 2c 20 |_to_1(co|lormap, |
|000028a0| 6d 61 70 29 3b 0a 58 09 | 20 20 20 20 20 20 63 61 |map);.X.| ca|
|000028b0| 73 65 20 33 20 20 3a 09 | 65 72 72 6f 72 5f 64 69 |se 3 :.|error_di|
|000028c0| 66 66 75 73 69 6f 6e 5f | 69 6d 61 67 65 28 72 68 |ffusion_|image(rh|
|000028d0| 2e 72 61 73 5f 77 69 64 | 74 68 2c 20 72 68 2e 72 |.ras_wid|th, rh.r|
|000028e0| 61 73 5f 68 65 69 67 68 | 74 2c 0a 58 09 09 09 6d |as_heigh|t,.X...m|
|000028f0| 61 70 2c 20 28 75 5f 63 | 68 61 72 20 2a 29 20 6d |ap, (u_c|har *) m|
|00002900| 70 72 5f 64 28 70 72 29 | 2d 3e 6d 64 5f 69 6d 61 |pr_d(pr)|->md_ima|
|00002910| 67 65 2c 20 73 74 64 6f | 75 74 2c 20 0a 58 09 09 |ge, stdo|ut, .X..|
|00002920| 09 31 2c 20 6d 70 72 5f | 64 28 70 72 29 2d 3e 6d |.1, mpr_|d(pr)->m|
|00002930| 64 5f 6c 69 6e 65 62 79 | 74 65 73 20 2d 20 72 68 |d_lineby|tes - rh|
|00002940| 2e 72 61 73 5f 77 69 64 | 74 68 29 3b 0a 58 09 09 |.ras_wid|th);.X..|
|00002950| 09 62 72 65 61 6b 3b 0a | 58 09 20 20 20 20 20 20 |.break;.|X. |
|00002960| 63 61 73 65 20 31 30 20 | 3a 20 6d 61 70 20 3d 20 |case 10 |: map = |
|00002970| 28 75 6e 73 69 67 6e 65 | 64 20 63 68 61 72 20 2a |(unsigne|d char *|
|00002980| 29 20 6d 61 6c 6c 6f 63 | 28 32 35 36 29 3b 0a 58 |) malloc|(256);.X|
|00002990| 09 09 09 63 6f 6c 6f 72 | 5f 6d 61 70 5f 33 5f 74 |...color|_map_3_t|
|000029a0| 6f 5f 31 28 63 6f 6c 6f | 72 6d 61 70 2c 20 6d 61 |o_1(colo|rmap, ma|
|000029b0| 70 29 3b 0a 58 09 20 20 | 20 20 20 20 63 61 73 65 |p);.X. | case|
|000029c0| 20 34 20 20 3a 20 6f 72 | 64 65 72 65 64 5f 64 69 | 4 : or|dered_di|
|000029d0| 74 68 65 72 5f 69 6d 61 | 67 65 28 72 68 2e 72 61 |ther_ima|ge(rh.ra|
|000029e0| 73 5f 77 69 64 74 68 2c | 20 72 68 2e 72 61 73 5f |s_width,| rh.ras_|
|000029f0| 68 65 69 67 68 74 2c 0a | 58 09 09 09 6d 61 70 2c |height,.|X...map,|
|00002a00| 20 28 75 5f 63 68 61 72 | 20 2a 29 20 6d 70 72 5f | (u_char| *) mpr_|
|00002a10| 64 28 70 72 29 2d 3e 6d | 64 5f 69 6d 61 67 65 2c |d(pr)->m|d_image,|
|00002a20| 20 73 74 64 6f 75 74 2c | 20 0a 58 09 09 09 31 2c | stdout,| .X...1,|
|00002a30| 20 6d 70 72 5f 64 28 70 | 72 29 2d 3e 6d 64 5f 6c | mpr_d(p|r)->md_l|
|00002a40| 69 6e 65 62 79 74 65 73 | 20 2d 20 72 68 2e 72 61 |inebytes| - rh.ra|
|00002a50| 73 5f 77 69 64 74 68 29 | 3b 0a 58 09 09 09 62 72 |s_width)|;.X...br|
|00002a60| 65 61 6b 3b 0a 58 09 20 | 20 20 20 20 20 63 61 73 |eak;.X. | cas|
|00002a70| 65 20 31 31 20 3a 20 6d | 61 70 20 3d 20 28 75 6e |e 11 : m|ap = (un|
|00002a80| 73 69 67 6e 65 64 20 63 | 68 61 72 20 2a 29 20 6d |signed c|har *) m|
|00002a90| 61 6c 6c 6f 63 28 32 35 | 36 29 3b 0a 58 09 09 09 |alloc(25|6);.X...|
|00002aa0| 63 6f 6c 6f 72 5f 6d 61 | 70 5f 33 5f 74 6f 5f 31 |color_ma|p_3_to_1|
|00002ab0| 28 63 6f 6c 6f 72 6d 61 | 70 2c 20 6d 61 70 29 3b |(colorma|p, map);|
|00002ac0| 0a 58 09 20 20 20 20 20 | 20 63 61 73 65 20 35 20 |.X. | case 5 |
|00002ad0| 20 3a 20 64 6f 74 5f 64 | 69 66 66 75 73 69 6f 6e | : dot_d|iffusion|
|00002ae0| 5f 69 6d 61 67 65 28 72 | 68 2e 72 61 73 5f 77 69 |_image(r|h.ras_wi|
|00002af0| 64 74 68 2c 20 72 68 2e | 72 61 73 5f 68 65 69 67 |dth, rh.|ras_heig|
|00002b00| 68 74 2c 0a 58 09 09 09 | 6d 61 70 2c 20 28 75 5f |ht,.X...|map, (u_|
|00002b10| 63 68 61 72 20 2a 29 20 | 6d 70 72 5f 64 28 70 72 |char *) |mpr_d(pr|
|00002b20| 29 2d 3e 6d 64 5f 69 6d | 61 67 65 2c 20 73 74 64 |)->md_im|age, std|
|00002b30| 6f 75 74 2c 20 0a 58 09 | 09 09 31 2c 20 6d 70 72 |out, .X.|..1, mpr|
|00002b40| 5f 64 28 70 72 29 2d 3e | 6d 64 5f 6c 69 6e 65 62 |_d(pr)->|md_lineb|
|00002b50| 79 74 65 73 20 2d 20 72 | 68 2e 72 61 73 5f 77 69 |ytes - r|h.ras_wi|
|00002b60| 64 74 68 29 3b 0a 58 09 | 09 09 62 72 65 61 6b 3b |dth);.X.|..break;|
|00002b70| 0a 58 09 20 20 20 7d 0a | 58 09 65 6c 73 65 0a 58 |.X. }.|X.else.X|
|00002b80| 09 20 20 20 73 77 69 74 | 63 68 20 28 6f 70 74 69 |. swit|ch (opti|
|00002b90| 6f 6e 29 20 7b 0a 58 09 | 20 20 20 20 20 20 63 61 |on) {.X.| ca|
|00002ba0| 73 65 20 36 20 20 3a 20 | 6d 61 70 20 3d 20 28 75 |se 6 : |map = (u|
|00002bb0| 6e 73 69 67 6e 65 64 20 | 63 68 61 72 20 2a 29 20 |nsigned |char *) |
|00002bc0| 6d 61 6c 6c 6f 63 28 32 | 35 36 29 3b 0a 58 09 09 |malloc(2|56);.X..|
|00002bd0| 09 63 6f 6c 6f 72 5f 6d | 61 70 5f 33 5f 74 6f 5f |.color_m|ap_3_to_|
|00002be0| 31 28 63 6f 6c 6f 72 6d | 61 70 2c 20 6d 61 70 29 |1(colorm|ap, map)|
|00002bf0| 3b 0a 58 09 20 20 20 20 | 20 20 63 61 73 65 20 30 |;.X. | case 0|
|00002c00| 20 20 3a 20 65 72 72 6f | 72 5f 64 69 66 66 75 73 | : erro|r_diffus|
|00002c10| 69 6f 6e 5f 66 69 6c 65 | 28 72 68 2e 72 61 73 5f |ion_file|(rh.ras_|
|00002c20| 77 69 64 74 68 2c 20 72 | 68 2e 72 61 73 5f 68 65 |width, r|h.ras_he|
|00002c30| 69 67 68 74 2c 0a 58 09 | 09 09 6d 61 70 2c 20 73 |ight,.X.|..map, s|
|00002c40| 74 64 69 6e 2c 20 73 74 | 64 6f 75 74 2c 20 30 2c |tdin, st|dout, 0,|
|00002c50| 0a 58 09 09 09 6d 70 72 | 5f 6c 69 6e 65 62 79 74 |.X...mpr|_linebyt|
|00002c60| 65 73 28 72 68 2e 72 61 | 73 5f 77 69 64 74 68 2c |es(rh.ra|s_width,|
|00002c70| 20 38 29 20 2d 20 72 68 | 2e 72 61 73 5f 77 69 64 | 8) - rh|.ras_wid|
|00002c80| 74 68 29 3b 0a 58 09 09 | 09 62 72 65 61 6b 3b 0a |th);.X..|.break;.|
|00002c90| 58 09 20 20 20 20 20 20 | 63 61 73 65 20 37 20 20 |X. |case 7 |
|00002ca0| 3a 20 6d 61 70 20 3d 20 | 28 75 6e 73 69 67 6e 65 |: map = |(unsigne|
|00002cb0| 64 20 63 68 61 72 20 2a | 29 20 6d 61 6c 6c 6f 63 |d char *|) malloc|
|00002cc0| 28 32 35 36 29 3b 0a 58 | 09 09 09 63 6f 6c 6f 72 |(256);.X|...color|
|00002cd0| 5f 6d 61 70 5f 33 5f 74 | 6f 5f 31 28 63 6f 6c 6f |_map_3_t|o_1(colo|
|00002ce0| 72 6d 61 70 2c 20 6d 61 | 70 29 3b 0a 58 09 20 20 |rmap, ma|p);.X. |
|00002cf0| 20 20 20 20 63 61 73 65 | 20 31 20 20 3a 20 6f 72 | case| 1 : or|
|00002d00| 64 65 72 65 64 5f 64 69 | 74 68 65 72 5f 66 69 6c |dered_di|ther_fil|
|00002d10| 65 28 72 68 2e 72 61 73 | 5f 77 69 64 74 68 2c 20 |e(rh.ras|_width, |
|00002d20| 72 68 2e 72 61 73 5f 68 | 65 69 67 68 74 2c 0a 58 |rh.ras_h|eight,.X|
|00002d30| 09 09 09 6d 61 70 2c 20 | 73 74 64 69 6e 2c 20 73 |...map, |stdin, s|
|00002d40| 74 64 6f 75 74 2c 20 30 | 2c 0a 58 09 09 09 6d 70 |tdout, 0|,.X...mp|
|00002d50| 72 5f 6c 69 6e 65 62 79 | 74 65 73 28 72 68 2e 72 |r_lineby|tes(rh.r|
|00002d60| 61 73 5f 77 69 64 74 68 | 2c 20 38 29 20 2d 20 72 |as_width|, 8) - r|
|00002d70| 68 2e 72 61 73 5f 77 69 | 64 74 68 29 3b 0a 58 09 |h.ras_wi|dth);.X.|
|00002d80| 09 09 62 72 65 61 6b 3b | 0a 58 09 20 20 20 20 20 |..break;|.X. |
|00002d90| 20 63 61 73 65 20 38 20 | 20 3a 20 6d 61 70 20 3d | case 8 | : map =|
|00002da0| 20 28 75 6e 73 69 67 6e | 65 64 20 63 68 61 72 20 | (unsign|ed char |
|00002db0| 2a 29 20 6d 61 6c 6c 6f | 63 28 32 35 36 29 3b 0a |*) mallo|c(256);.|
|00002dc0| 58 09 09 09 63 6f 6c 6f | 72 5f 6d 61 70 5f 33 5f |X...colo|r_map_3_|
|00002dd0| 74 6f 5f 31 28 63 6f 6c | 6f 72 6d 61 70 2c 20 6d |to_1(col|ormap, m|
|00002de0| 61 70 29 3b 0a 58 09 20 | 20 20 20 20 20 63 61 73 |ap);.X. | cas|
|00002df0| 65 20 32 20 20 3a 20 64 | 6f 74 5f 64 69 66 66 75 |e 2 : d|ot_diffu|
|00002e00| 73 69 6f 6e 5f 66 69 6c | 65 28 72 68 2e 72 61 73 |sion_fil|e(rh.ras|
|00002e10| 5f 77 69 64 74 68 2c 20 | 72 68 2e 72 61 73 5f 68 |_width, |rh.ras_h|
|00002e20| 65 69 67 68 74 2c 0a 58 | 09 09 09 6d 61 70 2c 20 |eight,.X|...map, |
|00002e30| 73 74 64 69 6e 2c 20 73 | 74 64 6f 75 74 2c 20 30 |stdin, s|tdout, 0|
|00002e40| 2c 20 0a 58 09 09 09 6d | 70 72 5f 6c 69 6e 65 62 |, .X...m|pr_lineb|
|00002e50| 79 74 65 73 28 72 68 2e | 72 61 73 5f 77 69 64 74 |ytes(rh.|ras_widt|
|00002e60| 68 2c 20 38 29 20 2d 20 | 72 68 2e 72 61 73 5f 77 |h, 8) - |rh.ras_w|
|00002e70| 69 64 74 68 29 3b 0a 58 | 09 09 09 62 72 65 61 6b |idth);.X|...break|
|00002e80| 3b 0a 58 09 20 20 20 20 | 20 20 63 61 73 65 20 39 |;.X. | case 9|
|00002e90| 20 20 3a 20 6d 61 70 20 | 3d 20 28 75 6e 73 69 67 | : map |= (unsig|
|00002ea0| 6e 65 64 20 63 68 61 72 | 20 2a 29 20 6d 61 6c 6c |ned char| *) mall|
|00002eb0| 6f 63 28 32 35 36 29 3b | 0a 58 09 09 09 63 6f 6c |oc(256);|.X...col|
|00002ec0| 6f 72 5f 6d 61 70 5f 33 | 5f 74 6f 5f 31 28 63 6f |or_map_3|_to_1(co|
|00002ed0| 6c 6f 72 6d 61 70 2c 20 | 6d 61 70 29 3b 0a 58 09 |lormap, |map);.X.|
|00002ee0| 20 20 20 20 20 20 63 61 | 73 65 20 33 20 20 3a 20 | ca|se 3 : |
|00002ef0| 65 72 72 6f 72 5f 64 69 | 66 66 75 73 69 6f 6e 5f |error_di|ffusion_|
|00002f00| 66 69 6c 65 28 72 68 2e | 72 61 73 5f 77 69 64 74 |file(rh.|ras_widt|
|00002f10| 68 2c 20 72 68 2e 72 61 | 73 5f 68 65 69 67 68 74 |h, rh.ra|s_height|
|00002f20| 2c 0a 58 09 09 09 6d 61 | 70 2c 20 73 74 64 69 6e |,.X...ma|p, stdin|
|00002f30| 2c 20 73 74 64 6f 75 74 | 2c 20 31 2c 0a 58 09 09 |, stdout|, 1,.X..|
|00002f40| 09 6d 70 72 5f 6c 69 6e | 65 62 79 74 65 73 28 72 |.mpr_lin|ebytes(r|
|00002f50| 68 2e 72 61 73 5f 77 69 | 64 74 68 2c 20 38 29 20 |h.ras_wi|dth, 8) |
|00002f60| 2d 20 72 68 2e 72 61 73 | 5f 77 69 64 74 68 29 3b |- rh.ras|_width);|
|00002f70| 0a 58 09 09 09 62 72 65 | 61 6b 3b 0a 58 09 20 20 |.X...bre|ak;.X. |
|00002f80| 20 20 20 20 63 61 73 65 | 20 31 30 20 3a 20 6d 61 | case| 10 : ma|
|00002f90| 70 20 3d 20 28 75 6e 73 | 69 67 6e 65 64 20 63 68 |p = (uns|igned ch|
|00002fa0| 61 72 20 2a 29 20 6d 61 | 6c 6c 6f 63 28 32 35 36 |ar *) ma|lloc(256|
|00002fb0| 29 3b 0a 58 09 09 09 63 | 6f 6c 6f 72 5f 6d 61 70 |);.X...c|olor_map|
|00002fc0| 5f 33 5f 74 6f 5f 31 28 | 63 6f 6c 6f 72 6d 61 70 |_3_to_1(|colormap|
|00002fd0| 2c 20 6d 61 70 29 3b 0a | 58 09 20 20 20 20 20 20 |, map);.|X. |
|00002fe0| 63 61 73 65 20 34 20 20 | 3a 20 6f 72 64 65 72 65 |case 4 |: ordere|
|00002ff0| 64 5f 64 69 74 68 65 72 | 5f 66 69 6c 65 28 72 68 |d_dither|_file(rh|
|00003000| 2e 72 61 73 5f 77 69 64 | 74 68 2c 20 72 68 2e 72 |.ras_wid|th, rh.r|
|00003010| 61 73 5f 68 65 69 67 68 | 74 2c 0a 58 09 09 09 6d |as_heigh|t,.X...m|
|00003020| 61 70 2c 20 73 74 64 69 | 6e 2c 20 73 74 64 6f 75 |ap, stdi|n, stdou|
|00003030| 74 2c 20 31 2c 0a 58 09 | 09 09 6d 70 72 5f 6c 69 |t, 1,.X.|..mpr_li|
|00003040| 6e 65 62 79 74 65 73 28 | 72 68 2e 72 61 73 5f 77 |nebytes(|rh.ras_w|
|00003050| 69 64 74 68 2c 20 38 29 | 20 2d 20 72 68 2e 72 61 |idth, 8)| - rh.ra|
|00003060| 73 5f 77 69 64 74 68 29 | 3b 0a 58 09 09 09 62 72 |s_width)|;.X...br|
|00003070| 65 61 6b 3b 0a 58 09 20 | 20 20 20 20 20 63 61 73 |eak;.X. | cas|
|00003080| 65 20 31 31 20 3a 20 6d | 61 70 20 3d 20 28 75 6e |e 11 : m|ap = (un|
|00003090| 73 69 67 6e 65 64 20 63 | 68 61 72 20 2a 29 20 6d |signed c|har *) m|
|000030a0| 61 6c 6c 6f 63 28 32 35 | 36 29 3b 0a 58 09 09 09 |alloc(25|6);.X...|
|000030b0| 63 6f 6c 6f 72 5f 6d 61 | 70 5f 33 5f 74 6f 5f 31 |color_ma|p_3_to_1|
|000030c0| 28 63 6f 6c 6f 72 6d 61 | 70 2c 20 6d 61 70 29 3b |(colorma|p, map);|
|000030d0| 0a 58 09 20 20 20 20 20 | 20 63 61 73 65 20 35 20 |.X. | case 5 |
|000030e0| 20 3a 20 64 6f 74 5f 64 | 69 66 66 75 73 69 6f 6e | : dot_d|iffusion|
|000030f0| 5f 66 69 6c 65 28 72 68 | 2e 72 61 73 5f 77 69 64 |_file(rh|.ras_wid|
|00003100| 74 68 2c 20 72 68 2e 72 | 61 73 5f 68 65 69 67 68 |th, rh.r|as_heigh|
|00003110| 74 2c 0a 58 09 09 09 6d | 61 70 2c 20 73 74 64 69 |t,.X...m|ap, stdi|
|00003120| 6e 2c 20 73 74 64 6f 75 | 74 2c 20 31 2c 0a 58 09 |n, stdou|t, 1,.X.|
|00003130| 09 09 6d 70 72 5f 6c 69 | 6e 65 62 79 74 65 73 28 |..mpr_li|nebytes(|
|00003140| 72 68 2e 72 61 73 5f 77 | 69 64 74 68 2c 20 38 29 |rh.ras_w|idth, 8)|
|00003150| 20 2d 20 72 68 2e 72 61 | 73 5f 77 69 64 74 68 29 | - rh.ra|s_width)|
|00003160| 3b 0a 58 09 09 09 62 72 | 65 61 6b 3b 0a 58 09 20 |;.X...br|eak;.X. |
|00003170| 20 20 7d 0a 58 7d 0a 58 | 0a 58 63 6f 6c 6f 72 5f | }.X}.X|.Xcolor_|
|00003180| 6d 61 70 5f 33 5f 74 6f | 5f 31 28 63 6f 6c 6f 72 |map_3_to|_1(color|
|00003190| 6d 61 70 2c 20 6d 61 70 | 29 0a 58 72 65 67 69 73 |map, map|).Xregis|
|000031a0| 74 65 72 20 63 6f 6c 6f | 72 6d 61 70 5f 74 09 63 |ter colo|rmap_t.c|
|000031b0| 6f 6c 6f 72 6d 61 70 3b | 0a 58 72 65 67 69 73 74 |olormap;|.Xregist|
|000031c0| 65 72 20 75 6e 73 69 67 | 6e 65 64 20 63 68 61 72 |er unsig|ned char|
|000031d0| 09 2a 6d 61 70 3b 0a 58 | 7b 0a 58 72 65 67 69 73 |.*map;.X|{.Xregis|
|000031e0| 74 65 72 20 75 6e 73 69 | 67 6e 65 64 20 6c 6f 6e |ter unsi|gned lon|
|000031f0| 67 09 74 6d 70 2c 20 69 | 3b 0a 58 0a 58 09 66 6f |g.tmp, i|;.X.X.fo|
|00003200| 72 20 28 69 3d 30 3b 20 | 69 3c 32 35 36 3b 20 69 |r (i=0; |i<256; i|
|00003210| 2b 2b 29 20 7b 0a 58 09 | 20 20 20 74 6d 70 20 3d |++) {.X.| tmp =|
|00003220| 20 63 6f 6c 6f 72 6d 61 | 70 2e 6d 61 70 5b 30 5d | colorma|p.map[0]|
|00003230| 5b 69 5d 2a 37 37 20 2b | 20 63 6f 6c 6f 72 6d 61 |[i]*77 +| colorma|
|00003240| 70 2e 6d 61 70 5b 31 5d | 5b 69 5d 2a 31 35 31 20 |p.map[1]|[i]*151 |
|00003250| 2b 20 63 6f 6c 6f 72 6d | 61 70 2e 6d 61 70 5b 32 |+ colorm|ap.map[2|
|00003260| 5d 5b 69 5d 2a 32 38 3b | 0a 58 09 20 20 20 6d 61 |][i]*28;|.X. ma|
|00003270| 70 5b 69 5d 20 3d 20 74 | 6d 70 20 3e 3e 20 38 3b |p[i] = t|mp >> 8;|
|00003280| 0a 58 09 7d 0a 58 7d 0a | 58 0a 58 0a 58 65 64 67 |.X.}.X}.|X.X.Xedg|
|00003290| 65 5f 65 6e 68 61 6e 63 | 65 6d 65 6e 74 28 77 69 |e_enhanc|ement(wi|
|000032a0| 64 74 68 2c 20 68 65 69 | 67 68 74 2c 20 6f 66 66 |dth, hei|ght, off|
|000032b0| 29 0a 58 72 65 67 69 73 | 74 65 72 20 69 6e 74 09 |).Xregis|ter int.|
|000032c0| 77 69 64 74 68 2c 20 68 | 65 69 67 68 74 2c 20 6f |width, h|eight, o|
|000032d0| 66 66 3b 0a 58 7b 0a 58 | 72 65 67 69 73 74 65 72 |ff;.X{.X|register|
|000032e0| 20 69 6e 74 09 69 2c 20 | 6a 2c 20 78 2c 20 79 3b | int.i, |j, x, y;|
|000032f0| 0a 58 0a 58 09 42 5b 6f | 66 66 5d 5b 6f 66 66 5d |.X.X.B[o|ff][off]|
|00003300| 20 3d 20 41 5b 6f 66 66 | 5d 5b 6f 66 66 5d 2a 36 | = A[off|][off]*6|
|00003310| 20 2d 20 41 5b 6f 66 66 | 5d 5b 6f 66 66 2b 31 5d | - A[off|][off+1]|
|00003320| 20 2d 20 41 5b 6f 66 66 | 2b 31 5d 5b 6f 66 66 5d | - A[off|+1][off]|
|00003330| 20 2d 20 41 5b 6f 66 66 | 2b 31 5d 5b 6f 66 66 2b | - A[off|+1][off+|
|00003340| 31 5d 3b 0a 58 09 42 5b | 6f 66 66 5d 5b 6f 66 66 |1];.X.B[|off][off|
|00003350| 2b 68 65 69 67 68 74 2d | 31 5d 20 3d 20 41 5b 6f |+height-|1] = A[o|
|00003360| 66 66 5d 5b 6f 66 66 2b | 68 65 69 67 68 74 2d 31 |ff][off+|height-1|
|00003370| 5d 2a 36 20 2d 20 41 5b | 6f 66 66 5d 5b 6f 66 66 |]*6 - A[|off][off|
|00003380| 2b 68 65 69 67 68 74 2d | 32 5d 20 2d 20 41 5b 6f |+height-|2] - A[o|
|00003390| 66 66 2b 31 5d 5b 6f 66 | 66 2b 68 65 69 67 68 74 |ff+1][of|f+height|
|000033a0| 2d 31 5d 20 2d 20 41 5b | 6f 66 66 2b 31 5d 5b 6f |-1] - A[|off+1][o|
|000033b0| 66 66 2b 68 65 69 67 68 | 74 2d 32 5d 3b 0a 58 09 |ff+heigh|t-2];.X.|
|000033c0| 42 5b 6f 66 66 2b 77 69 | 64 74 68 2d 31 5d 5b 6f |B[off+wi|dth-1][o|
|000033d0| 66 66 5d 20 3d 20 41 5b | 6f 66 66 2b 77 69 64 74 |ff] = A[|off+widt|
|000033e0| 68 2d 31 5d 5b 6f 66 66 | 5d 2a 36 20 2d 20 41 5b |h-1][off|]*6 - A[|
|000033f0| 6f 66 66 2b 77 69 64 74 | 68 2d 31 5d 5b 6f 66 66 |off+widt|h-1][off|
|00003400| 2b 31 5d 20 2d 20 41 5b | 6f 66 66 2b 77 69 64 74 |+1] - A[|off+widt|
|00003410| 68 2d 32 5d 5b 6f 66 66 | 5d 20 2d 20 41 5b 6f 66 |h-2][off|] - A[of|
|00003420| 66 2b 77 69 64 74 68 2d | 32 5d 5b 6f 66 66 2b 31 |f+width-|2][off+1|
|00003430| 5d 3b 0a 58 09 42 5b 6f | 66 66 2b 77 69 64 74 68 |];.X.B[o|ff+width|
|00003440| 2d 31 5d 5b 6f 66 66 2b | 68 65 69 67 68 74 2d 31 |-1][off+|height-1|
|00003450| 5d 20 3d 20 41 5b 6f 66 | 66 2b 77 69 64 74 68 2d |] = A[of|f+width-|
|00003460| 31 5d 5b 6f 66 66 2b 68 | 65 69 67 68 74 2d 31 5d |1][off+h|eight-1]|
|00003470| 2a 36 20 2d 20 41 5b 6f | 66 66 2b 77 69 64 74 68 |*6 - A[o|ff+width|
|00003480| 2d 31 5d 5b 6f 66 66 2b | 68 65 69 67 68 74 2d 32 |-1][off+|height-2|
|00003490| 5d 20 2d 20 41 5b 6f 66 | 66 2b 77 69 64 74 68 2d |] - A[of|f+width-|
|000034a0| 32 5d 5b 6f 66 66 2b 68 | 65 69 67 68 74 2d 31 5d |2][off+h|eight-1]|
|000034b0| 20 2d 20 41 5b 6f 66 66 | 2b 77 69 64 74 68 2d 32 | - A[off|+width-2|
|000034c0| 5d 5b 6f 66 66 2b 68 65 | 69 67 68 74 2d 32 5d 3b |][off+he|ight-2];|
|000034d0| 0a 58 0a 58 09 66 6f 72 | 20 28 69 3d 31 3b 20 69 |.X.X.for| (i=1; i|
|000034e0| 3c 77 69 64 74 68 2d 31 | 3b 20 69 2b 2b 29 0a 58 |<width-1|; i++).X|
|000034f0| 09 20 20 20 42 5b 6f 66 | 66 2b 69 5d 5b 6f 66 66 |. B[of|f+i][off|
|00003500| 2b 30 5d 20 3d 20 41 5b | 6f 66 66 2b 69 5d 5b 6f |+0] = A[|off+i][o|
|00003510| 66 66 2b 30 5d 2a 36 20 | 2d 20 41 5b 6f 66 66 2b |ff+0]*6 |- A[off+|
|00003520| 69 2d 31 5d 5b 6f 66 66 | 2b 30 5d 20 2d 20 41 5b |i-1][off|+0] - A[|
|00003530| 6f 66 66 2b 69 2b 31 5d | 5b 6f 66 66 2b 30 5d 20 |off+i+1]|[off+0] |
|00003540| 2d 20 41 5b 6f 66 66 2b | 69 2d 31 5d 5b 6f 66 66 |- A[off+|i-1][off|
|00003550| 2b 31 5d 20 2d 20 41 5b | 6f 66 66 2b 69 5d 5b 6f |+1] - A[|off+i][o|
|00003560| 66 66 2b 31 5d 20 2d 20 | 41 5b 6f 66 66 2b 69 2b |ff+1] - |A[off+i+|
|00003570| 31 5d 5b 6f 66 66 2b 31 | 5d 3b 0a 58 09 66 6f 72 |1][off+1|];.X.for|
|00003580| 20 28 69 3d 31 3b 20 69 | 3c 77 69 64 74 68 2d 31 | (i=1; i|<width-1|
|00003590| 3b 20 69 2b 2b 29 0a 58 | 09 20 20 20 42 5b 6f 66 |; i++).X|. B[of|
|000035a0| 66 2b 69 5d 5b 6f 66 66 | 2b 68 65 69 67 68 74 2d |f+i][off|+height-|
|000035b0| 31 5d 20 3d 20 41 5b 6f | 66 66 2b 69 5d 5b 6f 66 |1] = A[o|ff+i][of|
|000035c0| 66 2b 68 65 69 67 68 74 | 2d 31 5d 2a 36 20 2d 20 |f+height|-1]*6 - |
|000035d0| 41 5b 6f 66 66 2b 69 2d | 31 5d 5b 6f 66 66 2b 68 |A[off+i-|1][off+h|
|000035e0| 65 69 67 68 74 2d 31 5d | 20 2d 20 41 5b 6f 66 66 |eight-1]| - A[off|
|000035f0| 2b 69 2b 31 5d 5b 6f 66 | 66 2b 68 65 69 67 68 74 |+i+1][of|f+height|
|00003600| 2d 32 5d 20 2d 20 41 5b | 6f 66 66 2b 69 2d 31 5d |-2] - A[|off+i-1]|
|00003610| 5b 6f 66 66 2b 68 65 69 | 67 68 74 2d 32 5d 20 2d |[off+hei|ght-2] -|
|00003620| 20 41 5b 6f 66 66 2b 69 | 5d 5b 6f 66 66 2b 31 5d | A[off+i|][off+1]|
|00003630| 20 2d 20 41 5b 6f 66 66 | 2b 69 2b 31 5d 5b 6f 66 | - A[off|+i+1][of|
|00003640| 66 2b 68 65 69 67 68 74 | 2d 32 5d 3b 0a 58 09 66 |f+height|-2];.X.f|
|00003650| 6f 72 20 28 69 3d 31 3b | 20 69 3c 68 65 69 67 68 |or (i=1;| i<heigh|
|00003660| 74 2d 31 3b 20 69 2b 2b | 29 0a 58 09 20 20 20 42 |t-1; i++|).X. B|
|00003670| 5b 6f 66 66 2b 30 5d 5b | 6f 66 66 2b 69 5d 20 3d |[off+0][|off+i] =|
|00003680| 20 41 5b 6f 66 66 2b 30 | 5d 5b 6f 66 66 2b 69 5d | A[off+0|][off+i]|
|00003690| 2a 36 20 2d 20 41 5b 6f | 66 66 2b 30 5d 5b 6f 66 |*6 - A[o|ff+0][of|
|000036a0| 66 2b 69 2d 31 5d 20 2d | 20 41 5b 6f 66 66 2b 30 |f+i-1] -| A[off+0|
|000036b0| 5d 5b 6f 66 66 2b 69 2b | 31 5d 20 2d 20 41 5b 6f |][off+i+|1] - A[o|
|000036c0| 66 66 2b 31 5d 5b 6f 66 | 66 2b 69 2d 31 5d 20 2d |ff+1][of|f+i-1] -|
|000036d0| 20 41 5b 6f 66 66 2b 31 | 5d 5b 6f 66 66 2b 69 5d | A[off+1|][off+i]|
|000036e0| 20 2d 20 41 5b 6f 66 66 | 2b 31 5d 5b 6f 66 66 2b | - A[off|+1][off+|
|000036f0| 69 2b 31 5d 3b 0a 58 09 | 66 6f 72 20 28 69 3d 31 |i+1];.X.|for (i=1|
|00003700| 3b 20 69 3c 68 65 69 67 | 68 74 2d 31 3b 20 69 2b |; i<heig|ht-1; i+|
|00003710| 2b 29 0a 58 09 20 20 20 | 42 5b 6f 66 66 2b 77 69 |+).X. |B[off+wi|
|00003720| 64 74 68 2d 31 5d 5b 6f | 66 66 2b 69 5d 20 3d 20 |dth-1][o|ff+i] = |
|00003730| 41 5b 6f 66 66 2b 77 69 | 64 74 68 2d 31 5d 5b 6f |A[off+wi|dth-1][o|
|00003740| 66 66 2b 69 5d 2a 36 20 | 2d 20 41 5b 6f 66 66 2b |ff+i]*6 |- A[off+|
|00003750| 77 69 64 74 68 2d 31 5d | 5b 6f 66 66 2b 69 2d 31 |width-1]|[off+i-1|
|00003760| 5d 20 2d 20 41 5b 6f 66 | 66 2b 77 69 64 74 68 2d |] - A[of|f+width-|
|00003770| 31 5d 5b 6f 66 66 2b 69 | 2b 31 5d 20 2d 20 41 5b |1][off+i|+1] - A[|
|00003780| 6f 66 66 2b 77 69 64 74 | 68 2d 32 5d 5b 6f 66 66 |off+widt|h-2][off|
|00003790| 2b 69 2d 31 5d 20 2d 20 | 41 5b 6f 66 66 2b 77 69 |+i-1] - |A[off+wi|
|000037a0| 64 74 68 2d 32 5d 5b 6f | 66 66 2b 69 5d 20 2d 20 |dth-2][o|ff+i] - |
|000037b0| 41 5b 6f 66 66 2b 77 69 | 64 74 68 2d 32 5d 5b 6f |A[off+wi|dth-2][o|
|000037c0| 66 66 2b 69 2b 31 5d 3b | 0a 58 0a 58 09 66 6f 72 |ff+i+1];|.X.X.for|
|000037d0| 28 69 3d 31 3b 20 69 3c | 77 69 64 74 68 2d 31 3b |(i=1; i<|width-1;|
|000037e0| 20 69 2b 2b 29 0a 58 09 | 20 20 20 66 6f 72 28 6a | i++).X.| for(j|
|000037f0| 3d 31 3b 20 6a 3c 68 65 | 69 67 68 74 2d 31 3b 20 |=1; j<he|ight-1; |
|00003800| 6a 2b 2b 29 20 7b 0a 58 | 09 09 42 5b 6f 66 66 2b |j++) {.X|..B[off+|
|00003810| 69 5d 5b 6f 66 66 2b 6a | 5d 20 3d 20 41 5b 6f 66 |i][off+j|] = A[of|
|00003820| 66 2b 69 5d 5b 6f 66 66 | 2b 6a 5d 2a 31 30 3b 0a |f+i][off|+j]*10;.|
|00003830| 58 09 09 66 6f 72 28 78 | 3d 69 2d 31 3b 20 78 3c |X..for(x|=i-1; x<|
|00003840| 3d 69 2b 31 3b 20 78 2b | 2b 29 0a 58 09 09 20 20 |=i+1; x+|+).X.. |
|00003850| 20 66 6f 72 28 79 3d 6a | 2d 31 3b 20 79 3c 3d 6a | for(y=j|-1; y<=j|
|00003860| 2b 31 3b 20 79 2b 2b 29 | 0a 58 09 09 09 42 5b 6f |+1; y++)|.X...B[o|
|00003870| 66 66 2b 69 5d 5b 6f 66 | 66 2b 6a 5d 20 2d 3d 20 |ff+i][of|f+j] -= |
|00003880| 41 5b 6f 66 66 2b 78 5d | 5b 6f 66 66 2b 79 5d 3b |A[off+x]|[off+y];|
|00003890| 0a 58 09 20 20 20 7d 0a | 58 0a 58 09 66 6f 72 28 |.X. }.|X.X.for(|
|000038a0| 69 3d 30 3b 20 69 3c 77 | 69 64 74 68 3b 20 69 2b |i=0; i<w|idth; i+|
|000038b0| 2b 29 0a 58 09 20 20 20 | 66 6f 72 28 6a 3d 30 3b |+).X. |for(j=0;|
|000038c0| 20 6a 3c 68 65 69 67 68 | 74 3b 20 6a 2b 2b 29 0a | j<heigh|t; j++).|
|000038d0| 58 09 09 41 5b 6f 66 66 | 2b 69 5d 5b 6f 66 66 2b |X..A[off|+i][off+|
|000038e0| 6a 5d 20 3d 20 42 5b 6f | 66 66 2b 69 5d 5b 6f 66 |j] = B[o|ff+i][of|
|000038f0| 66 2b 6a 5d 3b 0a 58 7d | 0a 58 0a 58 0a 58 69 6e |f+j];.X}|.X.X.Xin|
|00003900| 74 20 69 6e 64 65 78 28 | 78 2c 20 79 2c 20 77 2c |t index(|x, y, w,|
|00003910| 20 70 61 64 29 0a 58 72 | 65 67 69 73 74 65 72 20 | pad).Xr|egister |
|00003920| 69 6e 74 09 78 2c 20 79 | 2c 20 77 2c 20 70 61 64 |int.x, y|, w, pad|
|00003930| 3b 0a 58 7b 0a 58 09 72 | 65 74 75 72 6e 28 78 2b |;.X{.X.r|eturn(x+|
|00003940| 79 2a 28 77 2b 70 61 64 | 29 29 3b 0a 58 7d 0a 58 |y*(w+pad|));.X}.X|
|00003950| 0a 58 65 72 72 6f 72 5f | 64 69 66 66 75 73 69 6f |.Xerror_|diffusio|
|00003960| 6e 28 77 69 64 74 68 2c | 20 68 65 69 67 68 74 2c |n(width,| height,|
|00003970| 20 6f 75 74 2c 20 65 64 | 67 65 29 0a 58 72 65 67 | out, ed|ge).Xreg|
|00003980| 69 73 74 65 72 20 69 6e | 74 09 77 69 64 74 68 2c |ister in|t.width,|
|00003990| 20 68 65 69 67 68 74 3b | 0a 58 72 65 67 69 73 74 | height;|.Xregist|
|000039a0| 65 72 20 46 49 4c 45 09 | 2a 6f 75 74 3b 0a 58 72 |er FILE.|*out;.Xr|
|000039b0| 65 67 69 73 74 65 72 20 | 69 6e 74 09 65 64 67 65 |egister |int.edge|
|000039c0| 3b 0a 58 7b 0a 58 72 65 | 67 69 73 74 65 72 20 69 |;.X{.Xre|gister i|
|000039d0| 6e 74 09 09 65 72 72 2c | 20 6d 6f 6e 6f 5f 70 61 |nt..err,| mono_pa|
|000039e0| 64 3b 0a 58 72 65 67 69 | 73 74 65 72 20 75 5f 73 |d;.Xregi|ster u_s|
|000039f0| 68 6f 72 74 09 64 74 6d | 70 3b 0a 58 72 65 67 69 |hort.dtm|p;.Xregi|
|00003a00| 73 74 65 72 20 75 5f 6c | 6f 6e 67 09 09 69 2c 20 |ster u_l|ong..i, |
|00003a10| 6a 3b 0a 58 0a 58 09 6d | 6f 6e 6f 5f 70 61 64 20 |j;.X.X.m|ono_pad |
|00003a20| 3d 20 6d 70 72 5f 6c 69 | 6e 65 62 79 74 65 73 28 |= mpr_li|nebytes(|
|00003a30| 77 69 64 74 68 2c 20 31 | 29 2a 38 20 2d 20 77 69 |width, 1|)*8 - wi|
|00003a40| 64 74 68 3b 0a 58 09 20 | 20 20 0a 58 09 69 66 20 |dth;.X. | .X.if |
|00003a50| 28 65 64 67 65 29 0a 58 | 09 20 20 20 65 64 67 65 |(edge).X|. edge|
|00003a60| 5f 65 6e 68 61 6e 63 65 | 6d 65 6e 74 28 77 69 64 |_enhance|ment(wid|
|00003a70| 74 68 2c 20 68 65 69 67 | 68 74 2c 20 31 29 3b 0a |th, heig|ht, 1);.|
|00003a80| 58 0a 58 09 66 6f 72 28 | 6a 3d 31 3b 20 6a 3c 68 |X.X.for(|j=1; j<h|
|00003a90| 65 69 67 68 74 2b 31 3b | 20 6a 2b 2b 29 20 7b 0a |eight+1;| j++) {.|
|00003aa0| 58 09 20 20 20 66 6f 72 | 28 69 3d 31 3b 20 69 3c |X. for|(i=1; i<|
|00003ab0| 77 69 64 74 68 2b 31 3b | 20 69 2b 2b 29 20 7b 0a |width+1;| i++) {.|
|00003ac0| 58 09 09 64 74 6d 70 20 | 3c 3c 3d 20 31 3b 0a 58 |X..dtmp |<<= 1;.X|
|00003ad0| 09 09 69 66 20 28 41 5b | 69 5d 5b 6a 5d 20 3e 20 |..if (A[|i][j] > |
|00003ae0| 31 32 38 29 0a 58 09 09 | 20 20 20 65 72 72 20 3d |128).X..| err =|
|00003af0| 20 41 5b 69 5d 5b 6a 5d | 20 2d 20 32 35 36 3b 0a | A[i][j]| - 256;.|
|00003b00| 58 09 09 65 6c 73 65 20 | 7b 0a 58 09 09 20 20 20 |X..else |{.X.. |
|00003b10| 65 72 72 20 3d 20 41 5b | 69 5d 5b 6a 5d 3b 0a 58 |err = A[|i][j];.X|
|00003b20| 09 09 20 20 20 64 74 6d | 70 20 7c 3d 20 31 3b 0a |.. dtm|p |= 1;.|
|00003b30| 58 09 09 7d 0a 58 09 09 | 41 5b 69 2b 31 5d 5b 6a |X..}.X..|A[i+1][j|
|00003b40| 5d 20 2b 3d 20 28 65 72 | 72 2a 41 4c 50 48 41 29 |] += (er|r*ALPHA)|
|00003b50| 20 3e 3e 20 34 3b 0a 58 | 20 20 09 09 41 5b 69 2d | >> 4;.X| ..A[i-|
|00003b60| 31 5d 5b 6a 2b 31 5d 20 | 2b 3d 20 28 65 72 72 2a |1][j+1] |+= (err*|
|00003b70| 42 45 54 41 29 20 3e 3e | 20 34 3b 0a 58 09 09 41 |BETA) >>| 4;.X..A|
|00003b80| 5b 69 5d 5b 6a 2b 31 5d | 20 2b 3d 20 28 65 72 72 |[i][j+1]| += (err|
|00003b90| 2a 47 41 4d 4d 41 29 20 | 3e 3e 20 34 3b 0a 58 09 |*GAMMA) |>> 4;.X.|
|00003ba0| 09 41 5b 69 2b 31 5d 5b | 6a 2b 31 5d 20 2b 3d 20 |.A[i+1][|j+1] += |
|00003bb0| 28 65 72 72 2a 44 45 4c | 54 41 29 20 3e 3e 20 34 |(err*DEL|TA) >> 4|
|00003bc0| 3b 0a 58 09 09 69 66 20 | 28 28 28 69 2d 31 29 20 |;.X..if |(((i-1) |
|00003bd0| 25 20 31 36 29 20 3d 3d | 20 31 35 29 20 7b 0a 58 |% 16) ==| 15) {.X|
|00003be0| 09 09 20 20 20 70 75 74 | 63 28 64 74 6d 70 20 3e |.. put|c(dtmp >|
|00003bf0| 3e 20 38 2c 20 6f 75 74 | 29 3b 0a 58 09 09 20 20 |> 8, out|);.X.. |
|00003c00| 20 70 75 74 63 28 64 74 | 6d 70 2c 20 6f 75 74 29 | putc(dt|mp, out)|
|00003c10| 3b 0a 58 09 09 7d 0a 58 | 09 20 20 20 7d 0a 58 09 |;.X..}.X|. }.X.|
|00003c20| 20 20 20 66 6f 72 28 69 | 3d 77 69 64 74 68 2b 31 | for(i|=width+1|
|00003c30| 3b 20 69 3c 3d 77 69 64 | 74 68 2b 6d 6f 6e 6f 5f |; i<=wid|th+mono_|
|00003c40| 70 61 64 3b 20 69 2b 2b | 29 20 7b 0a 58 09 09 64 |pad; i++|) {.X..d|
|00003c50| 74 6d 70 20 3c 3c 3d 20 | 31 3b 0a 58 09 09 69 66 |tmp <<= |1;.X..if|
|00003c60| 20 28 28 28 69 2d 31 29 | 20 25 20 31 36 29 20 3d | (((i-1)| % 16) =|
|00003c70| 3d 20 31 35 29 20 7b 0a | 58 09 09 20 20 20 70 75 |= 15) {.|X.. pu|
|00003c80| 74 63 28 64 74 6d 70 20 | 3e 3e 20 38 2c 20 6f 75 |tc(dtmp |>> 8, ou|
|00003c90| 74 29 3b 0a 58 09 09 20 | 20 20 70 75 74 63 28 64 |t);.X.. | putc(d|
|00003ca0| 74 6d 70 2c 20 6f 75 74 | 29 3b 0a 58 09 09 7d 0a |tmp, out|);.X..}.|
|00003cb0| 58 09 20 20 20 7d 0a 58 | 09 7d 0a 58 7d 0a 58 0a |X. }.X|.}.X}.X.|
|00003cc0| 58 2f 2a 20 43 6f 6d 70 | 75 74 65 20 70 69 78 65 |X/* Comp|ute pixe|
|00003cd0| 6c 20 76 61 6c 75 65 73 | 20 75 73 69 6e 67 20 65 |l values| using e|
|00003ce0| 72 72 6f 72 20 64 69 66 | 66 75 73 69 6f 6e 20 2a |rror dif|fusion *|
|00003cf0| 2f 0a 58 65 72 72 6f 72 | 5f 64 69 66 66 75 73 69 |/.Xerror|_diffusi|
|00003d00| 6f 6e 5f 69 6d 61 67 65 | 28 77 69 64 74 68 2c 20 |on_image|(width, |
|00003d10| 68 65 69 67 68 74 2c 20 | 6d 61 70 2c 20 69 6e 2c |height, |map, in,|
|00003d20| 20 6f 75 74 2c 20 65 64 | 67 65 5f 65 6e 68 61 6e | out, ed|ge_enhan|
|00003d30| 63 65 2c 20 70 61 64 29 | 0a 58 72 65 67 69 73 74 |ce, pad)|.Xregist|
|00003d40| 65 72 20 69 6e 74 20 09 | 09 77 69 64 74 68 2c 20 |er int .|.width, |
|00003d50| 68 65 69 67 68 74 3b 0a | 58 72 65 67 69 73 74 65 |height;.|Xregiste|
|00003d60| 72 20 75 6e 73 69 67 6e | 65 64 20 63 68 61 72 20 |r unsign|ed char |
|00003d70| 09 2a 6d 61 70 3b 0a 58 | 72 65 67 69 73 74 65 72 |.*map;.X|register|
|00003d80| 20 75 5f 63 68 61 72 20 | 09 2a 69 6e 3b 0a 58 72 | u_char |.*in;.Xr|
|00003d90| 65 67 69 73 74 65 72 20 | 46 49 4c 45 20 09 09 2a |egister |FILE ..*|
|00003da0| 6f 75 74 3b 0a 58 72 65 | 67 69 73 74 65 72 20 69 |out;.Xre|gister i|
|00003db0| 6e 74 20 09 09 65 64 67 | 65 5f 65 6e 68 61 6e 63 |nt ..edg|e_enhanc|
|00003dc0| 65 2c 20 70 61 64 3b 0a | 58 7b 0a 58 72 65 67 69 |e, pad;.|X{.Xregi|
|00003dd0| 73 74 65 72 20 69 6e 74 | 09 69 2c 20 6a 3b 0a 58 |ster int|.i, j;.X|
|00003de0| 0a 58 09 66 6f 72 28 6a | 3d 31 3b 20 6a 3c 68 65 |.X.for(j|=1; j<he|
|00003df0| 69 67 68 74 2b 31 3b 20 | 6a 2b 2b 29 0a 58 09 20 |ight+1; |j++).X. |
|00003e00| 20 20 66 6f 72 28 69 3d | 31 3b 20 69 3c 77 69 64 | for(i=|1; i<wid|
|00003e10| 74 68 2b 31 3b 20 69 2b | 2b 29 0a 58 09 20 20 20 |th+1; i+|+).X. |
|00003e20| 20 20 20 41 5b 69 5d 5b | 6a 5d 20 3d 20 6d 61 70 | A[i][|j] = map|
|00003e30| 5b 2a 28 69 6e 2b 69 6e | 64 65 78 28 69 2d 31 2c |[*(in+in|dex(i-1,|
|00003e40| 20 6a 2d 31 2c 20 77 69 | 64 74 68 2c 20 70 61 64 | j-1, wi|dth, pad|
|00003e50| 29 29 5d 3b 0a 58 0a 58 | 09 65 72 72 6f 72 5f 64 |))];.X.X|.error_d|
|00003e60| 69 66 66 75 73 69 6f 6e | 28 77 69 64 74 68 2c 20 |iffusion|(width, |
|00003e70| 68 65 69 67 68 74 2c 20 | 6f 75 74 2c 20 65 64 67 |height, |out, edg|
|00003e80| 65 5f 65 6e 68 61 6e 63 | 65 29 3b 0a 58 7d 0a 58 |e_enhanc|e);.X}.X|
|00003e90| 0a 58 0a 58 2f 2a 20 43 | 6f 6d 70 75 74 65 20 70 |.X.X/* C|ompute p|
|00003ea0| 69 78 65 6c 20 76 61 6c | 75 65 73 20 75 73 69 6e |ixel val|ues usin|
|00003eb0| 67 20 65 72 72 6f 72 20 | 64 69 66 66 75 73 69 6f |g error |diffusio|
|00003ec0| 6e 20 2a 2f 0a 58 65 72 | 72 6f 72 5f 64 69 66 66 |n */.Xer|ror_diff|
|00003ed0| 75 73 69 6f 6e 5f 66 69 | 6c 65 28 77 69 64 74 68 |usion_fi|le(width|
|00003ee0| 2c 20 68 65 69 67 68 74 | 2c 20 6d 61 70 2c 20 69 |, height|, map, i|
|00003ef0| 6e 2c 20 6f 75 74 2c 20 | 65 64 67 65 5f 65 6e 68 |n, out, |edge_enh|
|00003f00| 61 6e 63 65 2c 20 70 61 | 64 29 0a 58 72 65 67 69 |ance, pa|d).Xregi|
|00003f10| 73 74 65 72 20 69 6e 74 | 20 09 09 77 69 64 74 68 |ster int| ..width|
|00003f20| 2c 20 68 65 69 67 68 74 | 3b 0a 58 72 65 67 69 73 |, height|;.Xregis|
|00003f30| 74 65 72 20 75 6e 73 69 | 67 6e 65 64 20 63 68 61 |ter unsi|gned cha|
|00003f40| 72 20 09 2a 6d 61 70 3b | 0a 58 72 65 67 69 73 74 |r .*map;|.Xregist|
|00003f50| 65 72 20 46 49 4c 45 20 | 09 09 2a 69 6e 2c 20 2a |er FILE |..*in, *|
|00003f60| 6f 75 74 3b 0a 58 72 65 | 67 69 73 74 65 72 20 69 |out;.Xre|gister i|
|00003f70| 6e 74 20 09 09 65 64 67 | 65 5f 65 6e 68 61 6e 63 |nt ..edg|e_enhanc|
|00003f80| 65 2c 20 70 61 64 3b 0a | 58 7b 0a 58 72 65 67 69 |e, pad;.|X{.Xregi|
|00003f90| 73 74 65 72 20 69 6e 74 | 09 09 69 2c 20 6a 2c 20 |ster int|..i, j, |
|00003fa0| 63 3b 20 0a 58 0a 58 09 | 66 6f 72 28 6a 3d 31 3b |c; .X.X.|for(j=1;|
|00003fb0| 20 6a 3c 68 65 69 67 68 | 74 2b 31 3b 20 6a 2b 2b | j<heigh|t+1; j++|
|00003fc0| 29 20 7b 0a 58 09 20 20 | 20 66 6f 72 28 69 3d 31 |) {.X. | for(i=1|
|00003fd0| 3b 20 69 3c 77 69 64 74 | 68 2b 31 3b 20 69 2b 2b |; i<widt|h+1; i++|
|00003fe0| 29 20 7b 0a 58 09 09 69 | 66 20 28 28 63 20 3d 20 |) {.X..i|f ((c = |
|00003ff0| 67 65 74 63 28 69 6e 29 | 29 20 3d 3d 20 45 4f 46 |getc(in)|) == EOF|
|00004000| 29 20 7b 0a 58 09 09 20 | 20 20 66 70 72 69 6e 74 |) {.X.. | fprint|
|00004010| 66 28 73 74 64 65 72 72 | 2c 20 22 65 72 72 6f 72 |f(stderr|, "error|
|00004020| 20 72 65 61 64 69 6e 67 | 20 72 61 73 74 65 72 20 | reading| raster |
|00004030| 64 61 74 61 21 5c 6e 22 | 29 3b 0a 58 09 09 20 20 |data!\n"|);.X.. |
|00004040| 20 65 78 69 74 28 31 29 | 3b 0a 58 09 09 7d 0a 58 | exit(1)|;.X..}.X|
|00004050| 09 09 41 5b 69 5d 5b 6a | 5d 20 3d 20 6d 61 70 5b |..A[i][j|] = map[|
|00004060| 63 5d 3b 0a 58 09 20 20 | 20 7d 0a 58 09 20 20 20 |c];.X. | }.X. |
|00004070| 66 6f 72 28 69 3d 77 69 | 64 74 68 3b 20 69 3c 77 |for(i=wi|dth; i<w|
|00004080| 69 64 74 68 2b 70 61 64 | 3b 20 69 2b 2b 29 0a 58 |idth+pad|; i++).X|
|00004090| 09 09 69 66 20 28 28 63 | 20 3d 20 67 65 74 63 28 |..if ((c| = getc(|
|000040a0| 69 6e 29 29 20 3d 3d 20 | 45 4f 46 29 0a 58 09 09 |in)) == |EOF).X..|
|000040b0| 20 20 20 66 70 72 69 6e | 74 66 28 73 74 64 65 72 | fprin|tf(stder|
|000040c0| 72 2c 20 22 65 72 72 6f | 72 20 72 65 61 64 69 6e |r, "erro|r readin|
|000040d0| 67 20 72 61 73 74 65 72 | 20 64 61 74 61 21 5c 6e |g raster| data!\n|
|000040e0| 22 29 3b 0a 58 09 7d 0a | 58 0a 58 09 65 72 72 6f |");.X.}.|X.X.erro|
|000040f0| 72 5f 64 69 66 66 75 73 | 69 6f 6e 28 77 69 64 74 |r_diffus|ion(widt|
|00004100| 68 2c 20 68 65 69 67 68 | 74 2c 20 6f 75 74 2c 20 |h, heigh|t, out, |
|00004110| 65 64 67 65 5f 65 6e 68 | 61 6e 63 65 29 3b 0a 58 |edge_enh|ance);.X|
|00004120| 7d 0a 58 0a 58 6f 72 64 | 65 72 65 64 28 77 69 64 |}.X.Xord|ered(wid|
|00004130| 74 68 2c 20 68 65 69 67 | 68 74 2c 20 6f 75 74 2c |th, heig|ht, out,|
|00004140| 20 65 64 67 65 29 0a 58 | 72 65 67 69 73 74 65 72 | edge).X|register|
|00004150| 20 69 6e 74 09 77 69 64 | 74 68 2c 20 68 65 69 67 | int.wid|th, heig|
|00004160| 68 74 3b 0a 58 72 65 67 | 69 73 74 65 72 20 46 49 |ht;.Xreg|ister FI|
|00004170| 4c 45 09 2a 6f 75 74 3b | 0a 58 72 65 67 69 73 74 |LE.*out;|.Xregist|
|00004180| 65 72 20 69 6e 74 09 65 | 64 67 65 3b 0a 58 7b 0a |er int.e|dge;.X{.|
|00004190| 58 72 65 67 69 73 74 65 | 72 20 69 6e 74 09 09 6d |Xregiste|r int..m|
|000041a0| 6f 6e 6f 5f 70 61 64 3b | 0a 58 72 65 67 69 73 74 |ono_pad;|.Xregist|
|000041b0| 65 72 20 75 5f 73 68 6f | 72 74 09 64 74 6d 70 3b |er u_sho|rt.dtmp;|
|000041c0| 0a 58 72 65 67 69 73 74 | 65 72 20 75 5f 6c 6f 6e |.Xregist|er u_lon|
|000041d0| 67 09 09 69 2c 20 6a 3b | 0a 58 0a 58 09 6d 6f 6e |g..i, j;|.X.X.mon|
|000041e0| 6f 5f 70 61 64 20 3d 20 | 6d 70 72 5f 6c 69 6e 65 |o_pad = |mpr_line|
|000041f0| 62 79 74 65 73 28 77 69 | 64 74 68 2c 20 31 29 2a |bytes(wi|dth, 1)*|
|00004200| 38 20 2d 20 77 69 64 74 | 68 3b 0a 58 0a 58 09 69 |8 - widt|h;.X.X.i|
|00004210| 66 20 28 65 64 67 65 29 | 0a 58 09 20 20 20 65 64 |f (edge)|.X. ed|
|00004220| 67 65 5f 65 6e 68 61 6e | 63 65 6d 65 6e 74 28 77 |ge_enhan|cement(w|
|00004230| 69 64 74 68 2c 20 68 65 | 69 67 68 74 2c 20 30 29 |idth, he|ight, 0)|
|00004240| 3b 0a 58 0a 58 09 66 6f | 72 28 6a 3d 30 3b 20 6a |;.X.X.fo|r(j=0; j|
|00004250| 3c 38 3b 20 6a 2b 2b 29 | 0a 58 09 20 20 20 66 6f |<8; j++)|.X. fo|
|00004260| 72 28 69 3d 30 3b 20 69 | 3c 38 3b 20 69 2b 2b 29 |r(i=0; i|<8; i++)|
|00004270| 0a 58 09 09 6f 72 64 65 | 72 65 64 5f 64 69 74 68 |.X..orde|red_dith|
|00004280| 65 72 5b 69 5d 5b 6a 5d | 20 3d 20 6f 72 64 65 72 |er[i][j]| = order|
|00004290| 65 64 5f 64 69 74 68 65 | 72 5b 69 5d 5b 6a 5d 2a |ed_dithe|r[i][j]*|
|000042a0| 34 20 2b 20 32 3b 0a 58 | 0a 58 09 66 6f 72 28 6a |4 + 2;.X|.X.for(j|
|000042b0| 3d 30 3b 20 6a 3c 68 65 | 69 67 68 74 3b 20 6a 2b |=0; j<he|ight; j+|
|000042c0| 2b 29 20 7b 0a 58 09 20 | 20 20 66 6f 72 28 69 3d |+) {.X. | for(i=|
|000042d0| 30 3b 20 69 3c 77 69 64 | 74 68 3b 20 69 2b 2b 29 |0; i<wid|th; i++)|
|000042e0| 20 7b 0a 58 09 09 64 74 | 6d 70 20 3c 3c 3d 20 31 | {.X..dt|mp <<= 1|
|000042f0| 3b 0a 58 09 09 69 66 20 | 28 41 5b 69 5d 5b 6a 5d |;.X..if |(A[i][j]|
|00004300| 20 3e 3d 20 6f 72 64 65 | 72 65 64 5f 64 69 74 68 | >= orde|red_dith|
|00004310| 65 72 5b 69 25 38 5d 5b | 6a 25 38 5d 29 0a 58 09 |er[i%8][|j%8]).X.|
|00004320| 09 20 20 20 64 74 6d 70 | 20 7c 3d 20 31 3b 0a 58 |. dtmp| |= 1;.X|
|00004330| 09 09 69 66 20 28 28 69 | 20 25 20 31 36 29 20 3d |..if ((i| % 16) =|
|00004340| 3d 20 31 35 29 20 7b 0a | 58 09 09 20 20 20 70 75 |= 15) {.|X.. pu|
|00004350| 74 63 28 64 74 6d 70 20 | 3e 3e 20 38 2c 20 6f 75 |tc(dtmp |>> 8, ou|
|00004360| 74 29 3b 0a 58 09 09 20 | 20 20 70 75 74 63 28 64 |t);.X.. | putc(d|
|00004370| 74 6d 70 2c 20 6f 75 74 | 29 3b 0a 58 09 09 7d 0a |tmp, out|);.X..}.|
|00004380| 58 09 20 20 20 7d 0a 58 | 09 20 20 20 66 6f 72 28 |X. }.X|. for(|
|00004390| 69 3d 77 69 64 74 68 3b | 20 69 3c 77 69 64 74 68 |i=width;| i<width|
|000043a0| 2b 6d 6f 6e 6f 5f 70 61 | 64 3b 20 69 2b 2b 29 20 |+mono_pa|d; i++) |
|000043b0| 7b 0a 58 09 09 64 74 6d | 70 20 3c 3c 3d 20 31 3b |{.X..dtm|p <<= 1;|
|000043c0| 0a 58 09 09 69 66 20 28 | 28 69 20 25 20 31 36 29 |.X..if (|(i % 16)|
|000043d0| 20 3d 3d 20 31 35 29 20 | 7b 0a 58 09 09 20 20 20 | == 15) |{.X.. |
|000043e0| 70 75 74 63 28 64 74 6d | 70 20 3e 3e 20 38 2c 20 |putc(dtm|p >> 8, |
|000043f0| 6f 75 74 29 3b 0a 58 09 | 09 20 20 20 70 75 74 63 |out);.X.|. putc|
|00004400| 28 64 74 6d 70 2c 20 6f | 75 74 29 3b 0a 58 09 09 |(dtmp, o|ut);.X..|
|00004410| 7d 0a 58 09 20 20 20 7d | 0a 58 09 7d 0a 58 7d 09 |}.X. }|.X.}.X}.|
|00004420| 09 20 09 09 20 20 20 0a | 58 09 09 20 09 09 20 20 |. .. .|X.. .. |
|00004430| 20 0a 58 6f 72 64 65 72 | 65 64 5f 64 69 74 68 65 | .Xorder|ed_dithe|
|00004440| 72 5f 69 6d 61 67 65 28 | 77 69 64 74 68 2c 20 68 |r_image(|width, h|
|00004450| 65 69 67 68 74 2c 20 6d | 61 70 2c 20 69 6e 2c 20 |eight, m|ap, in, |
|00004460| 6f 75 74 2c 20 65 64 67 | 65 5f 65 6e 68 61 6e 63 |out, edg|e_enhanc|
|00004470| 65 2c 20 70 61 64 29 0a | 58 72 65 67 69 73 74 65 |e, pad).|Xregiste|
|00004480| 72 20 69 6e 74 20 09 09 | 77 69 64 74 68 2c 20 68 |r int ..|width, h|
|00004490| 65 69 67 68 74 3b 0a 58 | 72 65 67 69 73 74 65 72 |eight;.X|register|
|000044a0| 20 75 6e 73 69 67 6e 65 | 64 20 63 68 61 72 20 09 | unsigne|d char .|
|000044b0| 2a 6d 61 70 3b 0a 58 72 | 65 67 69 73 74 65 72 20 |*map;.Xr|egister |
|000044c0| 75 5f 63 68 61 72 20 09 | 2a 69 6e 3b 0a 58 72 65 |u_char .|*in;.Xre|
|000044d0| 67 69 73 74 65 72 20 46 | 49 4c 45 20 09 09 2a 6f |gister F|ILE ..*o|
|000044e0| 75 74 3b 0a 58 72 65 67 | 69 73 74 65 72 20 69 6e |ut;.Xreg|ister in|
|000044f0| 74 20 09 09 65 64 67 65 | 5f 65 6e 68 61 6e 63 65 |t ..edge|_enhance|
|00004500| 2c 20 70 61 64 3b 0a 58 | 7b 0a 58 72 65 67 69 73 |, pad;.X|{.Xregis|
|00004510| 74 65 72 20 69 6e 74 09 | 09 69 2c 20 6a 3b 0a 58 |ter int.|.i, j;.X|
|00004520| 0a 58 09 66 6f 72 28 6a | 3d 30 3b 20 6a 3c 68 65 |.X.for(j|=0; j<he|
|00004530| 69 67 68 74 3b 20 6a 2b | 2b 29 0a 58 09 20 20 20 |ight; j+|+).X. |
|00004540| 66 6f 72 28 69 3d 30 3b | 20 69 3c 77 69 64 74 68 |for(i=0;| i<width|
|00004550| 3b 20 69 2b 2b 29 0a 58 | 09 20 20 20 20 20 20 41 |; i++).X|. A|
|00004560| 5b 69 5d 5b 6a 5d 20 3d | 20 32 35 36 20 2d 20 6d |[i][j] =| 256 - m|
|00004570| 61 70 5b 2a 28 69 6e 2b | 69 6e 64 65 78 28 69 2c |ap[*(in+|index(i,|
|00004580| 20 6a 2c 20 77 69 64 74 | 68 2c 20 70 61 64 29 29 | j, widt|h, pad))|
|00004590| 5d 3b 0a 58 0a 58 09 6f | 72 64 65 72 65 64 28 77 |];.X.X.o|rdered(w|
|000045a0| 69 64 74 68 2c 20 68 65 | 69 67 68 74 2c 20 6f 75 |idth, he|ight, ou|
|000045b0| 74 2c 20 65 64 67 65 5f | 65 6e 68 61 6e 63 65 29 |t, edge_|enhance)|
|000045c0| 3b 0a 58 7d 0a 58 0a 58 | 0a 58 6f 72 64 65 72 65 |;.X}.X.X|.Xordere|
|000045d0| 64 5f 64 69 74 68 65 72 | 5f 66 69 6c 65 28 77 69 |d_dither|_file(wi|
|000045e0| 64 74 68 2c 20 68 65 69 | 67 68 74 2c 20 6d 61 70 |dth, hei|ght, map|
|000045f0| 2c 20 69 6e 2c 20 6f 75 | 74 2c 20 65 64 67 65 5f |, in, ou|t, edge_|
|00004600| 65 6e 68 61 6e 63 65 2c | 20 70 61 64 29 0a 58 72 |enhance,| pad).Xr|
|00004610| 65 67 69 73 74 65 72 20 | 69 6e 74 20 09 09 77 69 |egister |int ..wi|
|00004620| 64 74 68 2c 20 68 65 69 | 67 68 74 3b 0a 58 72 65 |dth, hei|ght;.Xre|
|00004630| 67 69 73 74 65 72 20 75 | 6e 73 69 67 6e 65 64 20 |gister u|nsigned |
|00004640| 63 68 61 72 20 09 2a 6d | 61 70 3b 0a 58 72 65 67 |char .*m|ap;.Xreg|
|00004650| 69 73 74 65 72 20 46 49 | 4c 45 20 09 09 2a 69 6e |ister FI|LE ..*in|
|00004660| 2c 20 2a 6f 75 74 3b 0a | 58 72 65 67 69 73 74 65 |, *out;.|Xregiste|
|00004670| 72 20 69 6e 74 20 09 09 | 65 64 67 65 5f 65 6e 68 |r int ..|edge_enh|
|00004680| 61 6e 63 65 2c 20 70 61 | 64 3b 0a 58 7b 0a 58 72 |ance, pa|d;.X{.Xr|
|00004690| 65 67 69 73 74 65 72 20 | 69 6e 74 09 09 69 2c 20 |egister |int..i, |
|000046a0| 6a 2c 20 63 3b 0a 58 0a | 58 09 66 6f 72 28 6a 3d |j, c;.X.|X.for(j=|
|000046b0| 30 3b 20 6a 3c 68 65 69 | 67 68 74 3b 20 6a 2b 2b |0; j<hei|ght; j++|
|000046c0| 29 20 7b 0a 58 09 20 20 | 20 66 6f 72 28 69 3d 30 |) {.X. | for(i=0|
|000046d0| 3b 20 69 3c 77 69 64 74 | 68 3b 20 69 2b 2b 29 20 |; i<widt|h; i++) |
|000046e0| 7b 0a 58 09 20 20 20 20 | 20 20 69 66 20 28 28 63 |{.X. | if ((c|
|000046f0| 20 3d 20 67 65 74 63 28 | 69 6e 29 29 20 3d 3d 20 | = getc(|in)) == |
|00004700| 45 4f 46 29 20 7b 0a 58 | 09 09 20 66 70 72 69 6e |EOF) {.X|.. fprin|
|00004710| 74 66 28 73 74 64 65 72 | 72 2c 20 22 65 72 72 6f |tf(stder|r, "erro|
|00004720| 72 20 72 65 61 64 69 6e | 67 20 72 61 73 74 65 72 |r readin|g raster|
|00004730| 20 64 61 74 61 21 5c 6e | 22 29 3b 0a 58 09 09 20 | data!\n|");.X.. |
|00004740| 65 78 69 74 28 31 29 3b | 0a 58 09 20 20 20 20 20 |exit(1);|.X. |
|00004750| 20 7d 0a 58 09 20 20 20 | 20 20 20 41 5b 69 5d 5b | }.X. | A[i][|
|00004760| 6a 5d 20 3d 20 32 35 36 | 20 2d 20 6d 61 70 5b 63 |j] = 256| - map[c|
|00004770| 5d 3b 0a 58 09 20 20 20 | 7d 0a 58 09 20 20 20 66 |];.X. |}.X. f|
|00004780| 6f 72 28 69 3d 77 69 64 | 74 68 3b 20 69 3c 77 69 |or(i=wid|th; i<wi|
|00004790| 64 74 68 2b 70 61 64 3b | 20 69 2b 2b 29 0a 58 09 |dth+pad;| i++).X.|
|000047a0| 09 69 66 20 28 28 63 20 | 3d 20 67 65 74 63 28 69 |.if ((c |= getc(i|
|000047b0| 6e 29 29 20 3d 3d 20 45 | 4f 46 29 0a 58 09 09 20 |n)) == E|OF).X.. |
|000047c0| 20 20 66 70 72 69 6e 74 | 66 28 73 74 64 65 72 72 | fprint|f(stderr|
|000047d0| 2c 20 22 65 72 72 6f 72 | 20 72 65 61 64 69 6e 67 |, "error| reading|
|000047e0| 20 72 61 73 74 65 72 20 | 64 61 74 61 21 5c 6e 22 | raster |data!\n"|
|000047f0| 29 3b 0a 58 09 7d 0a 58 | 0a 58 09 6f 72 64 65 72 |);.X.}.X|.X.order|
|00004800| 65 64 28 77 69 64 74 68 | 2c 20 68 65 69 67 68 74 |ed(width|, height|
|00004810| 2c 20 6f 75 74 2c 20 65 | 64 67 65 5f 65 6e 68 61 |, out, e|dge_enha|
|00004820| 6e 63 65 29 3b 0a 58 7d | 0a 58 0a 58 69 6e 74 20 |nce);.X}|.X.Xint |
|00004830| 77 65 69 67 68 74 28 78 | 2c 20 79 29 0a 58 72 65 |weight(x|, y).Xre|
|00004840| 67 69 73 74 65 72 20 69 | 6e 74 09 78 2c 79 3b 0a |gister i|nt.x,y;.|
|00004850| 58 7b 0a 58 09 72 65 74 | 75 72 6e 28 33 20 2d 20 |X{.X.ret|urn(3 - |
|00004860| 78 2a 78 20 2d 20 79 2a | 79 29 3b 0a 58 7d 0a 58 |x*x - y*|y);.X}.X|
|00004870| 0a 58 64 6f 74 28 77 69 | 64 74 68 2c 20 68 65 69 |.Xdot(wi|dth, hei|
|00004880| 67 68 74 2c 20 6f 75 74 | 2c 20 65 64 67 65 29 0a |ght, out|, edge).|
|00004890| 58 72 65 67 69 73 74 65 | 72 20 69 6e 74 09 77 69 |Xregiste|r int.wi|
|000048a0| 64 74 68 2c 20 68 65 69 | 67 68 74 3b 0a 58 72 65 |dth, hei|ght;.Xre|
|000048b0| 67 69 73 74 65 72 20 46 | 49 4c 45 09 2a 6f 75 74 |gister F|ILE.*out|
|000048c0| 3b 0a 58 72 65 67 69 73 | 74 65 72 20 69 6e 74 09 |;.Xregis|ter int.|
|000048d0| 65 64 67 65 3b 0a 58 7b | 0a 58 72 65 67 69 73 74 |edge;.X{|.Xregist|
|000048e0| 65 72 20 69 6e 74 09 09 | 6b 2c 20 75 2c 20 76 2c |er int..|k, u, v,|
|000048f0| 20 65 72 72 2c 20 77 2c | 20 6d 6f 6e 6f 5f 70 61 | err, w,| mono_pa|
|00004900| 64 3b 0a 58 72 65 67 69 | 73 74 65 72 20 75 5f 73 |d;.Xregi|ster u_s|
|00004910| 68 6f 72 74 09 64 74 6d | 70 3b 0a 58 72 65 67 69 |hort.dtm|p;.Xregi|
|00004920| 73 74 65 72 20 75 5f 6c | 6f 6e 67 09 09 69 2c 20 |ster u_l|ong..i, |
|00004930| 6a 3b 0a 58 0a 58 09 6d | 6f 6e 6f 5f 70 61 64 20 |j;.X.X.m|ono_pad |
|00004940| 3d 20 6d 70 72 5f 6c 69 | 6e 65 62 79 74 65 73 28 |= mpr_li|nebytes(|
|00004950| 77 69 64 74 68 2c 20 31 | 29 2a 38 20 2d 20 77 69 |width, 1|)*8 - wi|
|00004960| 64 74 68 3b 0a 58 0a 58 | 09 69 66 20 28 65 64 67 |dth;.X.X|.if (edg|
|00004970| 65 29 0a 58 09 20 20 20 | 65 64 67 65 5f 65 6e 68 |e).X. |edge_enh|
|00004980| 61 6e 63 65 6d 65 6e 74 | 28 77 69 64 74 68 2c 20 |ancement|(width, |
|00004990| 68 65 69 67 68 74 2c 20 | 30 29 3b 0a 58 0a 58 09 |height, |0);.X.X.|
|000049a0| 66 6f 72 28 6b 3d 30 3b | 20 6b 3c 36 34 3b 20 6b |for(k=0;| k<64; k|
|000049b0| 2b 2b 29 20 7b 0a 58 09 | 20 20 20 66 6f 72 28 69 |++) {.X.| for(i|
|000049c0| 3d 72 65 76 65 72 73 65 | 5f 6d 61 74 72 69 78 5b |=reverse|_matrix[|
|000049d0| 6b 5d 2f 38 3b 20 69 3c | 77 69 64 74 68 3b 20 69 |k]/8; i<|width; i|
|000049e0| 2b 3d 38 29 0a 58 09 20 | 20 20 20 20 20 66 6f 72 |+=8).X. | for|
|000049f0| 28 6a 3d 72 65 76 65 72 | 73 65 5f 6d 61 74 72 69 |(j=rever|se_matri|
|00004a00| 78 5b 6b 5d 25 38 3b 20 | 6a 3c 68 65 69 67 68 74 |x[k]%8; |j<height|
|00004a10| 3b 20 6a 2b 3d 38 29 20 | 7b 0a 58 09 09 20 69 66 |; j+=8) |{.X.. if|
|00004a20| 20 28 41 5b 69 5d 5b 6a | 5d 20 3e 20 31 32 38 29 | (A[i][j|] > 128)|
|00004a30| 0a 58 09 09 20 20 20 20 | 42 5b 69 5d 5b 6a 5d 20 |.X.. |B[i][j] |
|00004a40| 3d 20 30 3b 0a 58 09 09 | 20 65 6c 73 65 0a 58 09 |= 0;.X..| else.X.|
|00004a50| 09 20 20 20 20 42 5b 69 | 5d 5b 6a 5d 20 3d 20 31 |. B[i|][j] = 1|
|00004a60| 3b 0a 58 09 09 20 65 72 | 72 20 3d 20 41 5b 69 5d |;.X.. er|r = A[i]|
|00004a70| 5b 6a 5d 20 2d 20 28 31 | 20 2d 20 42 5b 69 5d 5b |[j] - (1| - B[i][|
|00004a80| 6a 5d 29 2a 32 35 36 3b | 0a 58 09 09 20 77 20 3d |j])*256;|.X.. w =|
|00004a90| 20 30 3b 0a 58 09 09 20 | 66 6f 72 28 75 3d 69 2d | 0;.X.. |for(u=i-|
|00004aa0| 31 3b 20 75 3c 3d 69 2b | 31 3b 20 75 2b 2b 29 0a |1; u<=i+|1; u++).|
|00004ab0| 58 09 09 20 20 20 20 66 | 6f 72 28 76 3d 6a 2d 31 |X.. f|or(v=j-1|
|00004ac0| 3b 20 76 3c 3d 6a 2b 31 | 3b 20 76 2b 2b 29 0a 58 |; v<=j+1|; v++).X|
|00004ad0| 09 09 20 20 20 20 20 20 | 20 69 66 20 28 28 75 3e |.. | if ((u>|
|00004ae0| 3d 30 29 20 26 26 20 28 | 76 3e 3d 30 29 20 26 26 |=0) && (|v>=0) &&|
|00004af0| 20 28 64 6f 74 5f 64 69 | 66 66 75 73 69 6f 6e 5b | (dot_di|ffusion[|
|00004b00| 75 25 38 5d 5b 76 25 38 | 5d 20 3e 20 6b 29 29 0a |u%8][v%8|] > k)).|
|00004b10| 58 09 09 09 20 20 77 20 | 2b 3d 20 77 65 69 67 68 |X... w |+= weigh|
|00004b20| 74 28 75 2d 69 2c 20 76 | 2d 6a 29 3b 0a 58 09 09 |t(u-i, v|-j);.X..|
|00004b30| 20 69 66 20 28 77 20 3e | 20 30 29 20 7b 0a 58 09 | if (w >| 0) {.X.|
|00004b40| 09 20 20 20 20 66 6f 72 | 28 75 3d 69 2d 31 3b 20 |. for|(u=i-1; |
|00004b50| 75 3c 3d 69 2b 31 3b 20 | 75 2b 2b 29 0a 58 09 09 |u<=i+1; |u++).X..|
|00004b60| 20 20 20 20 20 20 20 66 | 6f 72 28 76 3d 6a 2d 31 | f|or(v=j-1|
|00004b70| 3b 20 76 3c 3d 6a 2b 31 | 3b 20 76 2b 2b 29 0a 58 |; v<=j+1|; v++).X|
|00004b80| 09 09 09 20 20 69 66 20 | 28 28 75 3e 3d 30 29 26 |... if |((u>=0)&|
|00004b90| 26 28 76 3e 3d 30 29 26 | 26 28 64 6f 74 5f 64 69 |&(v>=0)&|&(dot_di|
|00004ba0| 66 66 75 73 69 6f 6e 5b | 75 25 38 5d 5b 76 25 38 |ffusion[|u%8][v%8|
|00004bb0| 5d 3e 6b 29 29 0a 58 09 | 09 09 20 20 20 20 20 41 |]>k)).X.|.. A|
|00004bc0| 5b 75 5d 5b 76 5d 20 2b | 3d 20 65 72 72 20 2a 20 |[u][v] +|= err * |
|00004bd0| 77 65 69 67 68 74 28 75 | 2d 69 2c 20 76 2d 6a 29 |weight(u|-i, v-j)|
|00004be0| 20 2f 20 77 3b 0a 58 09 | 09 20 7d 0a 58 09 20 20 | / w;.X.|. }.X. |
|00004bf0| 20 20 20 20 7d 0a 58 09 | 7d 0a 58 0a 58 09 66 6f | }.X.|}.X.X.fo|
|00004c00| 72 28 6a 3d 30 3b 20 6a | 3c 68 65 69 67 68 74 3b |r(j=0; j|<height;|
|00004c10| 20 6a 2b 2b 29 20 7b 0a | 58 09 20 20 20 66 6f 72 | j++) {.|X. for|
|00004c20| 28 69 3d 30 3b 20 69 3c | 77 69 64 74 68 3b 20 69 |(i=0; i<|width; i|
|00004c30| 2b 2b 29 20 7b 0a 58 09 | 09 64 74 6d 70 20 3c 3c |++) {.X.|.dtmp <<|
|00004c40| 3d 20 31 3b 0a 58 09 09 | 69 66 20 28 42 5b 69 5d |= 1;.X..|if (B[i]|
|00004c50| 5b 6a 5d 29 0a 58 09 09 | 20 20 20 64 74 6d 70 20 |[j]).X..| dtmp |
|00004c60| 7c 3d 20 31 3b 0a 58 09 | 20 20 20 09 69 66 20 28 ||= 1;.X.| .if (|
|00004c70| 28 69 20 25 20 31 36 29 | 20 3d 3d 20 31 35 29 20 |(i % 16)| == 15) |
|00004c80| 7b 0a 58 09 09 20 20 20 | 70 75 74 63 28 64 74 6d |{.X.. |putc(dtm|
|00004c90| 70 20 3e 3e 20 38 2c 20 | 6f 75 74 29 3b 0a 58 09 |p >> 8, |out);.X.|
|00004ca0| 09 20 20 20 70 75 74 63 | 28 64 74 6d 70 2c 20 6f |. putc|(dtmp, o|
|00004cb0| 75 74 29 3b 0a 58 09 09 | 7d 0a 58 09 20 20 20 7d |ut);.X..|}.X. }|
|00004cc0| 0a 58 09 20 20 20 66 6f | 72 28 69 3d 77 69 64 74 |.X. fo|r(i=widt|
|00004cd0| 68 3b 20 69 3c 77 69 64 | 74 68 2b 6d 6f 6e 6f 5f |h; i<wid|th+mono_|
|00004ce0| 70 61 64 3b 20 69 2b 2b | 29 20 7b 0a 58 09 09 64 |pad; i++|) {.X..d|
|00004cf0| 74 6d 70 20 3c 3c 3d 20 | 31 3b 0a 58 09 09 69 66 |tmp <<= |1;.X..if|
|00004d00| 20 28 28 69 20 25 20 31 | 36 29 20 3d 3d 20 31 35 | ((i % 1|6) == 15|
|00004d10| 29 20 7b 0a 58 09 09 20 | 20 20 70 75 74 63 28 64 |) {.X.. | putc(d|
|00004d20| 74 6d 70 20 3e 3e 20 38 | 2c 20 6f 75 74 29 3b 0a |tmp >> 8|, out);.|
|00004d30| 58 09 09 20 20 20 70 75 | 74 63 28 64 74 6d 70 2c |X.. pu|tc(dtmp,|
|00004d40| 20 6f 75 74 29 3b 0a 58 | 09 09 7d 0a 58 09 20 20 | out);.X|..}.X. |
|00004d50| 20 7d 0a 58 09 7d 0a 58 | 7d 0a 58 0a 58 0a 58 64 | }.X.}.X|}.X.X.Xd|
|00004d60| 6f 74 5f 64 69 66 66 75 | 73 69 6f 6e 5f 69 6d 61 |ot_diffu|sion_ima|
|00004d70| 67 65 28 77 69 64 74 68 | 2c 20 68 65 69 67 68 74 |ge(width|, height|
|00004d80| 2c 20 6d 61 70 2c 20 69 | 6e 2c 20 6f 75 74 2c 20 |, map, i|n, out, |
|00004d90| 65 64 67 65 5f 65 6e 68 | 61 6e 63 65 2c 20 70 61 |edge_enh|ance, pa|
|00004da0| 64 29 0a 58 72 65 67 69 | 73 74 65 72 20 69 6e 74 |d).Xregi|ster int|
|00004db0| 20 09 09 77 69 64 74 68 | 2c 20 68 65 69 67 68 74 | ..width|, height|
|00004dc0| 3b 0a 58 72 65 67 69 73 | 74 65 72 20 75 6e 73 69 |;.Xregis|ter unsi|
|00004dd0| 67 6e 65 64 20 63 68 61 | 72 20 09 2a 6d 61 70 3b |gned cha|r .*map;|
|00004de0| 0a 58 72 65 67 69 73 74 | 65 72 20 75 5f 63 68 61 |.Xregist|er u_cha|
|00004df0| 72 20 09 2a 69 6e 3b 0a | 58 72 65 67 69 73 74 65 |r .*in;.|Xregiste|
|00004e00| 72 20 46 49 4c 45 20 09 | 09 2a 6f 75 74 3b 0a 58 |r FILE .|.*out;.X|
|00004e10| 72 65 67 69 73 74 65 72 | 20 69 6e 74 20 09 09 65 |register| int ..e|
|00004e20| 64 67 65 5f 65 6e 68 61 | 6e 63 65 2c 20 70 61 64 |dge_enha|nce, pad|
|00004e30| 3b 0a 58 7b 0a 58 72 65 | 67 69 73 74 65 72 20 69 |;.X{.Xre|gister i|
|00004e40| 6e 74 09 09 69 2c 20 6a | 3b 0a 58 0a 58 09 66 6f |nt..i, j|;.X.X.fo|
|00004e50| 72 28 6a 3d 30 3b 20 6a | 3c 68 65 69 67 68 74 3b |r(j=0; j|<height;|
|00004e60| 20 6a 2b 2b 29 0a 58 09 | 20 20 20 66 6f 72 28 69 | j++).X.| for(i|
|00004e70| 3d 30 3b 20 69 3c 77 69 | 64 74 68 3b 20 69 2b 2b |=0; i<wi|dth; i++|
|00004e80| 29 0a 58 09 20 20 20 20 | 20 20 41 5b 69 5d 5b 6a |).X. | A[i][j|
|00004e90| 5d 20 3d 20 6d 61 70 5b | 2a 28 69 6e 2b 69 6e 64 |] = map[|*(in+ind|
|00004ea0| 65 78 28 69 2c 20 6a 2c | 20 77 69 64 74 68 2c 20 |ex(i, j,| width, |
|00004eb0| 70 61 64 29 29 5d 3b 0a | 58 0a 58 09 64 6f 74 28 |pad))];.|X.X.dot(|
|00004ec0| 77 69 64 74 68 2c 20 68 | 65 69 67 68 74 2c 20 6f |width, h|eight, o|
|00004ed0| 75 74 2c 20 65 64 67 65 | 5f 65 6e 68 61 6e 63 65 |ut, edge|_enhance|
|00004ee0| 29 3b 0a 58 7d 0a 58 0a | 58 64 6f 74 5f 64 69 66 |);.X}.X.|Xdot_dif|
|00004ef0| 66 75 73 69 6f 6e 5f 66 | 69 6c 65 28 77 69 64 74 |fusion_f|ile(widt|
|00004f00| 68 2c 20 68 65 69 67 68 | 74 2c 20 6d 61 70 2c 20 |h, heigh|t, map, |
|00004f10| 69 6e 2c 20 6f 75 74 2c | 20 65 64 67 65 5f 65 6e |in, out,| edge_en|
|00004f20| 68 61 6e 63 65 2c 20 70 | 61 64 29 0a 58 72 65 67 |hance, p|ad).Xreg|
|00004f30| 69 73 74 65 72 20 69 6e | 74 20 09 09 77 69 64 74 |ister in|t ..widt|
|00004f40| 68 2c 20 68 65 69 67 68 | 74 3b 0a 58 72 65 67 69 |h, heigh|t;.Xregi|
|00004f50| 73 74 65 72 20 75 6e 73 | 69 67 6e 65 64 20 63 68 |ster uns|igned ch|
|00004f60| 61 72 20 09 2a 6d 61 70 | 3b 0a 58 72 65 67 69 73 |ar .*map|;.Xregis|
|00004f70| 74 65 72 20 46 49 4c 45 | 20 09 09 2a 69 6e 2c 20 |ter FILE| ..*in, |
|00004f80| 2a 6f 75 74 3b 0a 58 72 | 65 67 69 73 74 65 72 20 |*out;.Xr|egister |
|00004f90| 69 6e 74 20 09 09 65 64 | 67 65 5f 65 6e 68 61 6e |int ..ed|ge_enhan|
|00004fa0| 63 65 2c 20 70 61 64 3b | 0a 58 7b 0a 58 72 65 67 |ce, pad;|.X{.Xreg|
|00004fb0| 69 73 74 65 72 20 69 6e | 74 09 09 69 2c 20 6a 2c |ister in|t..i, j,|
|00004fc0| 20 63 3b 0a 58 0a 58 09 | 66 6f 72 28 6a 3d 30 3b | c;.X.X.|for(j=0;|
|00004fd0| 20 6a 3c 68 65 69 67 68 | 74 3b 20 6a 2b 2b 29 20 | j<heigh|t; j++) |
|00004fe0| 7b 0a 58 09 20 20 20 66 | 6f 72 28 69 3d 30 3b 20 |{.X. f|or(i=0; |
|00004ff0| 69 3c 77 69 64 74 68 3b | 20 69 2b 2b 29 20 7b 0a |i<width;| i++) {.|
|00005000| 58 09 20 20 20 20 20 20 | 69 66 20 28 28 63 20 3d |X. |if ((c =|
|00005010| 20 67 65 74 63 28 69 6e | 29 29 20 3d 3d 20 45 4f | getc(in|)) == EO|
|00005020| 46 29 20 7b 0a 58 09 09 | 20 66 70 72 69 6e 74 66 |F) {.X..| fprintf|
|00005030| 28 73 74 64 65 72 72 2c | 20 22 65 72 72 6f 72 20 |(stderr,| "error |
|00005040| 72 65 61 64 69 6e 67 20 | 72 61 73 74 65 72 20 64 |reading |raster d|
|00005050| 61 74 61 21 5c 6e 22 29 | 3b 0a 58 09 09 20 65 78 |ata!\n")|;.X.. ex|
|00005060| 69 74 28 31 29 3b 0a 58 | 09 20 20 20 20 20 20 7d |it(1);.X|. }|
|00005070| 0a 58 09 20 20 20 20 20 | 20 41 5b 69 5d 5b 6a 5d |.X. | A[i][j]|
|00005080| 20 3d 20 6d 61 70 5b 63 | 5d 3b 0a 58 09 20 20 20 | = map[c|];.X. |
|00005090| 7d 0a 58 09 20 20 20 66 | 6f 72 28 69 3d 77 69 64 |}.X. f|or(i=wid|
|000050a0| 74 68 3b 20 69 3c 77 69 | 64 74 68 2b 70 61 64 3b |th; i<wi|dth+pad;|
|000050b0| 20 69 2b 2b 29 0a 58 09 | 09 69 66 20 28 28 63 20 | i++).X.|.if ((c |
|000050c0| 3d 20 67 65 74 63 28 69 | 6e 29 29 20 3d 3d 20 45 |= getc(i|n)) == E|
|000050d0| 4f 46 29 0a 58 09 09 20 | 20 20 66 70 72 69 6e 74 |OF).X.. | fprint|
|000050e0| 66 28 73 74 64 65 72 72 | 2c 20 22 65 72 72 6f 72 |f(stderr|, "error|
|000050f0| 20 72 65 61 64 69 6e 67 | 20 72 61 73 74 65 72 20 | reading| raster |
|00005100| 64 61 74 61 21 5c 6e 22 | 29 3b 0a 58 09 7d 0a 58 |data!\n"|);.X.}.X|
|00005110| 0a 58 09 64 6f 74 28 77 | 69 64 74 68 2c 20 68 65 |.X.dot(w|idth, he|
|00005120| 69 67 68 74 2c 20 6f 75 | 74 2c 20 65 64 67 65 5f |ight, ou|t, edge_|
|00005130| 65 6e 68 61 6e 63 65 29 | 3b 0a 58 7d 0a 58 0a 45 |enhance)|;.X}.X.E|
|00005140| 4e 44 5f 4f 46 5f 38 74 | 6f 31 2e 63 0a 69 66 20 |ND_OF_8t|o1.c.if |
|00005150| 74 65 73 74 20 31 36 39 | 33 39 20 2d 6e 65 20 60 |test 169|39 -ne `|
|00005160| 77 63 20 2d 63 20 3c 38 | 74 6f 31 2e 63 60 3b 20 |wc -c <8|to1.c`; |
|00005170| 74 68 65 6e 0a 20 20 20 | 20 65 63 68 6f 20 73 68 |then. | echo sh|
|00005180| 61 72 3a 20 5c 22 38 74 | 6f 31 2e 63 5c 22 20 75 |ar: \"8t|o1.c\" u|
|00005190| 6e 70 61 63 6b 65 64 20 | 77 69 74 68 20 77 72 6f |npacked |with wro|
|000051a0| 6e 67 20 73 69 7a 65 21 | 0a 66 69 0a 23 20 65 6e |ng size!|.fi.# en|
|000051b0| 64 20 6f 66 20 6f 76 65 | 72 77 72 69 74 69 6e 67 |d of ove|rwriting|
|000051c0| 20 63 68 65 63 6b 0a 66 | 69 0a 69 66 20 74 65 73 | check.f|i.if tes|
|000051d0| 74 20 2d 66 20 73 63 6c | 6f 61 64 2e 63 20 2d 61 |t -f scl|oad.c -a|
|000051e0| 20 22 24 7b 31 7d 22 20 | 21 3d 20 22 2d 63 22 20 | "${1}" |!= "-c" |
|000051f0| 3b 20 74 68 65 6e 20 0a | 20 20 65 63 68 6f 20 73 |; then .| echo s|
|00005200| 68 61 72 3a 20 57 69 6c | 6c 20 6e 6f 74 20 6f 76 |har: Wil|l not ov|
|00005210| 65 72 2d 77 72 69 74 65 | 20 65 78 69 73 74 69 6e |er-write| existin|
|00005220| 67 20 66 69 6c 65 20 5c | 22 73 63 6c 6f 61 64 2e |g file \|"scload.|
|00005230| 63 5c 22 0a 65 6c 73 65 | 0a 65 63 68 6f 20 73 68 |c\".else|.echo sh|
|00005240| 61 72 3a 20 45 78 74 72 | 61 63 74 69 6e 67 20 5c |ar: Extr|acting \|
|00005250| 22 73 63 6c 6f 61 64 2e | 63 5c 22 20 5c 28 36 34 |"scload.|c\" \(64|
|00005260| 36 32 20 63 68 61 72 61 | 63 74 65 72 73 5c 29 0a |62 chara|cters\).|
|00005270| 73 65 64 20 22 73 2f 5e | 58 2f 2f 22 20 3e 73 63 |sed "s/^|X//" >sc|
|00005280| 6c 6f 61 64 2e 63 20 3c | 3c 27 45 4e 44 5f 4f 46 |load.c <|<'END_OF|
|00005290| 5f 73 63 6c 6f 61 64 2e | 63 27 0a 58 2f 2a 20 43 |_scload.|c'.X/* C|
|000052a0| 6f 6d 70 69 6c 65 3a 20 | 63 63 20 2d 67 20 2d 6f |ompile: |cc -g -o|
|000052b0| 20 73 63 6c 6f 61 64 20 | 73 63 6c 6f 61 64 2e 63 | scload |scload.c|
|000052c0| 20 2d 6c 70 69 78 72 65 | 63 74 20 2a 2f 0a 58 0a | -lpixre|ct */.X.|
|000052d0| 58 2f 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |X/******|********|
|000052e0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|000052f0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005300| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005310| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 0a 58 20 20 |********|****.X |
|00005320| 20 54 68 65 20 70 72 6f | 67 72 61 6d 20 22 73 63 | The pro|gram "sc|
|00005330| 6c 6f 61 64 22 20 69 73 | 20 6c 69 6b 65 20 53 75 |load" is| like Su|
|00005340| 6e 27 73 20 22 73 63 72 | 65 65 6e 6c 6f 61 64 22 |n's "scr|eenload"|
|00005350| 20 70 72 6f 67 72 61 6d | 2c 20 62 75 74 20 6d 6f | program|, but mo|
|00005360| 72 65 0a 58 20 20 20 65 | 6e 74 65 72 74 61 69 6e |re.X e|ntertain|
|00005370| 69 6e 67 2c 20 61 6e 64 | 20 61 63 74 75 61 6c 6c |ing, and| actuall|
|00005380| 79 20 62 65 74 74 65 72 | 20 74 68 61 6e 20 73 63 |y better| than sc|
|00005390| 72 65 65 6e 6c 6f 61 64 | 2e 0a 58 0a 58 20 20 20 |reenload|..X.X |
|000053a0| 43 6f 70 79 72 69 67 68 | 74 20 28 63 29 20 31 39 |Copyrigh|t (c) 19|
|000053b0| 38 38 20 62 79 20 52 61 | 79 6d 6f 6e 64 20 4b 72 |88 by Ra|ymond Kr|
|000053c0| 65 69 73 65 6c 0a 58 20 | 20 20 37 2f 31 2f 38 38 |eisel.X | 7/1/88|
|000053d0| 20 40 20 53 75 6e 79 20 | 53 74 6f 6e 79 20 42 72 | @ Suny |Stony Br|
|000053e0| 6f 6f 6b 0a 58 0a 58 20 | 20 20 54 68 69 73 20 70 |ook.X.X | This p|
|000053f0| 72 6f 67 72 61 6d 20 6d | 61 79 20 62 65 20 72 65 |rogram m|ay be re|
|00005400| 64 69 73 74 72 69 62 75 | 74 65 64 20 77 69 74 68 |distribu|ted with|
|00005410| 6f 75 74 20 66 65 65 20 | 61 73 20 6c 6f 6e 67 20 |out fee |as long |
|00005420| 61 73 20 74 68 69 73 20 | 63 6f 70 79 72 69 67 68 |as this |copyrigh|
|00005430| 74 0a 58 20 20 20 6e 6f | 74 69 63 65 20 69 73 20 |t.X no|tice is |
|00005440| 69 6e 74 61 63 74 2e 0a | 58 0a 58 3d 3d 3e 20 50 |intact..|X.X==> P|
|00005450| 4c 45 41 53 45 20 73 65 | 6e 64 20 63 6f 6d 6d 65 |LEASE se|nd comme|
|00005460| 6e 74 73 20 61 6e 64 20 | 62 75 67 20 72 65 70 6f |nts and |bug repo|
|00005470| 72 74 73 20 74 6f 20 6f | 6e 65 20 6f 66 20 74 68 |rts to o|ne of th|
|00005480| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 61 64 64 72 |e follow|ing addr|
|00005490| 65 73 73 65 73 3a 0a 58 | 0a 58 09 20 20 20 52 61 |esses:.X|.X. Ra|
|000054a0| 79 20 4b 72 65 69 73 65 | 6c 0a 58 09 20 20 20 43 |y Kreise|l.X. C|
|000054b0| 53 20 44 65 70 74 2e 2c | 20 53 55 4e 59 20 61 74 |S Dept.,| SUNY at|
|000054c0| 20 53 74 6f 6e 79 20 42 | 72 6f 6f 6b 2c 20 53 74 | Stony B|rook, St|
|000054d0| 6f 6e 79 20 42 72 6f 6f | 6b 20 4e 59 20 31 31 37 |ony Broo|k NY 117|
|000054e0| 39 34 0a 58 0a 58 09 20 | 20 20 55 55 43 50 3a 20 |94.X.X. | UUCP: |
|000054f0| 7b 61 6c 6c 65 67 72 61 | 2c 20 70 68 69 6c 61 62 |{allegra|, philab|
|00005500| 73 2c 20 70 79 72 61 6d | 69 64 2c 20 72 65 73 65 |s, pyram|id, rese|
|00005510| 61 72 63 68 7d 21 73 62 | 63 73 21 72 61 79 6b 20 |arch}!sb|cs!rayk |
|00005520| 20 20 0a 58 09 20 20 20 | 41 52 50 41 2d 49 6e 74 | .X. |ARPA-Int|
|00005530| 65 72 6e 65 74 3a 20 72 | 61 79 6b 40 73 62 63 73 |ernet: r|ayk@sbcs|
|00005540| 2e 73 75 6e 79 73 62 2e | 65 64 75 09 09 09 0a 58 |.sunysb.|edu....X|
|00005550| 09 20 20 20 43 53 6e 65 | 74 3a 20 72 61 79 6b 40 |. CSne|t: rayk@|
|00005560| 73 75 6e 79 2d 73 62 0a | 58 09 20 20 20 28 49 66 |suny-sb.|X. (If|
|00005570| 20 6e 6f 62 6f 64 79 20 | 69 73 20 68 6f 6d 65 20 | nobody |is home |
|00005580| 61 74 20 61 6e 79 20 6f | 66 20 74 68 65 20 61 62 |at any o|f the ab|
|00005590| 6f 76 65 20 61 64 64 72 | 65 73 73 65 73 20 74 72 |ove addr|esses tr|
|000055a0| 79 3a 0a 58 09 09 53 37 | 32 51 4b 52 45 40 54 4f |y:.X..S7|2QKRE@TO|
|000055b0| 57 53 4f 4e 56 58 2e 42 | 49 54 4e 45 54 09 09 09 |WSONVX.B|ITNET...|
|000055c0| 20 20 20 20 20 20 20 20 | 29 0a 58 0a 58 20 22 49 | |).X.X "I|
|000055d0| 66 20 49 20 67 65 74 20 | 68 6f 6d 65 20 62 65 66 |f I get |home bef|
|000055e0| 6f 72 65 20 64 61 79 6c | 69 67 68 74 2c 20 49 20 |ore dayl|ight, I |
|000055f0| 6a 75 73 74 20 6d 69 67 | 68 74 20 67 65 74 20 73 |just mig|ht get s|
|00005600| 6f 6d 65 20 73 6c 65 65 | 70 20 74 6f 6e 69 67 68 |ome slee|p tonigh|
|00005610| 74 2e 2e 2e 2e 22 0a 58 | 0a 58 2a 2a 2a 2a 2a 2a |t....".X|.X******|
|00005620| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005630| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005640| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005650| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005660| 2a 2a 2a 2a 2f 0a 58 23 | 69 6e 63 6c 75 64 65 20 |****/.X#|include |
|00005670| 3c 70 69 78 72 65 63 74 | 2f 70 69 78 72 65 63 74 |<pixrect|/pixrect|
|00005680| 5f 68 73 2e 68 3e 0a 58 | 23 69 6e 63 6c 75 64 65 |_hs.h>.X|#include|
|00005690| 20 3c 73 74 64 69 6f 2e | 68 3e 0a 58 23 69 6e 63 | <stdio.|h>.X#inc|
|000056a0| 6c 75 64 65 20 3c 73 79 | 73 2f 74 69 6d 65 2e 68 |lude <sy|s/time.h|
|000056b0| 3e 0a 58 23 69 6e 63 6c | 75 64 65 20 3c 73 79 73 |>.X#incl|ude <sys|
|000056c0| 2f 74 79 70 65 73 2e 68 | 3e 0a 58 23 69 6e 63 6c |/types.h|>.X#incl|
|000056d0| 75 64 65 20 3c 73 79 73 | 2f 73 74 61 74 2e 68 3e |ude <sys|/stat.h>|
|000056e0| 0a 58 0a 58 0a 58 69 6e | 74 20 74 69 6d 65 5f 72 |.X.X.Xin|t time_r|
|000056f0| 61 6e 64 28 29 0a 58 7b | 0a 58 20 73 74 72 75 63 |and().X{|.X struc|
|00005700| 74 20 74 6d 20 2a 6c 6f | 63 61 6c 74 69 6d 65 28 |t tm *lo|caltime(|
|00005710| 29 2c 20 2a 6e 6f 77 74 | 69 6d 65 3b 0a 58 20 6c |), *nowt|ime;.X l|
|00005720| 6f 6e 67 20 69 6e 74 74 | 69 6d 65 3b 0a 58 0a 58 |ong intt|ime;.X.X|
|00005730| 20 69 6e 74 74 69 6d 65 | 20 3d 20 74 69 6d 65 28 | inttime| = time(|
|00005740| 29 3b 0a 58 20 6e 6f 77 | 74 69 6d 65 20 3d 20 6c |);.X now|time = l|
|00005750| 6f 63 61 6c 74 69 6d 65 | 28 26 69 6e 74 74 69 6d |ocaltime|(&inttim|
|00005760| 65 29 3b 0a 58 20 72 65 | 74 75 72 6e 28 28 69 6e |e);.X re|turn((in|
|00005770| 74 29 28 28 6e 6f 77 74 | 69 6d 65 2d 3e 74 6d 5f |t)((nowt|ime->tm_|
|00005780| 73 65 63 29 29 29 3b 0a | 58 7d 0a 58 0a 58 0a 58 |sec)));.|X}.X.X.X|
|00005790| 6d 61 69 6e 28 61 72 67 | 63 2c 61 72 67 76 29 20 |main(arg|c,argv) |
|000057a0| 69 6e 74 20 61 72 67 63 | 3b 20 63 68 61 72 20 2a |int argc|; char *|
|000057b0| 61 72 67 76 5b 5d 3b 0a | 58 7b 0a 58 69 6e 74 20 |argv[];.|X{.Xint |
|000057c0| 69 2c 20 6d 79 5f 66 62 | 20 3d 20 30 3b 0a 58 63 |i, my_fb| = 0;.Xc|
|000057d0| 68 61 72 20 2a 66 62 2c | 20 2a 73 74 72 63 70 79 |har *fb,| *strcpy|
|000057e0| 28 29 3b 0a 58 0a 58 20 | 20 20 69 66 20 28 61 72 |();.X.X | if (ar|
|000057f0| 67 63 20 3d 3d 20 31 29 | 20 7b 0a 58 20 20 20 20 |gc == 1)| {.X |
|00005800| 20 20 20 66 70 72 69 6e | 74 66 28 73 74 64 65 72 | fprin|tf(stder|
|00005810| 72 2c 22 55 73 61 67 65 | 3a 20 73 63 6c 6f 61 64 |r,"Usage|: scload|
|00005820| 20 5b 2d 66 20 66 72 61 | 6d 65 5f 62 75 66 66 65 | [-f fra|me_buffe|
|00005830| 72 5d 20 66 69 6c 65 6e | 61 6d 65 5c 6e 22 29 3b |r] filen|ame\n");|
|00005840| 0a 58 09 65 78 69 74 28 | 31 29 3b 0a 58 20 20 20 |.X.exit(|1);.X |
|00005850| 7d 0a 58 0a 58 20 20 20 | 69 66 20 28 28 61 72 67 |}.X.X |if ((arg|
|00005860| 76 5b 31 5d 5b 30 5d 20 | 3d 3d 20 27 2d 27 29 20 |v[1][0] |== '-') |
|00005870| 26 26 20 28 61 72 67 76 | 5b 31 5d 5b 31 5d 20 3d |&& (argv|[1][1] =|
|00005880| 3d 20 27 66 27 29 29 20 | 7b 0a 58 09 69 66 20 28 |= 'f')) |{.X.if (|
|00005890| 61 72 67 63 20 3c 20 34 | 29 20 7b 0a 58 20 20 20 |argc < 4|) {.X |
|000058a0| 20 20 20 20 20 20 20 20 | 66 70 72 69 6e 74 66 28 | |fprintf(|
|000058b0| 73 74 64 65 72 72 2c 22 | 55 73 61 67 65 3a 20 73 |stderr,"|Usage: s|
|000058c0| 63 6c 6f 61 64 20 5b 2d | 66 20 66 72 61 6d 65 5f |cload [-|f frame_|
|000058d0| 62 75 66 66 65 72 5d 20 | 66 69 6c 65 6e 61 6d 65 |buffer] |filename|
|000058e0| 5c 6e 22 29 3b 0a 58 09 | 20 20 20 65 78 69 74 28 |\n");.X.| exit(|
|000058f0| 31 29 3b 0a 58 09 7d 0a | 58 09 66 62 20 3d 20 73 |1);.X.}.|X.fb = s|
|00005900| 74 72 63 70 79 28 28 63 | 68 61 72 20 2a 29 6d 61 |trcpy((c|har *)ma|
|00005910| 6c 6c 6f 63 28 73 74 72 | 6c 65 6e 28 61 72 67 76 |lloc(str|len(argv|
|00005920| 5b 32 5d 29 2b 31 29 2c | 20 61 72 67 76 5b 32 5d |[2])+1),| argv[2]|
|00005930| 29 3b 0a 58 09 6d 79 5f | 66 62 20 3d 20 31 3b 0a |);.X.my_|fb = 1;.|
|00005940| 58 20 20 20 7d 0a 58 20 | 20 20 65 6c 73 65 20 66 |X }.X | else f|
|00005950| 62 20 3d 20 73 74 72 63 | 70 79 28 28 63 68 61 72 |b = strc|py((char|
|00005960| 20 2a 29 6d 61 6c 6c 6f | 63 28 38 29 2c 20 22 2f | *)mallo|c(8), "/|
|00005970| 64 65 76 2f 66 62 22 29 | 3b 0a 58 20 20 20 69 66 |dev/fb")|;.X if|
|00005980| 20 28 61 72 67 63 29 0a | 58 20 20 20 7b 0a 58 20 | (argc).|X {.X |
|00005990| 20 20 66 6f 72 28 69 3d | 31 2b 6d 79 5f 66 62 2a | for(i=|1+my_fb*|
|000059a0| 32 3b 69 3c 61 72 67 63 | 3b 69 2b 2b 29 0a 58 20 |2;i<argc|;i++).X |
|000059b0| 20 20 20 20 6e 65 77 5f | 73 63 5f 6c 6f 61 64 28 | new_|sc_load(|
|000059c0| 61 72 67 76 5b 69 5d 2c | 20 66 62 29 3b 0a 58 20 |argv[i],| fb);.X |
|000059d0| 20 20 7d 0a 58 20 20 20 | 65 6c 73 65 0a 58 20 20 | }.X |else.X |
|000059e0| 20 20 20 6e 65 77 5f 73 | 63 5f 6c 6f 61 64 28 22 | new_s|c_load("|
|000059f0| 22 2c 20 66 62 29 3b 0a | 58 7d 0a 58 0a 58 0a 58 |", fb);.|X}.X.X.X|
|00005a00| 6e 65 77 5f 73 63 5f 6c | 6f 61 64 28 66 69 6c 65 |new_sc_l|oad(file|
|00005a10| 6e 61 6d 65 2c 20 66 62 | 29 0a 58 63 68 61 72 20 |name, fb|).Xchar |
|00005a20| 2a 66 69 6c 65 6e 61 6d | 65 2c 20 2a 66 62 3b 0a |*filenam|e, *fb;.|
|00005a30| 58 7b 0a 58 20 20 63 68 | 61 72 20 63 6f 6c 6f 72 |X{.X ch|ar color|
|00005a40| 6d 61 70 6e 61 6d 65 5b | 32 35 36 5d 3b 0a 58 20 |mapname[|256];.X |
|00005a50| 20 73 74 72 75 63 74 20 | 72 61 73 74 65 72 66 69 | struct |rasterfi|
|00005a60| 6c 65 20 72 68 3b 0a 58 | 20 20 63 6f 6c 6f 72 6d |le rh;.X| colorm|
|00005a70| 61 70 5f 74 20 63 6f 6c | 6f 72 6d 61 70 3b 0a 58 |ap_t col|ormap;.X|
|00005a80| 20 20 46 49 4c 45 20 2a | 66 70 2c 2a 66 6f 70 65 | FILE *|fp,*fope|
|00005a90| 6e 28 29 3b 0a 58 20 20 | 69 6e 74 09 69 2c 20 6a |n();.X |int.i, j|
|00005aa0| 2c 77 69 64 74 68 2c 68 | 65 69 67 68 74 2c 6f 66 |,width,h|eight,of|
|00005ab0| 66 5f 78 2c 6f 66 66 5f | 79 3b 0a 58 20 20 73 74 |f_x,off_|y;.X st|
|00005ac0| 72 75 63 74 20 70 69 78 | 72 65 63 74 09 2a 6c 69 |ruct pix|rect.*li|
|00005ad0| 6e 65 2c 20 2a 73 63 72 | 65 65 6e 2c 20 2a 73 63 |ne, *scr|een, *sc|
|00005ae0| 72 65 65 6e 5f 74 65 6d | 70 3b 0a 58 20 20 69 6e |reen_tem|p;.X in|
|00005af0| 74 20 73 6c 65 65 70 5f | 74 69 6d 65 3d 35 30 30 |t sleep_|time=500|
|00005b00| 3b 0a 58 0a 58 09 73 72 | 61 6e 64 28 74 69 6d 65 |;.X.X.sr|and(time|
|00005b10| 5f 72 61 6e 64 28 29 29 | 3b 0a 58 09 69 66 20 28 |_rand())|;.X.if (|
|00005b20| 66 69 6c 65 6e 61 6d 65 | 5b 30 5d 29 0a 58 09 7b |filename|[0]).X.{|
|00005b30| 0a 58 20 20 09 20 20 66 | 70 20 3d 20 66 6f 70 65 |.X . f|p = fope|
|00005b40| 6e 28 66 69 6c 65 6e 61 | 6d 65 2c 22 72 22 29 3b |n(filena|me,"r");|
|00005b50| 0a 58 20 20 09 20 20 69 | 66 20 28 21 66 70 29 0a |.X . i|f (!fp).|
|00005b60| 58 20 20 09 20 20 7b 0a | 58 20 20 09 20 20 20 20 |X . {.|X . |
|00005b70| 66 70 72 69 6e 74 66 28 | 73 74 64 65 72 72 2c 22 |fprintf(|stderr,"|
|00005b80| 65 72 72 6f 72 20 6f 70 | 65 6e 20 66 69 6c 65 20 |error op|en file |
|00005b90| 25 73 20 66 6f 72 20 72 | 65 61 64 5c 6e 22 2c 20 |%s for r|ead\n", |
|00005ba0| 66 69 6c 65 6e 61 6d 65 | 29 3b 0a 58 20 20 09 20 |filename|);.X . |
|00005bb0| 20 20 20 72 65 74 75 72 | 6e 3b 0a 58 20 20 09 20 | retur|n;.X . |
|00005bc0| 20 7d 0a 58 09 7d 0a 58 | 09 65 6c 73 65 0a 58 09 | }.X.}.X|.else.X.|
|00005bd0| 20 20 66 70 20 3d 20 73 | 74 64 69 6e 3b 0a 58 0a | fp = s|tdin;.X.|
|00005be0| 58 09 73 63 72 65 65 6e | 20 3d 20 70 72 5f 6f 70 |X.screen| = pr_op|
|00005bf0| 65 6e 28 66 62 29 3b 0a | 58 09 69 66 20 28 21 73 |en(fb);.|X.if (!s|
|00005c00| 63 72 65 65 6e 29 0a 58 | 09 20 20 20 65 78 69 74 |creen).X|. exit|
|00005c10| 28 31 29 3b 0a 58 0a 58 | 20 20 20 20 69 66 20 28 |(1);.X.X| if (|
|00005c20| 73 63 72 65 65 6e 2d 3e | 70 72 5f 64 65 70 74 68 |screen->|pr_depth|
|00005c30| 20 3e 20 31 29 0a 58 20 | 20 20 20 7b 0a 58 20 20 | > 1).X | {.X |
|00005c40| 20 20 20 20 73 6c 65 65 | 70 5f 74 69 6d 65 20 3d | slee|p_time =|
|00005c50| 20 30 3b 0a 58 20 20 20 | 20 20 20 69 66 20 28 70 | 0;.X | if (p|
|00005c60| 72 5f 6c 6f 61 64 5f 68 | 65 61 64 65 72 28 66 70 |r_load_h|eader(fp|
|00005c70| 2c 26 72 68 29 29 20 7b | 0a 58 20 20 20 20 20 20 |,&rh)) {|.X |
|00005c80| 20 20 70 65 72 72 6f 72 | 28 22 73 63 6c 6f 61 64 | perror|("scload|
|00005c90| 3a 20 70 72 5f 6c 6f 61 | 64 5f 68 65 61 64 65 72 |: pr_loa|d_header|
|00005ca0| 22 29 3b 0a 58 20 20 20 | 20 20 20 20 20 65 78 69 |");.X | exi|
|00005cb0| 74 28 2d 31 29 3b 0a 58 | 20 20 20 20 20 20 20 20 |t(-1);.X| |
|00005cc0| 7d 3b 0a 58 20 20 20 20 | 20 20 69 66 20 28 70 72 |};.X | if (pr|
|00005cd0| 5f 6c 6f 61 64 5f 63 6f | 6c 6f 72 6d 61 70 28 66 |_load_co|lormap(f|
|00005ce0| 70 2c 26 72 68 2c 26 63 | 6f 6c 6f 72 6d 61 70 29 |p,&rh,&c|olormap)|
|00005cf0| 29 20 7b 0a 58 20 20 20 | 20 20 20 20 20 70 65 72 |) {.X | per|
|00005d00| 72 6f 72 28 22 73 63 6c | 6f 61 64 3a 20 70 72 5f |ror("scl|oad: pr_|
|00005d10| 6c 6f 61 64 5f 63 6f 6c | 6f 72 6d 61 70 22 29 3b |load_col|ormap");|
|00005d20| 0a 58 20 20 20 20 20 20 | 20 20 65 78 69 74 28 2d |.X | exit(-|
|00005d30| 31 29 3b 0a 58 20 20 20 | 20 20 20 20 20 7d 3b 0a |1);.X | };.|
|00005d40| 58 20 20 20 20 20 20 69 | 66 20 28 21 28 73 63 72 |X i|f (!(scr|
|00005d50| 65 65 6e 5f 74 65 6d 70 | 3d 70 72 5f 6c 6f 61 64 |een_temp|=pr_load|
|00005d60| 5f 69 6d 61 67 65 28 66 | 70 2c 26 72 68 2c 26 63 |_image(f|p,&rh,&c|
|00005d70| 6f 6c 6f 72 6d 61 70 29 | 29 29 20 7b 0a 58 20 20 |olormap)|)) {.X |
|00005d80| 20 20 20 20 20 20 20 70 | 65 72 72 6f 72 28 22 73 | p|error("s|
|00005d90| 63 6c 6f 61 64 3a 20 70 | 72 5f 6c 6f 61 64 5f 69 |cload: p|r_load_i|
|00005da0| 6d 61 67 65 22 29 3b 0a | 58 20 20 20 20 20 20 20 |mage");.|X |
|00005db0| 20 20 65 78 69 74 28 2d | 31 29 3b 0a 58 20 20 20 | exit(-|1);.X |
|00005dc0| 20 20 20 20 20 20 7d 3b | 0a 58 20 20 20 20 20 20 | };|.X |
|00005dd0| 69 66 20 28 63 6f 6c 6f | 72 6d 61 70 2e 6c 65 6e |if (colo|rmap.len|
|00005de0| 67 74 68 29 0a 58 20 20 | 20 20 20 20 20 20 70 72 |gth).X | pr|
|00005df0| 5f 70 75 74 63 6f 6c 6f | 72 6d 61 70 28 73 63 72 |_putcolo|rmap(scr|
|00005e00| 65 65 6e 2c 30 2c 72 68 | 2e 72 61 73 5f 6d 61 70 |een,0,rh|.ras_map|
|00005e10| 6c 65 6e 67 74 68 2f 33 | 2c 63 6f 6c 6f 72 6d 61 |length/3|,colorma|
|00005e20| 70 2e 6d 61 70 5b 30 5d | 2c 0a 58 20 20 20 20 20 |p.map[0]|,.X |
|00005e30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005e40| 63 6f 6c 6f 72 6d 61 70 | 2e 6d 61 70 5b 31 5d 2c |colormap|.map[1],|
|00005e50| 63 6f 6c 6f 72 6d 61 70 | 2e 6d 61 70 5b 32 5d 29 |colormap|.map[2])|
|00005e60| 3b 0a 58 20 20 0a 58 20 | 20 20 20 7d 0a 58 20 20 |;.X .X | }.X |
|00005e70| 20 20 65 6c 73 65 0a 58 | 20 20 20 20 7b 0a 58 20 | else.X| {.X |
|00005e80| 20 20 20 20 20 20 20 73 | 63 72 65 65 6e 5f 74 65 | s|creen_te|
|00005e90| 6d 70 20 3d 20 70 72 5f | 6c 6f 61 64 28 66 70 2c |mp = pr_|load(fp,|
|00005ea0| 4e 55 4c 4c 29 3b 0a 58 | 20 20 20 20 20 20 20 20 |NULL);.X| |
|00005eb0| 69 66 20 28 21 73 63 72 | 65 65 6e 5f 74 65 6d 70 |if (!scr|een_temp|
|00005ec0| 29 0a 58 20 20 20 20 20 | 20 20 20 7b 0a 58 20 20 |).X | {.X |
|00005ed0| 20 20 20 20 20 20 20 20 | 20 20 66 70 72 69 6e 74 | | fprint|
|00005ee0| 66 28 73 74 64 65 72 72 | 2c 22 45 72 72 6f 72 20 |f(stderr|,"Error |
|00005ef0| 72 65 61 64 69 6e 67 20 | 72 61 73 74 65 72 66 69 |reading |rasterfi|
|00005f00| 6c 65 20 68 65 61 64 65 | 72 2e 5c 6e 22 29 3b 0a |le heade|r.\n");.|
|00005f10| 58 20 20 20 20 20 20 20 | 20 20 20 20 20 65 78 69 |X | exi|
|00005f20| 74 28 30 29 3b 0a 58 20 | 20 20 20 20 20 20 20 7d |t(0);.X | }|
|00005f30| 0a 58 20 20 20 20 7d 0a | 58 09 77 69 64 74 68 20 |.X }.|X.width |
|00005f40| 3d 20 73 63 72 65 65 6e | 5f 74 65 6d 70 2d 3e 70 |= screen|_temp->p|
|00005f50| 72 5f 73 69 7a 65 2e 78 | 3b 0a 58 09 68 65 69 67 |r_size.x|;.X.heig|
|00005f60| 68 74 20 3d 20 73 63 72 | 65 65 6e 5f 74 65 6d 70 |ht = scr|een_temp|
|00005f70| 2d 3e 70 72 5f 73 69 7a | 65 2e 79 3b 0a 58 09 69 |->pr_siz|e.y;.X.i|
|00005f80| 66 20 28 73 63 72 65 65 | 6e 2d 3e 70 72 5f 73 69 |f (scree|n->pr_si|
|00005f90| 7a 65 2e 78 20 3e 20 73 | 63 72 65 65 6e 5f 74 65 |ze.x > s|creen_te|
|00005fa0| 6d 70 2d 3e 70 72 5f 73 | 69 7a 65 2e 78 29 0a 58 |mp->pr_s|ize.x).X|
|00005fb0| 09 20 20 20 6f 66 66 5f | 78 20 3d 20 28 73 63 72 |. off_|x = (scr|
|00005fc0| 65 65 6e 2d 3e 70 72 5f | 73 69 7a 65 2e 78 20 2d |een->pr_|size.x -|
|00005fd0| 20 73 63 72 65 65 6e 5f | 74 65 6d 70 2d 3e 70 72 | screen_|temp->pr|
|00005fe0| 5f 73 69 7a 65 2e 78 29 | 2f 32 3b 0a 58 09 69 66 |_size.x)|/2;.X.if|
|00005ff0| 20 28 73 63 72 65 65 6e | 2d 3e 70 72 5f 73 69 7a | (screen|->pr_siz|
|00006000| 65 2e 79 20 3e 20 73 63 | 72 65 65 6e 5f 74 65 6d |e.y > sc|reen_tem|
|00006010| 70 2d 3e 70 72 5f 73 69 | 7a 65 2e 79 29 0a 58 09 |p->pr_si|ze.y).X.|
|00006020| 20 20 20 6f 66 66 5f 79 | 20 3d 20 28 73 63 72 65 | off_y| = (scre|
|00006030| 65 6e 2d 3e 70 72 5f 73 | 69 7a 65 2e 79 20 2d 20 |en->pr_s|ize.y - |
|00006040| 73 63 72 65 65 6e 5f 74 | 65 6d 70 2d 3e 70 72 5f |screen_t|emp->pr_|
|00006050| 73 69 7a 65 2e 79 29 2f | 32 3b 0a 58 0a 58 09 73 |size.y)/|2;.X.X.s|
|00006060| 77 69 74 63 68 28 72 61 | 6e 64 28 29 25 38 29 20 |witch(ra|nd()%8) |
|00006070| 7b 20 20 0a 58 09 63 61 | 73 65 20 30 3a 0a 58 09 |{ .X.ca|se 0:.X.|
|00006080| 09 66 6f 72 20 28 6a 3d | 68 65 69 67 68 74 2d 31 |.for (j=|height-1|
|00006090| 36 3b 20 6a 20 3e 20 30 | 3b 20 6a 2d 3d 31 36 29 |6; j > 0|; j-=16)|
|000060a0| 0a 58 09 09 7b 0a 58 09 | 09 20 20 20 70 72 5f 72 |.X..{.X.|. pr_r|
|000060b0| 6f 70 28 73 63 72 65 65 | 6e 2c 6f 66 66 5f 78 2c |op(scree|n,off_x,|
|000060c0| 6a 2b 6f 66 66 5f 79 2c | 77 69 64 74 68 2c 68 65 |j+off_y,|width,he|
|000060d0| 69 67 68 74 2d 6a 2c 50 | 49 58 5f 53 52 43 2c 73 |ight-j,P|IX_SRC,s|
|000060e0| 63 72 65 65 6e 5f 74 65 | 6d 70 2c 30 2c 30 29 3b |creen_te|mp,0,0);|
|000060f0| 0a 58 09 09 20 20 20 75 | 73 6c 65 65 70 28 73 6c |.X.. u|sleep(sl|
|00006100| 65 65 70 5f 74 69 6d 65 | 29 3b 0a 58 09 09 7d 0a |eep_time|);.X..}.|
|00006110| 58 09 09 70 72 5f 72 6f | 70 28 73 63 72 65 65 6e |X..pr_ro|p(screen|
|00006120| 2c 6f 66 66 5f 78 2c 6f | 66 66 5f 79 2c 77 69 64 |,off_x,o|ff_y,wid|
|00006130| 74 68 2c 68 65 69 67 68 | 74 2c 50 49 58 5f 53 52 |th,heigh|t,PIX_SR|
|00006140| 43 2c 73 63 72 65 65 6e | 5f 74 65 6d 70 2c 30 2c |C,screen|_temp,0,|
|00006150| 30 29 3b 0a 58 09 09 0a | 58 09 09 62 72 65 61 6b |0);.X...|X..break|
|00006160| 3b 0a 58 09 63 61 73 65 | 20 31 3a 0a 58 0a 58 09 |;.X.case| 1:.X.X.|
|00006170| 09 66 6f 72 20 28 6a 3d | 30 3b 20 6a 20 3c 20 68 |.for (j=|0; j < h|
|00006180| 65 69 67 68 74 3b 20 6a | 2b 3d 33 32 29 0a 58 09 |eight; j|+=32).X.|
|00006190| 09 20 20 20 66 6f 72 20 | 28 69 3d 30 3b 20 69 20 |. for |(i=0; i |
|000061a0| 3c 20 77 69 64 74 68 3b | 20 69 2b 3d 33 32 29 0a |< width;| i+=32).|
|000061b0| 58 09 09 20 20 20 20 20 | 20 70 72 5f 72 6f 70 28 |X.. | pr_rop(|
|000061c0| 73 63 72 65 65 6e 2c 69 | 2b 6f 66 66 5f 78 2c 6a |screen,i|+off_x,j|
|000061d0| 2b 6f 66 66 5f 79 2c 31 | 36 2c 31 36 2c 50 49 58 |+off_y,1|6,16,PIX|
|000061e0| 5f 53 52 43 2c 73 63 72 | 65 65 6e 5f 74 65 6d 70 |_SRC,scr|een_temp|
|000061f0| 2c 69 2c 6a 29 3b 0a 58 | 09 09 66 6f 72 20 28 6a |,i,j);.X|..for (j|
|00006200| 3d 31 36 3b 20 6a 20 3c | 20 68 65 69 67 68 74 3b |=16; j <| height;|
|00006210| 20 6a 2b 3d 33 32 29 0a | 58 09 09 20 20 20 66 6f | j+=32).|X.. fo|
|00006220| 72 20 28 69 3d 31 36 3b | 20 69 20 3c 20 77 69 64 |r (i=16;| i < wid|
|00006230| 74 68 3b 20 69 2b 3d 33 | 32 29 0a 58 09 09 20 20 |th; i+=3|2).X.. |
|00006240| 20 20 20 20 70 72 5f 72 | 6f 70 28 73 63 72 65 65 | pr_r|op(scree|
|00006250| 6e 2c 69 2b 6f 66 66 5f | 78 2c 6a 2b 6f 66 66 5f |n,i+off_|x,j+off_|
|00006260| 79 2c 31 36 2c 31 36 2c | 50 49 58 5f 53 52 43 2c |y,16,16,|PIX_SRC,|
|00006270| 73 63 72 65 65 6e 5f 74 | 65 6d 70 2c 69 2c 6a 29 |screen_t|emp,i,j)|
|00006280| 3b 0a 58 09 09 66 6f 72 | 20 28 6a 3d 31 36 3b 20 |;.X..for| (j=16; |
|00006290| 6a 20 3c 20 68 65 69 67 | 68 74 3b 20 6a 2b 3d 33 |j < heig|ht; j+=3|
|000062a0| 32 29 0a 58 09 09 20 20 | 20 66 6f 72 20 28 69 3d |2).X.. | for (i=|
|000062b0| 30 3b 20 69 20 3c 20 77 | 69 64 74 68 3b 20 69 2b |0; i < w|idth; i+|
|000062c0| 3d 33 32 29 0a 58 09 09 | 20 20 20 20 20 20 70 72 |=32).X..| pr|
|000062d0| 5f 72 6f 70 28 73 63 72 | 65 65 6e 2c 69 2b 6f 66 |_rop(scr|een,i+of|
|000062e0| 66 5f 78 2c 6a 2b 6f 66 | 66 5f 79 2c 31 36 2c 31 |f_x,j+of|f_y,16,1|
|000062f0| 36 2c 50 49 58 5f 53 52 | 43 2c 73 63 72 65 65 6e |6,PIX_SR|C,screen|
|00006300| 5f 74 65 6d 70 2c 69 2c | 6a 29 3b 0a 58 09 09 66 |_temp,i,|j);.X..f|
|00006310| 6f 72 20 28 6a 3d 30 3b | 20 6a 20 3c 20 68 65 69 |or (j=0;| j < hei|
|00006320| 67 68 74 3b 20 6a 2b 3d | 33 32 29 0a 58 09 09 20 |ght; j+=|32).X.. |
|00006330| 20 20 66 6f 72 20 28 69 | 3d 31 36 3b 20 69 20 3c | for (i|=16; i <|
|00006340| 20 77 69 64 74 68 3b 20 | 69 2b 3d 33 32 29 0a 58 | width; |i+=32).X|
|00006350| 09 09 20 20 20 20 20 20 | 70 72 5f 72 6f 70 28 73 |.. |pr_rop(s|
|00006360| 63 72 65 65 6e 2c 69 2b | 6f 66 66 5f 78 2c 6a 2b |creen,i+|off_x,j+|
|00006370| 6f 66 66 5f 79 2c 31 36 | 2c 31 36 2c 50 49 58 5f |off_y,16|,16,PIX_|
|00006380| 53 52 43 2c 73 63 72 65 | 65 6e 5f 74 65 6d 70 2c |SRC,scre|en_temp,|
|00006390| 69 2c 6a 29 3b 0a 58 09 | 09 62 72 65 61 6b 3b 0a |i,j);.X.|.break;.|
|000063a0| 58 0a 58 09 63 61 73 65 | 20 32 3a 0a 58 09 09 66 |X.X.case| 2:.X..f|
|000063b0| 6f 72 20 28 6a 3d 68 65 | 69 67 68 74 2d 31 36 3b |or (j=he|ight-16;|
|000063c0| 20 6a 20 3e 20 30 3b 20 | 6a 2d 3d 31 36 29 0a 58 | j > 0; |j-=16).X|
|000063d0| 09 09 7b 0a 58 09 20 20 | 20 0a 58 09 09 20 20 20 |..{.X. | .X.. |
|000063e0| 70 72 5f 72 6f 70 28 73 | 63 72 65 65 6e 2c 6f 66 |pr_rop(s|creen,of|
|000063f0| 66 5f 78 2c 6f 66 66 5f | 79 2c 77 69 64 74 68 2c |f_x,off_|y,width,|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.