(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10) (FILECREATED "24-Sep-2023 14:35:10" ("compiled on " {WMEDLEY}READAIS.;2) "23-Sep-2023 23:13:47" brecompiled exprs%: AISHISTOGRAM in "FULL 23-Sep-2023 ..." dated "23-Sep-2023 23:13:54") (FILECREATED "24-Sep-2023 14:35:09" {WMEDLEY}READAIS.;2 63146 :EDIT-BY rmk :CHANGES-TO (FNS AISHISTOGRAM) :PREVIOUS-DATE "28-Apr-88 17:04:57" {WMEDLEY}READAIS.;1) 24BITCOLORTO8BITMAP :D8 (L (8 COLORMAP 7 BITMAPRASTERWIDTH 6 BYTESPERLINE 5 BASE 4 HEIGHT 3 WIDTH 2 BLUESTREAM 1 GREENSTREAM 0 REDSTREAM))  EX@ Cki YCki ZCki [Clj_"_ O"O `Clj_&_$O&O$_Clj_*_(O*O(^CbDkFjO6jO6jO6O6 jO6@O4DkF=IO"jO"l_"JO&jO&l_&KO*jO*l_*O4DkFAHb I]MjJ_OjK__Oj@O4 AO4 BO4 Ck_0_.O0O.EdG@ L_A N_B O_ _GO _O_m&O_MOdؼMOMdOdذ(jO_MOdټMjOMdOdMlнOO_m)O_OOdؾOOOdOdذ+jO_OOdپOjOOdOdOl_OO_m+O_OOd_OOOdOdذ-jO_OOd_OjOOdOdOl_OG@ L_A N_B O_ _GO _O_m&O_MOdؼMOMdOdذ(jO_MOdټMjOMdOdMlнOO_m)O_OOdؾOOOdOdذ+jO_OOdپOjOOdOdOl_OO_m+O_OOd_OOOdOdذ-jO_OOd_OjOOdOdOl_O_,O,Ekb O0k_0#HGиO4F_6_4Yh(693 ELT 681 CLOSEST.COLOR 342 ELT 330 CLOSEST.COLOR 284 \SETFILEPTR 275 \SETFILEPTR 266 \SETFILEPTR 134 \FZEROP 42 \ALLOCBLOCK 32 \ALLOCBLOCK 22 \ALLOCBLOCK 13 GETFILEPTR) NIL () AISBLT :D8 (P 24 REGION P 23 BITOFFSET P 22 STARTPIXEL P 21 STARTSAMPLELINE P 20 TMP P 19 DIRECTION P 18 SFILEHEIGHT P 17 SFILEWIDTH P 16 BITSPERSAMPLE P 15 BITSPERPIXEL P 14 DESTBASE P 13 DESTRASTERWIDTH P 12 SOURCEBASE P 11 SRASTERWIDTH P 10 DESTSTRM P 9 DESTDD P 8 height P 7 width P 6 right P 5 bottom P 4 top P 3 left P 2 stody P 1 stodx P 0 STREAM I 11 LOBITADDRESS I 10 NBITS I 9 FILTER I 8 HOW I 7 HEIGHT I 6 WIDTH I 5 DESTBOTTOM I 4 DESTLEFT I 3 DESTINATION I 2 SOURCEBOTTOM I 1 SOURCELEFT I 0 FILE)  GjhAjbBjbDjbEjb GgbGjb@h` X@Xdg X _(d_ O(_"O(_$O(_O(_&dloO& Cj[CkپCkټVCgh 0_OOjOlOhGlmMLO%OjOO jOMOOM@O @ >@EFGlO OdMEGb OH__MLO+Oj~OO njOMOOM]@O IFO$O""EO$EO$O@ O NǿO$k_$OdMEGb OH__(370 LLSH 338 \SETFILEPTR 309 \FZEROP 225 \SETFILEPTR 200 \FZEROP 123 \SETFILEPTR 75 LLSH 26 EXPT 16 GETFILEPTR) (239 FDEV 232 STREAM 147 FDEV 140 STREAM) () AISBLT4TO4 :D8 (L (10 LOBITADDRESS 9 NBITS 8 SRASTERWIDTH 7 STARTSAMPLELINE 6 STARTBYTE 5 BITMAPRASTERWIDTH 4 BASE 3 HEIGHT 2 WIDTH 1 MODULATIONFLG 0 STREAM))   lGXDY@ ZBbG(A!GdlhblklG kٿjlGG\Llo lG k[l G KlG KlG KG [nJFGCkHJFGH O@OjOO yjOOJFGCkHOJFGCkHQIb@O Bk_ON(DdM@ @ L KDkbOk_IEйOH__rhJFGCkHJFGH O>OjOO jOOJFGCkHOJFGCkHIb@O Bk__OOD@ @ DkbOk_IEйOH__(420 \SETFILEPTR 366 \FZEROP 283 LRSH 252 \SETFILEPTR 198 \FZEROP 142 LLSH 134 LLSH 123 LLSH 112 LLSH 99 EXPT 89 ERROR 59 LLSH 16 GETFILEPTR) NIL ( 84 "NBITS plus LOBITADDRESS is too large.") AISBLT8TO4LESSFSA :D8 (P 24 X P 21 Y P 19 I P 17 THREEEIGHTSERR P 16 INTENSITYBASE P 15 MAXVALUE P 14 LOBITSMASK P 13 DELBITS P 12 VAL P 11 COMPLMASK P 10 END P 9 BEG P 8 WORD P 7 ERR P 6 BYTE P 5 ERRTABLEPTR P 4 THISPIXELERROR P 3 NEXTLINEERRORTABLE P 2 DATABEG P 1 DESTRIGHT P 0 BYTESPERLINE I 11 LOBITADDRESS I 10 NBITS I 9 HEIGHT I 8 WIDTH I 7 DESTRASTERWIDTH I 6 DESTPIXEL I 5 DESTBASE I 4 SOURCEHEIGHT I 3 SRASTERWIDTH I 2 STARTSAMPLELINE I 1 SOURCEBYTE I 0 STREAM)  0FGmY@ ZGki [lG_llG k_lG k_lG _ OjO&O$rGljO&O$zGblCXJADkBH_dGkH_OG l_OOO,ZO,jO,O, jO,3OO*1O O&lO&OO&k_&uKO&jO&l_&tO*OK]Mj@O* IFO0O.EO0EO0 Ol@ L^lOjNjNO _NO O_nOl@_nOl_"MO"ؼMOMdO"MlнG O0k_0uO*dOEGb O*H_,_*h(418 \PUTBASENYBBLE 412 LLSH 336 LRSH 304 \GETBASENYBBLE 278 \SETFILEPTR 192 \FZEROP 156 LLSH 81 \ALLOCBLOCK 76 EXPT 63 EXPT 50 EXPT 30 \ALLOCBLOCK 19 GETFILEPTR) NIL () AISBLT8TO1FSA :D8 (P 26 X P 23 Y P 21 I P 19 THREEEIGHTSERR P 18 INTENSITYBASE P 17 FINALWORDMASK P 16 FIRSTWORDBITS P 15 BITOFFSET P 14 DESTRIGHTWORD P 13 DESTLEFTWORD P 12 DESTRIGHT P 11 VAL P 10 END P 9 BEG P 8 BMWORD P 7 BITPTR P 6 ERR P 5 BYTE P 4 ERRTABLEPTR P 3 THISPIXELERROR P 2 NEXTLINEERRORTABLE P 1 DATABEG P 0 BYTESPERLINE I 9 HEIGHT I 8 WIDTH I 7 DESTRASTERWIDTH I 6 DESTPIXEL I 5 DESTBASE I 4 SOURCEHEIGHT I 3 SRASTERWIDTH I 2 STARTSAMPLELINE I 1 SOURCEBYTE I 0 STREAM)  P@ YGki ZFGm_F_O_Fl_lO_ llOGl k_"l _$dlO$jGljO*O(NlCXIADkBH_dGkH_OOO0@O0j5O0O0 %jO0OO.JO*jO*l_*O.OEOO _O_J\Lj@O. OFO4O2AOjEOOlO EOO"O.dOEGb O.H_0_.MO@ K]ljjMkMk_MO$OپnNl@^nNl_&LO&ػLNLdO&Llм_Ok_lEO4Oj__O4k_47h(294 LLSH 258 \SETFILEPTR 232 LRSH 177 \FZEROP 89 \ALLOCBLOCK 78 EXPT 22 \ALLOCBLOCK 11 GETFILEPTR) NIL () AISBLT8TO1TRUNC :D8 (L (9 FILTER 8 BITOFFSET 7 SRASTERWIDTH 6 STARTSAMPLELINE 5 STARTBYTE 4 BITMAPRASTERWIDTH 3 BASE 2 HEIGHT 1 WIDTH 0 STREAM))   CYGZ@ [lG_llGAl k_lGXKEFH^KEFBkH_dNO-OjOO jOOOOOIbO G@O Ak__OO+LjCMlL COIDйOH__MJ @ lj@ kLk\lCMj]CkbOk_h(222 ELT 177 LLSH 145 \SETFILEPTR 133 LRSH 98 \FZEROP 38 EXPT 13 GETFILEPTR) NIL () CLOSEST.COLOR :D8 (P 3 COLOR P 1 ANSWER P 0 DISTANCE I 3 BLUE I 2 GREEN I 1 RED I 0 COLORMAP) = oX@ kjKJI@K ABC H@K Kk[(52 ELT 41 COLOR.DISTANCE 33 ELT 14 ARRAYSIZE) NIL ( 7 2147483647) GRAPHAISHISTOGRAM :D8 (P 5 I P 3 MAXELT P 2 MAX P 1 ARSIZE P 0 W I 1 W I 0 HISTOGRAM) @Hnl XjZd[@ YjMdLIkjML+IkjMdL8Hl MjkgH Ml ]@M J@M M[Mk]l Ml @M lJkgH Mk](154 DRAWLINE 135 ELT 113 ELT 103 ELT 88 DRAWLINE 31 ARRAYSIZE 20 CREATEW 15 GETBOXREGION) (147 REPLACE 81 REPLACE) () AISHISTOGRAM :D8 (P 26 BIT P 24 BIT P 21 LINE P 15 END P 14 BEG P 13 HEIGHT P 12 WIDTH P 11 TOP P 10 RIGHT P 9 BOTTOM P 8 LEFT P 7 SFILEBYTESPERLINE P 6 SFILEHEIGHT P 5 SFILEWIDTH P 4 BITSPERSAMPLE P 3 TMP P 2 AISHISTOGRAM P 1 DATABEG P 0 STREAM I 1 REGION I 0 FILE) P@h` X@Xdg X [d\K]K^K_H YlL hjd ZANkO*O( H JMk_ dO O djj_MAA_"dO"O"djj_dOO_ANk_$dO$O$_NAA_&dO&O&_OOIONOO_IONOO_OO,'O,j_O,O, QjO,OO*O*O@HO* OkO0O.JH [JK k O0k_0O*O_,_*OkO4O2JH [JK k O4k_4O*k_*(397 SETA 390 ELT 340 SETA 333 ELT 308 \SETFILEPTR 281 \FZEROP 109 CLOSEF 84 ARRAY 76 EXPT 67 GETFILEPTR 40 INSUREAISFILE 34 OPENSTREAM 17 FINDFILE) (29 INPUT 12 AISDIRECTORIES) () SMOOTHEDFILTER :D8 (P 11 I P 9 NPTS P 8 NTOMOVE P 7 BUCKETSIZE P 6 POINTSPAST P 5 NEWINTENSITY P 4 FILEINTENSITY P 3 POINTSLESS P 2 TOTALPOINTS P 1 SMOOTHARRAY P 0 ARSIZE I 0 HISTOGRAM)  @ Xj[d]d^Hhjd YHkjd OOOZdn_Hkj OOIO@O _Ok_@O _KO[O0KO_IOMOl MdllOؽKOO[IOM Ok_(165 SETA 132 SETA 97 ELT 77 ELT 24 ARRAY 8 ARRAYSIZE) NIL () SLOW.COLOR.DISTANCE :D8 (I 3 BLUE I 2 GREEN I 1 RED I 0 RGB) C@AHmHjHd@BHmHjHd@CHmHjHdNIL NIL () FAST.COLOR.DISTANCE :D8 (I 3 BLUE I 2 GREEN I 1 RED I 0 RGB) :@AjHHjH@BjHHjH@CjHHjHNIL NIL () INSUREAISFILE :D8 (P 6 DIRECTION P 5 RASTERWIDTH P 4 BITSPERPIXEL P 3 HEIGHT P 2 WIDTH P 1 HEADERLENGTH P 0 STREAM I 0 FILE) p@g Xdj H H nH o H H YH H ko H H [H H ZH H ^H H ko H H koh H H \djkH H ]HlI @HH LJKMNh(182 CLOSEF 172 \SETFILEPTR 141 ERROR 120 ERROR 79 ERROR 49 ERROR 39 FULLNAME 21 \SETFILEPTR 13 OPENSTREAM) (8 INPUT) ( 135 "Coding type is not 1 - UCA" 115 "not 1 sample per pixel." 74 "not implemented to handle raster parts of this type." 44 " is not an AIS file.") SHOWCOLORAIS :D8 (P 7 BLUEBITS P 6 GREENBITS P 5 REDBITS P 4 BLUEFILE P 3 GREENFILE P 2 REDFILE P 1 BASENAME P 0 UBASEFILE I 9 HEIGHT I 8 WIDTH I 7 DESTBOTTOM I 6 DESTLEFT I 5 DESTINATION I 4 SOURCEBOTTOM I 3 SOURCELEFT I 2 HOW I 1 COLORMAPINFO I 0 BASEFILE)  P@dl @@@\@d3@@ Xg'gIo gohH gIo gohH 1gIo gohH gIo gohH 1gIo gohH \@ Ad]0AAA_JCDEFGGGBhMNO KCDEFGGGBhNO LCDEFGGGBhOj JKLBEA A h(421 \ILLEGAL.ARG 414 SHOWCOLORAIS1 396 AISBLT 373 AISBLT 350 AISBLT 302 \ILLEGAL.ARG 294 INFILEP 289 PACKFILENAME 284 \APPEND2 263 CONCAT 245 INFILEP 240 PACKFILENAME 235 \APPEND2 214 CONCAT 197 INFILEP 192 PACKFILENAME 187 \APPEND2 166 CONCAT 148 INFILEP 143 PACKFILENAME 138 \APPEND2 117 CONCAT 100 INFILEP 95 PACKFILENAME 90 \APPEND2 69 CONCAT 45 UNPACKFILENAME 14 EQLENGTH) (268 EXTENSION 252 NAME 219 EXTENSION 203 NAME 171 EXTENSION 155 NAME 122 EXTENSION 106 NAME 74 EXTENSION 58 NAME 51 NAME) ( 273 "AIS" 258 "-BLU" 224 "AIS" 209 "-BLUE" 176 "AIS" 161 "-GRN" 127 "AIS" 112 "-GREEN" 79 "AIS" 64 "-RED") SHOWCOLORAIS1 :D8 (P 11 BYTESPERLINE P 10 BITSPERSAMPLE P 9 HEIGHT P 8 WIDTH P 7 BITMAPRASTERWIDTH P 6 BITMAPWIDTH P 5 BITMAPHEIGHT P 4 BASE P 3 BITSPERPIXEL P 2 BLUESTREAM P 1 GREENSTREAM P 0 REDSTREAM I 5 COLORMAP I 4 COLORBM I 3 HOW I 2 BLUEFILE I 1 GREENFILE I 0 REDFILE)  @g XAg YBg ZD[D_D]D^D\H _d_No O_O_O_I J Kl)Ol"HIJOdNNOdMMLOOE o H I J i(218 CLOSEF 212 CLOSEF 206 CLOSEF 199 ERROR 188 24BITCOLORTO8BITMAP 144 INSUREAISFILE 138 INSUREAISFILE 110 ERROR 90 INSUREAISFILE 37 OPENSTREAM 25 OPENSTREAM 13 OPENSTREAM) (81 BITMAP 72 BITMAP 63 BITMAP 53 BITMAP 44 BITMAP 32 INPUT 20 INPUT 8 INPUT) ( 194 " can only go from three 8 bit color files into an 8 bit colormap for now." 105 "Can't read AIS files whose width is greater than the target bitmap - yet.") WRITEAIS :D8 (P 6 HEIGHT P 5 WIDTH P 4 RASTERWIDTH P 3 BITSPERPIXEL P 2 HEADERLENGTH P 1 TEMPBITMAP P 0 STREAM I 2 REGION I 1 FILE I 0 BITMAP)  @[B #BBK @BBI IbBB@\@^@]Ag Xdl Hl nZHJ HJl Hl Hl HN HNl HM HMl Hj Hl Hj Hk Hj Hk HK HKl HL HLl Hl Hl Hl Hl HlJ H@NLl O @_OOjOlOH  (383 \ILLEGAL.ARG 377 CLOSEF 321 \SETFILEPTR 311 \BOUT 302 \BOUT 294 \BOUT 285 \BOUT 277 \BOUT 266 \BOUT 258 \BOUT 247 \BOUT 239 \BOUT 231 \BOUT 224 \BOUT 216 \BOUT 209 \BOUT 200 \BOUT 193 \BOUT 182 \BOUT 174 \BOUT 163 \BOUT 155 \BOUT 146 \BOUT 138 \BOUT 127 \BOUT 115 \BOUT 106 \BOUT 97 OPENSTREAM 47 BKBITBLT 34 BITMAPCREATE 17 REGIONP) (353 FDEV 346 STREAM 328 BITMAP 92 OUTPUT 83 BITMAP 74 BITMAP 65 BITMAP 8 BITMAP) () WRITEAIS1 :D8 (P 2 A0431 P 1 Y I 5 RASTERWIDTH I 4 HEIGHT I 3 FIRSTBYTEOFFSET I 2 NBYTESPERLINE I 1 LINEBASE I 0 STREAM) 3DkIHh@ @@ACBlJAEbIkYNIL (23 FDEV 16 STREAM) () \GETBASENYBBLE :D8 (L (1 D 0 X)) 5@AXAldjHdkHlHHdlNIL NIL () \PUTBASENYBBLE :D8 (L (2 V 1 D 0 X)) P AX@HYAldjBIo"dkBIolBImBImY@HIINIL NIL ( 48 -3841 33 -61441) (PRETTYCOMPRINT READAISCOMS) (RPAQQ READAISCOMS ((DECLARE%: EVAL@COMPILE DONTCOPY (CONSTANTS (NYBBLESPERWORD 4))) (* ;; "fixed INSUREAISFILE, AISBLT, AISBLT8TO8. nhb 27-Apr-88 01:58:56") (FNS 24BITCOLORTO8BITMAP AISBLT AISBLT1TO1 AISBLT8TO4MODUL AISBLT8TOLESSFSA AISBLT8TO4TRUNC AISBLT8TO8 AISBLT4TO4 AISBLT8TO4LESSFSA AISBLT8TO1FSA AISBLT8TO1TRUNC CLOSEST.COLOR GRAPHAISHISTOGRAM AISHISTOGRAM SMOOTHEDFILTER SLOW.COLOR.DISTANCE FAST.COLOR.DISTANCE INSUREAISFILE SHOWCOLORAIS SHOWCOLORAIS1 WRITEAIS WRITEAIS1 \GETBASENYBBLE \PUTBASENYBBLE) (MACROS .GET.4BIT.AND.SPREAD.ERR. .GET.1BIT.AND.SPREAD.ERR. .GET.NBIT.AND.SPREAD.ERR. .GET.LEFTMOST.4BIT .GET.LEFTMOST.BIT. .GET.BESTCOLOR.AND.SPREAD.ERR. .4BIT.MODULATE.INTENSITY.VALUE. .MODULATE.INTENSITY.VALUE. SQUARE) (P (MOVD? (QUOTE FAST.COLOR.DISTANCE) (QUOTE COLOR.DISTANCE))) (VARS AISDIRECTORIES) (GLOBALVARS AISDIRECTORIES))) (PUTPROPS .GET.4BIT.AND.SPREAD.ERR. MACRO ((STREAM) (PROGN (* returns the 4 most significant bits taking into account the error and spreads the error into the appropriate places.) (SETQ BYTE (IPLUS ( \BIN STREAM) THISPIXELERROR)) (PROG1 (COND ((IGREATERP BYTE 255) (* overflow case) 15) (T (LRSH BYTE 4 ))) (SETQ ERR (LOGAND BYTE 15)) (* put |3/8| of error into next pixel, |3/8| to one below and |1/8| to one below and to the right.) (* calculate |1/4| of error.) (SETQ ERR (LRSH ERR 2)) (* |3/8| of error to next pixel plus error from previous line) (SETQ THISPIXELERROR (IPLUS (\GETBASE ERRTABLEPTR 1) ( IPLUS ERR (LRSH ERR 1)))) (* |1/8| of error to next one down to right.) (\PUTBASE ERRTABLEPTR 1 (LRSH ERR 1)) (* |3/8| to one below) (\PUTBASE ERRTABLEPTR 0 (IPLUS (\GETBASE ERRTABLEPTR 0) (IPLUS ERR ( LRSH ERR 1)))) (SETQ ERRTABLEPTR (\ADDBASE ERRTABLEPTR 1)))))) (PUTPROPS .GET.1BIT.AND.SPREAD.ERR. MACRO ((STREAM) (PROGN (* returns the most significant bit taking into account the error and spreads the error into the appropriate places.) (SETQ BYTE (IPLUS (\BIN STREAM) THISPIXELERROR)) (PROG1 (SETQ VAL (COND ((IGREATERP BYTE 255) (* overflow case) 0) ((IGREATERP 0 BYTE) (* overflow case) 1) (T (LOGXOR (LRSH BYTE 7) 1)))) (SETQ ERR (IDIFFERENCE BYTE (\GETBASE INTENSITYBASE VAL))) (* put |3/8| of error into next pixel, |3/8| to one below and |1/4| to one below and to the right.) (* calculate |1/4| of error.) (SETQ ERR (IDIFFERENCE (LRSH (IPLUS 256 ERR) 2) 64)) (* |3/8| of error to next pixel plus error from previous line) (SETQ THREEEIGHTSERR (IPLUS ERR ( IDIFFERENCE (LRSH (IPLUS 256 ERR) 1) 128))) (SETQ THISPIXELERROR (IPLUS (\GETBASEPTR ERRTABLEPTR 2) THREEEIGHTSERR)) (* |1/4| of error to next one down to right.) (\PUTBASEPTR ERRTABLEPTR 2 ERR) (* |3/8| to one below) (\PUTBASEPTR ERRTABLEPTR 0 (IPLUS (\GETBASEPTR ERRTABLEPTR 0) THREEEIGHTSERR)) ( SETQ ERRTABLEPTR (\ADDBASE ERRTABLEPTR 2)))))) (PUTPROPS .GET.NBIT.AND.SPREAD.ERR. MACRO ((STREAM) (PROGN (* returns the NBITS most significant bits taking into account the error and spreads the error into the appropriate places.) (SETQ BYTE (IPLUS ( IDIFFERENCE 255 (\BIN STREAM)) THISPIXELERROR)) (PROG1 (SETQ VAL (COND ((IGREATERP BYTE 255) (* overflow case) MAXVALUE) ((IGREATERP 0 BYTE) 0) (T (LRSH BYTE DELBITS)))) (* put |3/8| of error into next pixel, |3/8| to one below and |1/8| to one below and to the right.) (SETQ ERR (IDIFFERENCE BYTE ( \GETBASE INTENSITYBASE VAL))) (* calculate |1/4| of error.) (SETQ ERR (IDIFFERENCE (LRSH (IPLUS 256 ERR) 2) 64)) (* |3/8| of error to next pixel plus error from previous line) (SETQ THREEEIGHTSERR ( IPLUS ERR (IDIFFERENCE (LRSH (IPLUS 256 ERR) 1) 128))) (SETQ THISPIXELERROR (IPLUS (\GETBASEPTR ERRTABLEPTR 2) THREEEIGHTSERR)) (* |1/8| of error to next one down to right.) (\PUTBASEPTR ERRTABLEPTR 2 ERR) (* |3/8| to one below) (\PUTBASEPTR ERRTABLEPTR 0 (IPLUS (\GETBASEPTR ERRTABLEPTR 0) THREEEIGHTSERR)) (SETQ ERRTABLEPTR (\ADDBASE ERRTABLEPTR 2)))))) (PUTPROPS .GET.LEFTMOST.4BIT MACRO ((STREAM) (* returns the 4 most significant bits) (LRSH (\BIN STREAM) 4))) (PUTPROPS .GET.LEFTMOST.BIT. MACRO ((STREAM) (* returns the most significant bit from an 8 bit sample. It also inverts the sign of the bit since 1 is black and 0 white. NIL) (COND ((IGREATERP (COND ( FILTERARRAY (ELT FILTERARRAY (\BIN STREAM))) (T (\BIN STREAM))) 127) 0) (T 1)))) (PUTPROPS .GET.BESTCOLOR.AND.SPREAD.ERR. MACRO (NIL (PROGN (* returns the best matching color bits taking into account the error and spreads the error into the appropriate places.) (SETQ COLOR ( CLOSEST.COLOR COLORMAP (SETQ REDBYTE (IPLUS (\BIN REDSTREAM) THISPIXELREDERROR)) (SETQ GREENBYTE ( IPLUS (\BIN GREENSTREAM) THISPIXELGREENERROR)) (SETQ BLUEBYTE (IPLUS (\BIN BLUESTREAM) THISPIXELBLUEERROR)))) (SETQ RGB (ELT COLORMAP COLOR)) (PROGN (SETQ ERR (IDIFFERENCE (fetch (RGB RED) of RGB) REDBYTE)) (COND ((IGREATERP ERR -1) (* put |3/8| of error into next pixel, |3/8| to one below and |1/8| to one below and to the right.) (* calculate |1/4| of error.) (SETQ ERR (LRSH ERR 2)) (* |3/8| of error to next pixel plus error from previous line) (SETQ THISPIXELREDERROR (IPLUS ( \GETBASEPTR REDERRTABLEPTR 2) (IPLUS ERR (LRSH ERR 1)))) (* |1/8| of error to next one down to right.) (\PUTBASEPTR REDERRTABLEPTR 2 (LRSH ERR 1)) (* |3/8| to one below) (\PUTBASEPTR REDERRTABLEPTR 0 ( IPLUS (\GETBASEPTR REDERRTABLEPTR 0) (IPLUS ERR (LRSH ERR 1))))) (T (* error is negative, do things differently.) (* calculate |1/4| of error.) (SETQ ERR (LRSH (IMINUS ERR) 2)) (* |3/8| of error to next pixel plus error from previous line) (SETQ THISPIXELREDERROR (IDIFFERENCE (\GETBASEPTR REDERRTABLEPTR 2) (IPLUS ERR (LRSH ERR 1)))) (* |1/8| of error to next one down to right.) (\PUTBASEPTR REDERRTABLEPTR 2 (IMINUS (LRSH ERR 1))) (* |3/8| to one below) (\PUTBASEPTR REDERRTABLEPTR 0 ( IDIFFERENCE (\GETBASEPTR REDERRTABLEPTR 0) (IPLUS ERR (LRSH ERR 1)))))) (SETQ REDERRTABLEPTR (\ADDBASE REDERRTABLEPTR 2))) (PROGN (SETQ ERR (IDIFFERENCE (fetch (RGB GREEN) of RGB) GREENBYTE)) (COND (( IGREATERP ERR -1) (* put |3/8| of error into next pixel, |3/8| to one below and |1/8| to one below and to the right.) (* calculate |1/4| of error.) (SETQ ERR (LRSH ERR 2)) (* |3/8| of error to next pixel plus error from previous line) (SETQ THISPIXELGREENERROR (IPLUS (\GETBASEPTR GREENERRTABLEPTR 2) ( IPLUS ERR (LRSH ERR 1)))) (* |1/8| of error to next one down to right.) (\PUTBASEPTR GREENERRTABLEPTR 2 (LRSH ERR 1)) (* |3/8| to one below) (\PUTBASEPTR GREENERRTABLEPTR 0 (IPLUS (\GETBASEPTR GREENERRTABLEPTR 0) (IPLUS ERR (LRSH ERR 1))))) (T (* error is negative, do things differently.) (* calculate |1/4| of error.) (SETQ ERR (LRSH (IMINUS ERR) 2)) (* |3/8| of error to next pixel plus error from previous line) (SETQ THISPIXELGREENERROR (IDIFFERENCE (\GETBASEPTR GREENERRTABLEPTR 2) (IPLUS ERR (LRSH ERR 1)))) (* |1/8| of error to next one down to right.) (\PUTBASEPTR GREENERRTABLEPTR 2 ( IMINUS (LRSH ERR 1))) (* |3/8| to one below) (\PUTBASEPTR GREENERRTABLEPTR 0 (IDIFFERENCE (\GETBASEPTR GREENERRTABLEPTR 0) (IPLUS ERR (LRSH ERR 1)))))) (SETQ GREENERRTABLEPTR (\ADDBASE GREENERRTABLEPTR 2) )) (PROGN (SETQ ERR (IDIFFERENCE (fetch (RGB BLUE) of RGB) BLUEBYTE)) (COND ((IGREATERP ERR -1) (* put |3/8| of error into next pixel, |3/8| to one below and |1/8| to one below and to the right.) (* calculate |1/4| of error.) (SETQ ERR (LRSH ERR 2)) (* |3/8| of error to next pixel plus error from previous line) (SETQ THISPIXELBLUEERROR (IPLUS (\GETBASEPTR BLUEERRTABLEPTR 2) (IPLUS ERR (LRSH ERR 1) ))) (* |1/8| of error to next one down to right.) (\PUTBASEPTR BLUEERRTABLEPTR 2 (LRSH ERR 1)) (* |3/8| to one below) (\PUTBASEPTR BLUEERRTABLEPTR 0 (IPLUS (\GETBASEPTR BLUEERRTABLEPTR 0) (IPLUS ERR ( LRSH ERR 1))))) (T (* error is negative, do things differently.) (* calculate |1/4| of error.) (SETQ ERR (LRSH (IMINUS ERR) 2)) (* |3/8| of error to next pixel plus error from previous line) (SETQ THISPIXELBLUEERROR (IDIFFERENCE (\GETBASEPTR BLUEERRTABLEPTR 2) (IPLUS ERR (LRSH ERR 1)))) (* |1/8| of error to next one down to right.) (\PUTBASEPTR BLUEERRTABLEPTR 2 (IMINUS (LRSH ERR 1))) (* |3/8| to one below) (\PUTBASEPTR BLUEERRTABLEPTR 0 (IDIFFERENCE (\GETBASEPTR BLUEERRTABLEPTR 0) (IPLUS ERR ( LRSH ERR 1)))))) (SETQ BLUEERRTABLEPTR (\ADDBASE BLUEERRTABLEPTR 2))) COLOR))) (PUTPROPS .4BIT.MODULATE.INTENSITY.VALUE. MACRO ((STREAM) (LOGAND (IMIN 255 (IMAX (IPLUS (\BIN STREAM) (RAND MODMIN MODMAX)) 0)) 240))) (PUTPROPS .MODULATE.INTENSITY.VALUE. MACRO ((STREAM) (IMIN 255 (IMAX (IPLUS (\BIN STREAM) (RAND MODMIN MODMAX)) 0)))) (PUTPROPS SQUARE MACRO (LAMBDA (X) (* coded this way because negative arith is not is microcode for ITIMES) (COND ((IGREATERP X -1) (ITIMES X X)) (T (ITIMES (SETQ X (IMINUS X)) X))))) (MOVD? (QUOTE FAST.COLOR.DISTANCE) (QUOTE COLOR.DISTANCE)) (RPAQQ AISDIRECTORIES (T {CORE} {DSK} {CYAN})) (PUTPROPS READAIS COPYRIGHT ("Xerox Corporation" 1982 1983 1984 1985 1986 1987 1988)) NIL