1XEROXLispLibraryPackagesCOLORINTRODUCTIONThisdocumentdescribestheInterlisp-Dfacilitiesforusingthecolordisplay.Youareencouragedtomakecommentsandsuggestions.Themachine-independentcolorgraphicscodeisstoredonthelibraryfilesLLCOLOR.DCOMandCOLOR.DCOM;COLORloadsLLCOLOR.Inordertorunit,youneedaDorado(Xerox1132)withattachedcolordisplay.TheDoradocolordriverresidesinthefileDORADOCOLOR.DCOM,whichyoushouldloadafterCOLOR.DCOM.TheDoradocolorboardsupportsfouroreightbitsperpixel(bpp)at640by480resolution.(Actuallytheboardsupports24bppalso,butInterlisp-Ddoesn'tyet.)Acolordisplay'simagecanbethoughtofasapaint-by-numberpaintingwherethenumberofapixelisitsvalue.Thenumberofbitsperpixeldeterminesthenumberofdifferentcolorsthatcanbedisplayedatonetime.Whenthereare4bpp,16colorscanbedisplayedatonce.Whenthereare8bpp,256colorscanbedisplayedatonce.Amappingtablecalledacolormapdetermineswhatcoloractuallyappearsforeachpixelvalue.Acolormapgivesthecolorintermsofhowmuchofthethreeprimarycolors(red,green,andblue)isdisplayedonthescreenforeachpossiblepixelvalue.Inthefollowingsections,thenotionsof"colormap"and"color"aredescribed.COLORBITMAPSAcolorbitmapisactuallyabitmapthatallowsmorethanonebitperpixel.Totestwhetherabitmapisacolorbitmap,thefunctionBITSPERPIXELcanbeused.(BITSPERPIXELBitMap)[Function]returnsthebitsperpixelofBitMap;ifthisdoesnotequalone,BitMapisacolorbitmap.Inmultiple-bit-per-pixelbitmaps,thebitsthatrepresentapixelarestoredcontiguously.BITMAPCREATEwasextendedtocreatemultiple-bit-per-pixelbitmaps.(BITMAPCREATEWidthHeightBitsPerPixel)[Function] q?` p` q?` g_p`+o5q`X+o5,45 f frafnGJjeJjJje_x_x^^^B^B]]a6]66]66]] \#6] 66] 'vZ*t`i-Z*Xs`#Xw#6X66X66X66XWW6W66W Uu`X 1UqUU Q*' % +B-t1^37<=;@?B JJQ* N ) "N K &*C+0G2b49WBGDGiJKKD BQ{0  &)4-r358<> EJJBQ @@ +2P4q6;>AGjJJ1E / "n')-u1Q495; BK/ +8u$+8q+8|+8 '^ ]#*& *|.01v4N6V8<='?FBGHJJ'^ %+ ')" ,4.04N%+ !Q !Qv!Q)!Qq!QC Jj!Q wwp:wvw!Fwqw"#%)*+/m22wvw7wqw7\89=t?bBw  w#F&G),4 59<A JKK j ![%3058j  ((v% '=qC Jj q?`2XEROXLispLibraryPackagescreatesacolorbitmapthatisWidthpixelswidebyHeightpixelshighallowingBitsPerPixelbitsperpixel.CurrentlyanyvalueofBitsPerPixelexceptone,four,eight,orNIL(defaultstoone)causesanerror.Afour-bit-per-pixelcolorscreenbitmapusesapproximately76Kofstorage.Thereisonlyonesuchbitmap.Thefollowingfunctionprovidesaccesstoit.(COLORSCREENBITMAP)[Function]returnsthebitmapthatisbeingorwillbedisplayedonthecolordisplay.ThisisNILifthecolordisplayhasneverbeenturnedon(seeCOLORDISPLAYbelow).WHOLECOLORDISPLAY[Variable]isaglobalvariablesettoaREGIONthatcoverstheentirecolordisplayscreen.COLORSCREENWIDTH[Variable]andCOLORSCREENHEIGHT[Variable]areglobalvariableswhosevaluesarethedimensionsofthecolordisplay.COLORREPRESENTATIONSAcolormapmapsacolornumber([0...2nbits-1])intotheintensitiesofthethreecolorguns(primarycolorsred,green,andblue).Eachentryinthecolormaphaseightbitsforeachoftheprimarycolors,allowing256levelsperprimaryor224possiblecolors(notallofwhicharedistincttothehumaneye).WithinInterlisp-Dprograms,colorscanbemanipulatedasnumbers,red-green-bluetriples,names,orhue-lightness-saturationtriples.Anyfunctionthattakesacoloracceptsanyofthedifferentrepresentations.Ifanumberisgiven,itisthecolornumberusedintheoperation.Itmustbevalidforthecolorbitmapusedintheoperation.(Sincealloftheroutinesthatuseacolorneedtodetermineitsnumber,itisfastesttousenumbersforcolors.COLORNUMBERP,describedbelow,providesawaytotranslateintonumbersfromtheotherrepresentations.)Jj gq`X+o5,45 f frafnGJjeJjJje ^q`X{tk^v^"{^q^"&*L,1,1^v^0Y^q^047==^v^ EB^q^EHOJJ^ \SU\v\ %\q\%*-14695?@CHJJ\ ZkooZk V  -"%4( 146<;<@0ADGSJJV T^ R5%*`+-T^ PC JjP L,gR "%?'Q-/2v65;<?7@CgDG&JJL Jwbk # /3Jw FD> JjF B P|"X% ),038x===B >D> Jj> ; ; 75D> Jj75 3[ 9E!'#% -/1s593[ /u./q// * <=i"%)&'((*++**.14/ ;/<?CrGFJJ* ([^ F$`$(,Z.04K7:Q=@CFHfJJ( %Q"$)+,p%&-%%.k4#8;=e?CKEJJ% #  'I.369P BDrJJ# !{ Rf!91(56m9^?BEG&JJ!{ H!|#'wH n  aSA!'L*,n. 56?7;=@wBEHJJn ;( L!#%1'-$/237a:<CNE"JJ;  a:J %&2 29>DFI+JJ q0`#k.8 q?`W3XEROXLispLibraryPackagesRED-GREEN-BLUETRIPLESAred-green-blue(RGB)tripleisalistofthreenumbersbetween0and255.Thefirstelementgivestheintensityforred,thesecondforgreen,andthethirdforblue.WhenanRGBtripleisused,thecurrentcolormapissearchedtofindthecolorwiththecorrectintensities.Ifnoneisfound,anerrorisgenerated.(Thatis,noattemptismadebythesystemtoassigncolornumberstointensitiesautomatically.)AnexampleofanRGBtripleis(255255255),whichgivesthecolorwhite.RGB[Record]isarecordthatisdefinedas(REDGREENBLUE);itcanbeusedtomanipulateRGBtriples.COLORNAMES[Associationlist]mapsnamesintocolors.TheCDRofthecolorname'sentryisusedasthecolorcorrespondingtothecolorname.Thiscanbeanyoftheotherrepresentations.(Note:Itcanevenbeanothercolorname.Loopsinthenamespacesuchaswouldbecausedbyputting'(RED.CRIMSON)and'(CRIMSON.RED)onCOLORNAMESarenotcheckedforbythesystem.)Severalcolornamesareavailableintheinitialsystemandareintendedtoallowcolorprogramswrittenbydifferentuserstocoexist.Theseare:NameRGBNumberindefaultcolormapBLACK(000)0BLUE(00255)1GREEN(02550)2CYAN(0255255)3RED(25500)4MAGENTA(2550255)5YELLOW(2552550)6WHITE(255255255)7.8 gq`X+o5,45 f frafnGJjeJjJje ^u`X ^q^^^^ Z   (!Q#%%(.458;<>AGJJZ XI c"'),V/15k59;?gC DHfJJX V_!$'*.05 ==>BD8HJJV T^z i22$\%)+-24L86 >4AEJw F ? H$JjF Bj"3#&E).237~9[;?r I+JJB @x!7"%[)%3869w]F ">%(,v.36;?s@sHJJ>] <*G #&_&_<*v<*(n<*q<*(.025:;@'CH\JJ<* 9(\/ #r)l+.2q8=?EKI,JJ9 7/n7 3,238E;>3 0d,-k0 ,6d,-k,6 (\d ,-k(\ $d ,-k$  ,-k  ,-k ,-k ,-kR q?`4XEROXLispLibraryPackagesHUE-LIGHTNESS-SATURATIONTRIPLESAhue-lightness-saturationtripleisalistofthreenumbers.Thefirstnumber(HUE)isanintegerbetween0and355andindicatesapositionindegreesonacolorwheel(blueat0,redat120,andgreenat240).Thesecond(LIGHTNESS)isarealnumberbetweenzeroandonethatindicateshowmuchtotalintensityisinthecolor.Thethird(SATURATION)isarealnumberbetweenzeroandonethatindicateshowdisparatethethreeprimarylevelsare.HLS[Record]isarecorddefinedas(HUELIGHTNESSSATURATION);itisprovidedtomanipulateHLStriples.Example:thecolorblueisrepresentedinHLSnotationby(0.51.0).(COLORNUMBERPColorBitsPerPixelNOERRFLG)[Function]returnsthecolornumber(offsetintothescreencolormap)ofColor.Colorisoneofthefollowing:Apositivenumberlessthanthemaximumnumberofcolors,Acolorname,ANRGBtriple,orAnHLStriple.IfColorisoneoftheaboveandisfoundinthescreencolormap,itscolornumberinthescreencolormapisreturned.Ifnot,anerrorisgeneratedunlessNOERRFLGisnon-NIL,inwhichcaseNILisreturned.(RGBPX)[Function]returnsXifXisanRGBtriple;NILotherwise.(HLSPX)[Function]returnsXifXisanHLStriple;NILotherwise.COLORMAPSThescreencolormapholdstheinformationaboutwhatcolorisdisplayedonthecolorscreenforeachpixelvalueinthecolorscreenbitmap.Thevaluesinthecurrentscreencolormapmaybe-k gq`X+o5,45 f frafnGJjeJjJje ^u`X!'^q^JjJj^ Z  "V#%'+2258=BGCEJJZ Xcd!"H')W.02"59=?4@CJDHJJX V5 %'%(J+0U69E< >AGJJV T^?h"# %)e 35I69q>DHJJT^ R+R02 t"&s+/1R+ NQDJjNQ Jw bZP(&w 0239;c BF JKKJw HD$6 $:%(.Y0213G6HD Dj ..DjvDj #DjqDj#C JjDj @wm "%")-i022@v@6 @q@677@v@:@q@:BEHJJ q?`a5XEROXLispLibraryPackageschanged,andthischangeisreflectedinthecolorsdisplayedatthenextverticalretrace(approximately1/30ofasecond).Thecolormapcanbechangedtoobtaindramaticeffects.(COLORMAPCREATEIntensitiesBitsPerPixel)[Function]createsacolormapforascreenthathasBitsPerPixelbitsperpixel.IfBitsPerPixelisNIL,thenumberofbitsperpixelistakenfromthecurrentcolordisplaysetting.Intensitiesspecifiestheinitialcolorsthatshouldbeinthemap.IfIntensitiesisnotNIL,itshouldbealistofcolorspecificationsotherthancolornumbers,e.g.,thelistofRGBtriplesreturnedbythefunctionINTENSITIESFROMCOLORMAP.IfIntensitiesisNIL,thevalueofthevariable\DEFAULTCOLORINTENSITIESisusedifBitsPerPixelisfour;thevalueofthevariable\DEFAULT8BITCOLORINTENSITIESifBitsPerPixeliseight.(COLORMAPPColorMap?BitsPerPixel)[Function]returnsColorMap?ifitisacolormapthathasBitsPerPixelbitsperpixel;NILotherwise.IfBitsPerPixelisNIL,itreturnsColorMap?ifitiseithera4bpporan8bppcolormap.(INTENSITIESFROMCOLORMAPColorMap)[Function]returnsalistoftheintensitylevelsofColorMap(defaultis(SCREENCOLORMAP))inaformacceptedbyCOLORMAPCREATE.Thislistcanbewrittenonfileandthusprovidesawayofsavingcolormapspecifications.(COLORMAPCOPYColorMapBitsPerPixel)[Function]returnsacolormapthatcontainsthesamecolorintensitiesasColorMapifColorMapisacolormap.Otherwise,itreturnsacolormapwithdefaultcolorvalues.(SCREENCOLORMAPNewColorMap)[Function]readsandsetsthecolormapthatisusedbythecolordisplay.IfNewColorMapisnon-NIL,itshouldbeacolormap,andSCREENCOLORMAPsetsthesystemcolormaptobethatcolormap.ThevaluereturnedisthevalueofthescreencolormapbeforeSCREENCOLORMAPwascalled.IfNewColorMapisNIL,thecurrentscreencolormapisreturnedwithoutchange.(MAPOFACOLORPrimaries)[Function]J gq`X+o5,45 f frafnGJjeJjJje ^q`Xm y&)+079<@[EJJ^ \ Z\y!Y$#'*-/v5a6;LA6F6FF\ XXvX (OXqXC JjX T5 _!$''TvT /mTqT0259:;x;xTvT CTqTCE@HfJJT RFe!s$'y,0t5w:;:;:RvR ARqRB?HgJJR PU{| #`'7')s)sPvP /PqP02_5$8l9>A5BE3G&JJP NQ  '?*-c/15:!@EByE.JJNQ L#%$''LvL .LqL/2:6c9>AEfJJL I!*#N')c)cIvI 0IqI24<8M;l?BFEeJJI G#\$y$yGvG ,GqG,i-11G C ::CvCo $CqCC JjC @@v@@q@st8"&2)],_,_@v@ 3@q@47:>A HIJJ@ =v +=q==v=$=q=%& '=(,-.13K596V9!<?= 9 9v9'9q9C Jj9 6_$ &&6v6,@6q6,24XDEGJJ6 3!"K%Z'*8,(0257:@ADFJJJ3 1.Ep1 - ;;-v- &d-q-C Jj- *!$8(+ 248*v*48;l*q*;=+=+*v*A#C*q*D_EG&JJ* ' 5R6S $&+/L3' ##v# "#q#C Jj# |=)$=!"i%'*-23>4h4h v  =j q =?&DFJJ   o^ '{*-259#:=?CGpGJJ 2"1'*.I2 A(D;IIJJ v qM7 %7(+-I38=<  **v,qC Jj q?`/6XEROXLispLibraryPackagesreturnsacolormapthatisdifferentshadesofoneormoreoftheprimarycolors.Forexample,(MAPOFACOLOR'(REDGREENBLUE))givesacolormapofdifferentshadesofgray;(MAPOFACOLOR'RED)givesdifferentshadesofred.HOWTOCHANGECOLORMAPSThefollowingfunctionsareprovidedtoaccessandchangetheintensitylevelsinacolormap.(SETCOLORINTENSITYColorMapColorNumberColorSpec)[Function]setstheprimaryintensitiesofcolornumberColorNumberinthecolormapColorMaptotheonesspecifiedbyColorSpec.ColorSpeccanbeeitheranRGBtriple,anHLStriple,oracolorname.ThevaluereturnedisNIL.(COLORLEVELColorMapColorNumberPrimaryColorNewLevel)[Function]setsandreadstheintensityleveloftheprimarycolorPrimaryColor(RED,GREEN,orBLUE)forthecolornumberColorNumberinthecolormapColorMap.IfNewLevelisanumberbetween0and255,itisset.ThepreviousvalueoftheintensityofPrimaryColorisreturned.(ADJUSTCOLORMAPPrimaryDeltaColorMap)[Function]addsDeltatotheintensityofthePrimarycolorvalue(RED,GREEN,orBLUE)foreverycolornumberinColorMap.(ROTATECOLORMAPColorMapStartColorThruColor)[Function]rotatesasequenceofcolorsinColorMap.TherotationmovestheintensityvaluesofcolornumberStartColorintocolornumberStartColor+1,theintensityvaluesofcolornumberStartColor+1intocolornumberStartColor+2,etc.,andThruColor'svaluesintoStartColor.(EDITCOLORMAPVarNoQFlg)[Function]allowsinteractiveeditingofaCOLORMAPP.IfVarisanatomwhosevalueisaCOLORMAPP,itsvalueisedited.Otherwiseanewcolormapiscreatedandedited.Thecolormapbeingeditedismadethescreencolormapwhiletheeditingtakesplacesothatitseffectscanbeobserved.Theeditedcolormapisreturnedasthevalue.IfNoQFlgisNILandthecolordisplayison,youareaskedifyouwantatestpatternofcolors.AyesresponsecausesthefunctionSHOWCOLORTESTPATTERNtobecalled,whichdisplaysatestpatternwithblocksofeachofthepossiblecolors.Jj gq`X+o5,45 f frafnGJjeJjJje ^q`X #p(*M-=/247<<AsADJJ^ \ "(A,.x268?ODG=JJ\ Zk *;$)l+-~Zk VuzK"VqV"u""V R]v# $)n,-1G39K==>?CvFR N//NvN! *1hNqNC JjN K!l W"(2(2KvK 0KqK1C25h9(?C\GGJJH FNx F B BvB8 %% -4BqBC JjB >SE` "O$)-->v> 5>q>6P:l@ AFBHgJJ> <XAEJJ( &v &q&~LDD&v& $&q&'*!/4U59>>&v& Ev&q&HJJ& $.kk$v$ $q$ ##$v$ +$q$+w/22$v$ 9$$q$9$ uu v  q C Jj  " ()*N*Nv,sq,.i0v48<> ?E HJJ k% C!V%(B)/ 167#: =@DIaJJ h!v#(,0w2l5P79;>@GGJJh 5$ #='()p)p5v5.>5q5.0Z368<_A`BEH[JJ5 = +%(}./[14<"AE.JJ  "']+12K59<AC6FHfJJ 3 q?`7XEROXLispLibraryPackagesYouarepromptedforthelocationofacolorcontrolwindowtobeplacedontheblack-and-whitedisplay.Thiswindowallowsthevalueofanyofthecolorstobechanged.Thenumberofthecolorbeingeditedisintheupper-leftpartofthewindow.Sixbarsaredisplayed.Therightthreebarsgivethecolorintensitiesforthethreeprimarycolorsofthecurrentcolornumber.Theleftthreebarsgivethevalueofthecolor'sHue,Lightness,andSaturationparameters.Theselevelscanbechangedbypositioningthemousecursorinoneofthebarsandpressingtheleftmousebutton.Whiletheleftbuttonisdown,thevalueofthatparametertrackstheYpositionofthecursor.Whentheleftbuttonisreleased,thecolortrackingstops.Thecolorbeingeditedischangedbypressingthemiddlemousebuttonwhilethecursorisintheinterioroftheeditwindow.Thisbringsupamenuofcolornumbers.Selectingonesetsthecurrentcolortotheselectedcolor.Thecolorbeingeditedcanalsobechangedbyselectingthemenuitem"PickPt."Thisswitchesthecursorontothecolorscreenandallowsyoutoselectapointfromthecolorscreen.Ittheneditsthecoloroftheselectedpoint.Tostoptheediting,movethecursorintothetitleoftheeditingwindowandpressthemiddlebutton.Thisbringsupamenu.SelectStoptoquit.HOWTOTURNCOLORDISPLAYONANDOFFThecolordisplaycanbeturnedonandoff.Whilethecolordisplayison,thememoryusedforthecolordisplayscreenbitmapislockeddown,andasmallamountofprocessingtimeisusedtodrivethecolordisplay.(COLORDISPLAYP)[Function]returnsthecurrentcolormapifthecolordisplayison;otherwiseitreturnsNIL.(COLORDISPLAYColorMapIfOnBitsPerPixelClearScreenFlg)[Function]turnsoffthecolordisplayifColorMapIfOnisNIL.IfColorMapIfOnisnon-NIL,itturnsonthecolordisplayallocatingBitsPerPixelbitsperpixel.IfColorMapIfOnisoftypeCOLORMAPPor8BITCOLORMAP,itisusedasthescreencolormap.IfClearScreenFlgisnon-NIL,allofthebitsinthecolorscreenaresettozero.Returnsthepreviouscolormap,ifany.Turningonthecolordisplayrequiresallocatingandlockingdownthememorynecessarytoholdthecolordisplayscreenbitmapandthesystemcolormap.Turningoffthecolordisplayfreesthismemory.HOWTOUSECOLOR gq`X+o5,45 f frafnGJjeJjJje ^q`X*"#% (-346;=@AJJ^ \0H K$%(X),^02T4L:;=C!DG&JJ\ Zk 7 _#c%'-V-0H36 ==@oCGJJZk X86 , $}).A027;jA2ADGJJX8 V_8e!0$ +.| 5 =AFHJJV S :"'#(+-x/3J63<)>A(EJKKS QG4t $&B)/4E66QvQ7QqQ7=i? AqFUFJJQ Ol [O"(3,k,/3U7L;=C DJJOl M9S ("'Z(*-%28369k?0?BG{IJJM9 K{S!$^'H).2736(;?K G,AM "(*137:A5ADJJG, D g D#'Z*+/04g7:=BC D3G_JJD B z,B >  F"%'*,.z3)8^;>APEJKK> <X"O#''< 8uz5"% (+z8q8+,*,*8 5m K"U%$'(+.f268a:=8BF<HfJJ5 23-#(*+/46[ =@B8EGGJJ2 0 0 ,C Jj, (wf}!%*_+.45:=3( % 33%v% x (h 2B%q%C Jj% !7=PdCoo!7v!7 &&!7q!7(3+,++-3-3!7v!7 6 !7q!767=?BDG&JJ!7  v q #&+,--v 6q79;?TIJJ  @kU0!&R)--//v 8q9]:@BD,FI@JJ  5k G%'-1e458  -od$ *-269R>EGJJ  HG o#?%*.+1279<?DH#JJ ^^ uzquLL q?`8XEROXLispLibraryPackagesThecurrentcolorimplementationallowsdisplaystreamstooperateoncolorbitmaps.ThetwofunctionsDSPCOLORandDSPBACKCOLORsetthecolorinwhichastreamprintsordraws.(DSPCOLORColorStream)[Function]setstheforegroundcolorofastream.Itreturnsthepreviousforegroundcolor.IfColorisNIL,itreturnsthecurrentforegroundcolorwithoutchanginganything.Thedefaultforegroundcolorisseven,whichiswhiteinthedefaultcolormap.(DSPBACKCOLORColorStream)[Function]setsthebackgroundcolorofastream.Itreturnsthepreviousbackgroundcolor.IfColorisNIL,itreturnsthecurrentbackgroundcolorwithoutchanginganything.Thedefaultbackgroundcoloriszero,whichisblackinthedefaultcolormap.TheBITBLT,line-drawingroutines,curve-drawingroutines,andprintingroutinesknowhowtooperateonacolor-capablestream.Followingaresomenotesaboutthem.HOWTOBITBLTIfBLTingfromacolorbitmapontoanothercolorbitmapofthesamebpp,theoperationsPAINT,INVERT,andERASEaredoneonabitlevel,notonapixellevel.Thuspaintingcolor3ontocolor10resultsincolor11.IfBLTingfromablack-and-whitebitmapontoacolorbitmap,theonebitsappearintheDSPCOLOR,andthezerobitsinDSPBACKCOLOR.Currently,REPLACEistheonlyoperationthatsupportsBLTingfromblack-and-whitetocolor.Thisoperationisfairlyexpensive;ifthesamebitmapisgoingtobeputupseveraltimesinthesamecolor,itisfastertocreateacolorcopythenBLTthecolorcopy.IfthesourcetypeisTEXTUREandthedestinationbitmapisacolorbitmap,theTextureargumentistakentobeacolor.ThustofillanareawiththecolorBLUEassumingCOLORSTRisastreamwhosedestinationisthecolorscreen,use(BITBLTNILNILNILCOLORSTR5075100200'TEXTURE'REPLACE'BLUE).HOWTODRAWCURVESANDLINESForthefunctionDRAWCIRCLE,DRAWELLIPSE,andDRAWCURVE,thenotionofabrushhasbeenextendedtoincludeacolor.ABRUSHisnow(BRUSHSHAPEBRUSHSIZEBRUSHCOLOR).Also,thebrushcanbeabitmap(whichcanbeacolorbitmap).L g-u`X+o5q,45 f frafnGJjeJjJje ^q`X !&b+d028':S>!@ADE'H#JJ^ \ (*-0266U7r<@AE\ XXvXXqXXvXXqXC JjX T j ]$%&J+N-3 ;M?i?A)A)TvTDTqTEFIJJT R"D #(/L56-9= EIaJJR P`v",%(P L LvLgLqLLvL TLqL!%CC JjL H Ir$$%S&+v-3 ;?@2AfAfHvHDHqHECFIJJH F #(/A558= EIaJJF Dj6[7 $'Dj @  #I -3S6c;AEI+JJ@ >] ""l(+O/26:}>] :uz:q:^: 6 =t*2c"(+-125*8 EJJ6 4vf;Il!|"$(m*,.-15V59`>BCG&JJ4v 2C u (2C .i +@"%(,M-14E8.:>)A8FuHfJJ.i ,6 7a ,-< 3:<>xAGJJ,6 *$&~*+.L46b9 A5BvDHJJ* '  $&(^,013268*S,04;5CZDFJJ ]/ 7v$'k-0-0Y03367'?Q?ABPDVDGHJJ] *.h* Puz $PqP%'%%P vu  *-b 79t=?u@DG=JJv C:$&4)E 3; FG<JJC  !H#%'*,0) q?`F9XEROXLispLibraryPackagesTheline-drawingroutineshavebeenextendedtotakeanotherargument,whichisthecolorthelineistoappearinifthedestinationofthedisplaystreamisacolorbitmap.(DRAWLINEX1Y1X2Y2WidthOperationStreamColor)(DRAWTOXYWidthOperationStreamColor)(RELDRAWTOXYWidthOperationStreamColor)(DRAWBETWEENPOS1POS2WidthOperationStreamColor)IftheColorargumentisNIL,theDSPCOLORofthestreamisused.HOWTOPRINTTOTHECOLORSCREENPrintingonlyworksinREPLACEmode.ThecharactershaveabackgroundofDSPBACKCOLORandaforegroundcolorofDSPCOLOR.Thefirsttimeacharacterisprintedinanewcolor,thecolorimagescorrespondingtothecurrentfontarecalculatedandcached.Thusthefirstcharactermaytakeawhiletoappear,butsucceedingcharactersprintquickly.Exampleofprintingtothecolorscreen:(COLORDISPLAYT4);turnthedisplayonin4bppmode.(SETQFOO(DSPCREATE(COLORSCREENBITMAP));createastreamwhosedestinationisthecolorscreen(DSPCOLOR'REDFOO)(PRINT'HELLOFOO);willprintinred.HOWTOMOVETHECURSORONTHECOLORSCREENThecursorcanbemovedtothecolorscreen.Whileonthecolorscreen,thecursorisplacedusingXORmode;thuswithsomecolormapsitmaybehardtosee.Itisautomaticallytakendownwheneveranoperationisperformedthatchangesanybitsonthecolorscreen.Whilethecursorisonthecolorscreen,theblack-and-whitecursoriscleared.(CHANGECURSORSCREENScreenBitMap)[Function]movesthecursorontothespecifiedscreen.ScreenBitMapmustbethevalueofeither(COLORSCREENBITMAP)or(SCREENBITMAP).ThevaluereturnedisthescreenbitmapthatthecursorwasonbeforeCHANGECURSORSCREENwascalled.0) gq`X+o5,45 f frafnGJjeJjJje ^q`Xc +#)f+.3]:5>Z?B!EH#JJ^ \ VO !E#(o-.{/335!8B\ XXvX&h+U.XqX/HX TTvT$(TqT(T Q ::QvQx"d'Q*QqQ+DQ M6 M6vM6^PB#*H/52M6qM63(M6 I\ I\vI\I\qI\W( )+025I\ Euz!''EqE(JjJjE A 1v!%v%( 0/34 =%> JJA ?u M%&E)B,3/q07k8> ?AD7HfJJ?u =B3 h!&), 35;=;?&ADJJJ=B ;U '9 .`167676; 75g:+$|75 3[ 3g4F57:F?ABCFxJj3[ 1(n -1( .( (- .=27` >@ B{FJj. ,#, *@@C*FmGJj* &uz]{ !"%+D1&q&1k11& "` #()-/1a4:#>ByDIaJJu B %m)+D0gB hhvh &hqhC Jjh v&'*v+, 5q6:=I@?DFJJ [^*+H+.w298 9q;@BzEHfJJ[ ( N+-2( q?`10XEROXLispLibraryPackagesMISCELLANEOUSCOLORFUNCTIONSThefollowingfunctionsprovidesomecommonoperationsoncolorbitmapsanddisplaystreams.(COLORFILLRegionColorNumberStreamOperation)[Function]fillsaregioninthecolorbitmapwithacolor.(COLORFILLAREALeftBottomWidthHeightColorNumberStreamOperation)[Function]fillsanareainthecolorbitmapwithacolor.(COLORIZEBITMAPBitMap0Color1ColorNBits)[Function]createsacolorbitmapfromabitmap.Thereturnedbitmaphascolornumber1ColorinthosepixelsofBitMapthatwereoneand0ColorinthosepixelsofBitMapthatwerezero.Thisprovidesawayofproducingacolorbitmapfromablack-and-whitebitmap.DEMONSTRATIONPROGRAMSTheseareonfileonCOLORDEMO.DCOM.(COLORDEMO)[Function]bringsupamenuofcolordemonstrationprograms.Thesystemcyclesthroughtheentriesonthemenuautomatically,allowingeachtorunforasmall,fixedamountoftime(typically40seconds).Selectingoneoftheentriesinthemenucausesittostartthatprogram.(COLORDEMO1)[Function]runstheInterlisp-Dlogodemonstrationuntilabuttonispressed,thenaddscolorkinetic.Themiddlemousebuttonbringsupamenuthatallowschangingthespeedofrotationoreditingthecolormap.Theleftbuttonrotatesthecolormapinthekineticarea.(COLORDEMO2Size)[Function]putsupatestpatternofsizeSize,thenrotatesthecolormap.ThespeedofrotationofthecolormapisdeterminedbytheYpositionofthecursor.Themiddlebuttonbringsupamenuthatallowseditingofthecolormaporchangingthecolormaptoamapofdifferentshadesofonecolor.(COLORKINETICRegionFirstColorLastColor)[Function]2( gq`X+ 5,5 f frafnGJjeJjJje ^u`X _&z^q^&'*'*^ Z]v#)~ 02628 ;>CuHZ W ))WvWWqWWvW !WqW!!WvW&-6WqW.C JjW SC-u # $('SC Oi OivOi#(. 16 &4--0h5@9?'AFXHgJJ0 - "I$&(*.J17"8< B-D1JKK- +4;!$)*,/2}8H+ ' C Jj' # 7 &)\*/w17):>LB+G[GJJ# !V: ^!%(-+36*:&++.3O78+<>?CFkJJ s@1"%:(+-.13L8=?mB,Es  v "/(\qC Jj q?`11XEROXLispLibraryPackagesrunsacolorversionofthestandardKineticdemoonacolordisplayusingcolorsFirstColorthroughLastColor.(TUNNELSpeed)[Function]drawsaseriesofconcentricrectanglesofincreasingsizeinincreasingcolornumbers.Speeddeterminesthesizeoftherectangles.Thiscanthenbe"run"bycallingROTATEIT,whichisdescribedbelow.(MINESHAFTNOutFlg)[Function]drawsaseriesofconcentricrectanglesofsizeNinincreasingcolornumbers.OutFlgdetermineswhetherthecolornumbersincreaseordecrease.Thiscanthenbe"run"bycallingROTATEIT,whichisdescribedbelow.(WELLN)[Function]drawsaseriesofconcentriccirclesonthecolorscreeninincreasingcolornumbers.ThecirclesareofsizeN.Thiscanthenbe"run"bycallingROTATEIT,whichisdescribedbelow.(SHOWCOLORTESTPATTERNBarSize)[Function]displaysapatternofcolorsonthecolordisplay.Thisisusefulwheneditingacolormap.Thepatternhassquaresofthe16possiblecolorslaidoutintworowsatthetopofthescreen.Colors0through7areinthetoprow,andcolors8through15areinthenextrow.ThebottompartofthescreenisfilledwithbarsofBarSizewidthwithconsecutivecolornumbers.Thepatternisdesignedsothateverycolorhasaborderwitheveryothercolor(unlessBarSizeistoolargetoallowroomforeverycolor--about20).(ROTATEITBeginColorEndColorWait)[Function]goesintoaninfinitelooprotatingthescreencolormap.ThecolorsbetweenBeginColor(defaultzero)andEndColor(defaultmaximumcolor)arerotated.IfWaitisgiven,(DISMISSWait)iscalledeachtimethecolormapischanged.Thisprovidesaneasywayof"animating"screenimages.(COLORPOLYDEMOColorStream)[Function]isonthefileCOLORPOLYGONS.DCOM.ItrunsaversionofthePolygonsprogramonthecolorscreen.12XEROXLispLibraryPackagesJj gq`X+ 5,5 f frafnGJjeJjJje ^q`Xw"p"p^v^&^q^'5+ -.=16:>>^v^ E ^q^EdJJ^ \v{\q\{\ XXvXXqXC JjX TX  &6( /H2\4 ;Y?3EFWFWTvTJiTqTJJT R G %:%)/,+/16%8G=DIbJJR P9bP L SSLvLLqLC JjL H E 7 %W'))HvH*HqH+d, 47>4>>HvHBHqHCV JJH F;#%m,0,/26!8;rC)JJF DjDj @66@v@2@q@C Jj@ <O G"%'~+6/1 8?CGkGJJ2 0~%5$-(+(-/"15769.;==?DEIJJ0 .i Ec\!j%' ,.1258E;x;>CFHfJJ.i ,6HG,6v,6!,6q,6"5&) 14; ;n>AC,DJJ,6 * p<Fg "&*{.3 3 *v*7*q*8W9<&?ASDHJJ* 'Y>;' #BB#v# m#q##v# #q#!!#v###q#C Jj# %#!$ (,04038 == v  E q EJJ  Evq$W(*0X022v4q5;6:AuAuvD=qE$FJJ  q #"#(&5,-1145 =BmG[  --v !<qC JjJj  B,&Y&(.+,136868v<q<B~DG'JJ I+ 5,5 f frafnGJjeJjJje ^q`X ^+ q?`r HELVETICA  HELVETICA  HELVETICA  HELVETICA XLOGO  HELVETICA ~GACHA3# , s5E=DKwSj/V T|l!,{ERIS}INTERMEZZO>LIBRARY>COLOR.PRESS;1JAMES 4-Apr-85 14:22:33