1INTERLISP-DRELEASENOTESAppendixAImplementingDevice-IndependentGraphicsThroughImageStreamsTheInterlisp-Dsystemdoesallimagecreationthroughasetoffunctionsanddatastructuresfordevice-independentgraphics,knownpopularlyasDIG.DIGisachievedthroughtheuseofaspecialflavorofstream,knownasanimagestream.Animagestream,byconvention,isanystreamthathasitsIMAGEOPSfield(describedindetailbelow)settoavectorofmeaningfulgraphicaloperations.Usingimagestreams,youcanwriteprogramsthatdrawandprintonanoutputstreamwithoutregardtotheunderlyingdevice,beitawindow,adisk,oraDover,8044,orDiabloprinter.Forexample,thefollowingdevicesaresupportedbyimagestreams:windows,Pressstreams,Interpressstreams,andIrisstreams.ImageStreamStructureAsindicatedabove,imagestreamsuseafieldthatnootherstreamuses:IMAGEOPS.IMAGEOPSisaninstanceoftheIMAGEOPSdatatypeandcontainsavectorofthestream'sgraphicalmethods.ThemethodscontainedintheIMAGEOPScanmakearbitraryuseofthestream'sIMAGEDATAfield,whichisprovidedfortheiruse,andmaycontainanydataneeded.TheIMAGEOPSdatatypehasthefollowingfields:IMAGETYPEisthenameofanimagetype.MonochromedisplaystreamshaveanIMAGETYPEofDISPLAY;colordisplaystreamsareidentifiedas(COLORDISPLAY).TheIMAGETYPEisinformationalandcanbesettoanythingyouchoose.IMFONTCREATEisthedevicenametopasstoFONTCREATEwhenfontsarecreatedforthestream.Thefollowingfieldsareallstreammethods,andarepresentedwiththeirargumentsinthemannerofafunctiondefinition.WiththeexceptionofIMCLOSEFN,eachmethodhasacorrespondingfunctionthatconsistsofthemethod'snamewiththe"IM"prefixremoved.Allcoordinatesthatrefertopointsinadisplaydevice'sspacearemeasuredinthedevice'sunits.(TheIMSCALEmethodprovidesaccesstoadevice'sscale.)(IMCLOSEFNStream)[Streammethod]isusedbeforeastreamisCLOSEFed,e.g.,toflushbuffers,writeheaderortrailerinformation,etc.(IMDRAWLINEStreamX1Y1X2Y2WidthOperationColor)[Streammethod]drawsalineofwidthWidthfrom(X1,Y1)to(X2,Y2).(Dashingiscurrentlyhandledatahigherlevel,andthusisnotanargument.) q?` p` q?` g_p`LGq`FLGLq"r`#qEt#L"LL"q`F"L"qr`#q`F 2r`#!hs`>JLh!ft`#!fP*LfLLfqe u`{qe *+cv`X*+cq[t`#q[EtGL[LL[w`X[L[qYx`{ *J3<C;KYqXt`#qXEt#LXLLX#V w`X& -26785<B^GI;KMCeH7Mz`i >q=r`#q=Et#L=LL=#;"w`X%,16/;>@CG)IM\@5BHJM@?IBKM=M=*#( ,C/1357s=I?E(#& / 03V8"AC M=M=&#$'U*-?2m46;$#"d&,035:q@CFM 7 :?BkC M=M=#r);,13}5 >bAHM11 2y 24 2w 258m8 2y 2;Y= 2w 2=?? 2y 2BrD 2w 2E]EKMPwP?`P#M --MyM2dM*+K/579>KwKBCGLK#I(W*.26!;;IyI@bIwIAXFGTIyIM=M=I#G(GwG)G#D -@-@DyD2p7]AXAXD*+CL6X:U>EECL*+A 3AwABCGLA#?.%)S 38X:ABB?.y?.L?.w?.M=y=? JJ=w=M=M==#;*,,;y;1%;w;27;8;{ABHJM=M=;#:<).19o:<#75**75y75 4 ;} E II75*+54&@SDPHH5*+4) 208> H3HH4)*+2 36E9H2w2LL2*+0/40#.e), 7<->`DE|E|.ey.e L.ew.eMg>g,y,L,w,M=M=,#+y'3+w+(,,+y+0.+w+134G;=BB+y+L+w+M 679ABBELMHDFKM[w[?;AA[y[E[w[GSKpLMAyD$H7M&x&x>y>+ >w>,w/K022>y>6>w>6>#; ..;y;3 :;w;BCGL;#9k&&9ky9k+S9kw9k-/46889ky9k ?9kw9k@A-D=FKMcA 7#4 //4y44 C2 JM=M=0#.(.3449 :)=?.#+ ,,+y+14+w+BCGL+#)w&&)wy)w+)ww)w,/<2i84>x@C IM+CFHMw?(# 1 y 1m6Z<\ w BCGL # 5&& 5y 5+G 5w 5,1699 5y 5: 5w 5@FGJM=M= 5# (-.157I9797 y ?9 w ?  q?`84INTERLISP-DRELEASENOTESAPPENDIXA(IMSPACEFACTORStreamFactor)[Streammethod]setstheamountbywhichtomultiplythenaturalwidthofallfollowingspacecharactersonStream;isusedforjustificationoftext.Thedefaultvalueisone.Forexample,ifthenaturalwidthofaspaceinStream'scurrentfontis12units,andthespacefactorissettotwo,spacesappear24unitswide.ThevaluesreturnedbySTRINGWIDTHandCHARWIDTHarealsoaffected.(IMOPERATIONStreamOperation)[Streammethod]setsthedefaultBITBLTOperationargument.SeetheDSPOPERATIONandBITBLTdocumentationformoreinformation.(IMBACKCOLORStreamColor)[Streammethod]setsthebackgroundcolorofStream.(IMCOLORStreamColor)[Streammethod]setsthedefaultcolorofStream.InadditiontotheIMAGEOPS-bornemethodsdescribedabove,therearetwootherimportantmethods,whicharecontainedinthestreamitself.STRMBOUTFN[Streammethod]isafunctioncalledbyBOUT.YoucaninstallaSTRMBOUTFNinastreamStreamusingtheform(replace(STREAMSTRMBOUTFN)ofSTREAMwith(FUNCTIONMYBOUTFN)).OUTCHARFN[Streammethod]isthefunctionthatiscalledtooutputasinglebyte.ThisislikeSTRMBOUTFN,exceptforbeingonelevelhigher:itisintendedfortextoutput.Hence,thisfunctionshouldconvert(CHARCODEEOL)intothestream'sactualend-of-linesequenceandshouldadjustthestream'sCHARPOSITIONappropriatelybeforeinvokingthestream'sSTRMBOUTFN(bycallingBOUT)toactuallyputthecharacter.Defaultsto\FILEOUTCHARFN,whichisdefinitelynotwhatyouwant.OUTCHARFNsareinstalledusingaformlike(replace(STREAMOUTCHARFN)ofSTREAMwith(FUNCTIONMYOUTCHARFN)).IMAGEDATA[Recordfield]isusedtoholddatapertainingtothistypeofimagestream;thecontentiscompletelyuptoyou.ForInterpressdevices,thisisaninstanceofthedatatypeINTERPRESSDATA;forPress,PRESSDATA;forthedisplay,\DISPLAYDATA.CreatingImageStreams(OPENIMAGESTREAMFileImageTypeOptions)[Function]opensandreturnsanoutputstreamoftypeImageType(PRESS,INTERPRESS,DISPLAY,orothertypes)onadestinationspecifiedbyFile.Filecannameafileeitheronanormalstoragedeviceoronaprinterdevice.Inthelattercase,thefileissentto? gw`Xqq`Fq"r`#qEt#L"LMM"<q`F CILr`#Lqiq`F < iqhr`#qhEt#LhLLh#dw`X /dyd055"93dwdBCGLd#b &)/1P57=l@'ESIzKoM,AC KMEG)JM=M=Ta#R 0,4N: F$IMEHM=M=- #+g(,C3 > HM=M=+g#))-3o >A FHKM A qz`iEqr`#qvEt#LLL#w`X2p2py5BmDGHKM?QEGJhM=M=d#b*26/ >M=M=b#aN)+L 36A<CE MEL M=M=Y#X< ,_158;f>y GM@CG}JM/DGKHKBM^>CEJRMy*>w>*>#<4*{1U357 ?D_FGIUM-0B29P;<ACGH"KMoC##!@y(!@w!@(*P+t-/)47;>^A[CQFHdMAD JM 479=!?E EJM @ M=M=#6/J~M=M=#< /<#(-c12357\:=@FGGIM6:T ADGMa GzIM0i5Z7 @EIM=MM]s#[) 3 =@ M=M=[#Z'**-1U46<>>V@ J1MDHMnJk#Hw`X& ,!.; 5Y7;>@H#E{` ,E#D'%5 /I :4D'#B%5 /IAB#A1%52FA1#>w`X&X 0J57=;e>[@ G>#; //;y;2;w;2X2X;y;7S;w;7;#9Ky%9Kw9K&Z'*,134s7<>qM@j G1#. /z/z.y./4H7S:@sD.w.E?.#,^y',^w,^()+04608;? EFTFT,^y,^I,^w,^IpJMGQJ(MC KMkEIM EIM@CW JZ#S2g22SyS75:@=C`GSwSH,S#&,125/68<BEHdHdyLwMAHCGKNMCD2GMB GJGM=M= # /(-b0 24r:=BE K / q?`7INTERLISP-DRELEASENOTESAPPENDIXAImageStreamPredicates(IMAGESTREAMPXImageType)[Function]returnsX(possiblycoercedtoastream)ifitisanoutputimagestreamoftypeImageType(orofanytypeifImageTypeisNIL),otherwiseNIL.(IMAGESTREAMTYPEStream)[Function]returnstheimagetypeofStream.(IMAGESTREAMTYPEPStreamType)[Function]returnsTifStreamisanimagestreamoftypeType.CreatingYourOwnFlavorofImageStreamIndescribingataskascomplexasbuildinganewflavorofimagestream,nodocumentcancontainalloftheanswers,tricks,andshortcuts.Thereisnosubstituteforstudyingaworkingimplementationindoingyourown.Therefore,werecommendyoulookattheFX80STREAMpackageasanexampleofhowtocreateanewimagingdevice.FX80STREAMisaDIGinterfacefortheEpsonFX-80printeradevicesimpleenoughtodrivethatitsdetailsdonotobscurethefundamentalsofhowitsimagestreamworks.K / gw`XLGq`FLq"r`#qEt#L"LL"q`F"L"qr`#q`F 2r`#FXiq`FL#Lir`#iLiqhqhEt#LhLLhqd~z`i   d~qcir`#qcXEt#LciLLci#`w`X /{/{`y`07`w`FT L`#^L((^Ly^L)^Lw^L*0/578>=?@BRDiIM@FHKM%(,j0~4>v>6>w>71;@,E`FJtM#=%*,/58B ACFI M=M==#;k(:,c;k q?` ~GACHA  ~GACHA   HELVETICA   HELVETICA  HELVETICA HELVETICA  TIMESROMAN  TIMESROMAN HELVETICA HELVETICA HELVETICA HELVETICA~GACHA C  e b$ 7. Y7</j/?=e&{ERIS}INTERMEZZO>DOC>DIG.PRESS;1SANNELLA18-Mar-85 13:23:13