home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / pc / technical documentation / develop / develop issue 24 / develop issue 24 code / printing compressed images.sea / Printing Compressed Images / JPEG Print with Dataload / PrintJPEG with dataload.c < prev    next >
MacBinary  |  1995-08-19  |  34.9 KB  |  [TEXT/MPCC]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Sat Aug 19 12:47:45 1995, modified Sat Aug 19 12:47:45 1995, creator 'MPCC', type ASCII, 35042 bytes "PrintJPEG with dataload.c" , at 0x8962 410 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPCC]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 19 50 72 69 6e 74 4a | 50 45 47 20 77 69 74 68 |..PrintJ|PEG with|
|00000010| 20 64 61 74 61 6c 6f 61 | 64 2e 63 00 00 00 00 00 | dataloa|d.c.....|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 43 | 43 01 00 00 00 00 00 00 |.TEXTMPC|C.......|
|00000050| 00 00 00 00 00 88 e2 00 | 00 01 9a ac 5b c6 31 ac |........|....[.1.|
|00000060| 5b c6 31 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |[.1.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 0c 36 00 00 |........|.....6..|
|00000080| 2f 2a 0d 20 2a 20 50 72 | 69 6e 74 4a 50 45 47 2e |/*. * Pr|intJPEG.|
|00000090| 63 0d 0d 09 41 75 74 68 | 6f 72 65 64 20 62 79 3a |c...Auth|ored by:|
|000000a0| 20 44 61 76 69 64 20 47 | 65 6c 70 68 6d 61 6e 20 | David G|elphman |
|000000b0| 36 2f 39 2f 39 35 2e 20 | 42 6f 72 72 6f 77 65 64 |6/9/95. |Borrowed|
|000000c0| 20 6c 69 62 65 72 61 6c | 6c 79 20 66 72 6f 6d 20 | liberal|ly from |
|000000d0| 74 68 65 20 4a 46 49 46 | 2d 50 49 43 54 0d 09 63 |the JFIF|-PICT..c|
|000000e0| 6f 6e 76 65 72 73 69 6f | 6e 20 70 72 6f 67 72 61 |onversio|n progra|
|000000f0| 6d 20 70 72 6f 76 69 64 | 65 64 20 61 73 20 61 20 |m provid|ed as a |
|00000100| 73 61 6d 70 6c 65 20 70 | 72 6f 67 72 61 6d 20 69 |sample p|rogram i|
|00000110| 6e 20 74 68 65 20 51 75 | 69 63 6b 54 69 6d 65 20 |n the Qu|ickTime |
|00000120| 64 65 76 65 6c 6f 70 6d | 65 6e 74 20 0d 09 70 6f |developm|ent ..po|
|00000130| 72 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 4d 61 63 |rtion of| the Mac|
|00000140| 4f 53 20 53 44 4b 2e 0d | 09 0d 09 54 68 69 73 20 |OS SDK..|...This |
|00000150| 69 73 20 65 73 73 65 6e | 74 69 61 6c 6c 79 20 74 |is essen|tially t|
|00000160| 68 65 20 73 61 6d 65 20 | 61 73 20 74 68 65 20 50 |he same |as the P|
|00000170| 72 69 6e 74 4a 50 45 47 | 20 61 70 70 6c 69 63 61 |rintJPEG| applica|
|00000180| 74 69 6f 6e 20 62 75 74 | 20 61 6c 6c 6f 77 73 20 |tion but| allows |
|00000190| 66 6f 72 20 61 20 51 75 | 69 63 6b 54 69 6d 65 0d |for a Qu|ickTime.|
|000001a0| 09 64 61 74 61 20 6c 6f | 61 64 69 6e 67 20 66 75 |.data lo|ading fu|
|000001b0| 6e 63 74 69 6f 6e 20 74 | 6f 20 62 65 20 75 73 65 |nction t|o be use|
|000001c0| 64 20 69 6e 73 74 65 61 | 64 20 6f 66 20 6c 6f 61 |d instea|d of loa|
|000001d0| 64 69 6e 67 20 61 6c 6c | 20 74 68 65 20 64 61 74 |ding all| the dat|
|000001e0| 61 20 69 6e 74 6f 20 6d | 65 6d 6f 72 79 2e 0d 09 |a into m|emory...|
|000001f0| 0d 09 43 6f 70 79 72 69 | 67 68 74 20 28 63 29 20 |..Copyri|ght (c) |
|00000200| 41 70 70 6c 65 20 43 6f | 6d 70 75 74 65 72 20 49 |Apple Co|mputer I|
|00000210| 6e 63 6f 72 70 6f 72 61 | 74 65 64 2e 20 41 6c 6c |ncorpora|ted. All|
|00000220| 20 72 69 67 68 74 73 20 | 72 65 73 65 72 76 65 64 | rights |reserved|
|00000230| 2e 0d 2a 2f 0d 23 69 6e | 63 6c 75 64 65 20 22 50 |..*/.#in|clude "P|
|00000240| 72 69 6e 74 4a 50 45 47 | 20 77 69 74 68 20 64 61 |rintJPEG| with da|
|00000250| 74 61 6c 6f 61 64 2e 68 | 22 0d 0d 2f 2a 20 67 6c |taload.h|"../* gl|
|00000260| 6f 62 61 6c 73 20 20 2a | 2f 0d 0d 57 69 6e 64 6f |obals *|/..Windo|
|00000270| 77 50 74 72 20 67 54 68 | 65 57 69 6e 64 6f 77 3b |wPtr gTh|eWindow;|
|00000280| 0d 4a 50 45 47 49 6d 61 | 67 65 20 67 54 68 65 4a |.JPEGIma|ge gTheJ|
|00000290| 50 45 47 49 6d 61 67 65 | 3b 0d 54 48 50 72 69 6e |PEGImage|;.THPrin|
|000002a0| 74 09 67 50 72 69 6e 74 | 65 72 52 65 63 6f 72 64 |t.gPrint|erRecord|
|000002b0| 20 3d 20 4e 55 4c 4c 3b | 0d 49 43 4d 44 61 74 61 | = NULL;|.ICMData|
|000002c0| 50 72 6f 63 52 65 63 6f | 72 64 09 67 54 68 65 49 |ProcReco|rd.gTheI|
|000002d0| 43 4d 44 61 74 61 50 72 | 6f 63 52 65 63 6f 72 64 |CMDataPr|ocRecord|
|000002e0| 3b 0d 0d 2f 2a 20 6d 61 | 69 6e 20 2a 2f 0d 53 49 |;../* ma|in */.SI|
|000002f0| 6e 74 31 36 20 6d 61 69 | 6e 28 29 0d 7b 0d 4f 53 |nt16 mai|n().{.OS|
|00000300| 45 72 72 20 74 68 65 45 | 72 72 3b 0d 44 61 74 61 |Err theE|rr;.Data|
|00000310| 4c 6f 61 64 50 74 72 20 | 6d 79 44 61 74 61 4c 6f |LoadPtr |myDataLo|
|00000320| 61 64 50 74 72 3b 20 0d | 0d 09 2f 2f 20 69 6e 69 |adPtr; .|..// ini|
|00000330| 74 69 61 6c 69 7a 65 20 | 74 68 65 20 6d 61 6e 61 |tialize |the mana|
|00000340| 67 65 72 73 20 61 6e 64 | 20 74 68 65 20 6d 65 6e |gers and| the men|
|00000350| 75 73 0d 09 69 66 20 28 | 69 6e 69 74 4d 61 63 69 |us..if (|initMaci|
|00000360| 6e 74 6f 73 68 28 29 20 | 21 3d 20 6e 6f 45 72 72 |ntosh() |!= noErr|
|00000370| 29 0d 09 09 72 65 74 75 | 72 6e 20 30 3b 0d 09 0d |)...retu|rn 0;...|
|00000380| 09 2f 2a 20 20 61 6c 6c | 6f 63 61 74 65 20 61 20 |./* all|ocate a |
|00000390| 70 72 69 6e 74 20 72 65 | 63 6f 72 64 20 66 6f 72 |print re|cord for|
|000003a0| 20 75 73 20 2a 2f 0d 09 | 67 50 72 69 6e 74 65 72 | us */..|gPrinter|
|000003b0| 52 65 63 6f 72 64 20 3d | 20 28 54 48 50 72 69 6e |Record =| (THPrin|
|000003c0| 74 29 4e 65 77 48 61 6e | 64 6c 65 28 73 69 7a 65 |t)NewHan|dle(size|
|000003d0| 6f 66 28 20 54 50 72 69 | 6e 74 20 29 20 29 3b 0d |of( TPri|nt ) );.|
|000003e0| 0d 09 2f 2f 20 47 65 74 | 20 74 68 65 20 64 65 66 |..// Get| the def|
|000003f0| 61 75 6c 74 73 20 66 6f | 72 20 74 68 65 20 63 75 |aults fo|r the cu|
|00000400| 72 72 65 6e 74 20 70 72 | 69 6e 74 65 72 20 64 72 |rrent pr|inter dr|
|00000410| 69 76 65 72 2e 0d 09 69 | 66 20 28 67 50 72 69 6e |iver...i|f (gPrin|
|00000420| 74 65 72 52 65 63 6f 72 | 64 20 21 3d 20 4e 55 4c |terRecor|d != NUL|
|00000430| 4c 20 26 26 20 4d 65 6d | 45 72 72 6f 72 28 29 20 |L && Mem|Error() |
|00000440| 3d 3d 20 6e 6f 45 72 72 | 29 0d 09 7b 0d 09 09 50 |== noErr|)..{...P|
|00000450| 72 4f 70 65 6e 28 29 3b | 20 0d 09 09 50 72 69 6e |rOpen();| ...Prin|
|00000460| 74 44 65 66 61 75 6c 74 | 28 20 67 50 72 69 6e 74 |tDefault|( gPrint|
|00000470| 65 72 52 65 63 6f 72 64 | 20 29 3b 20 0d 09 09 50 |erRecord| ); ...P|
|00000480| 72 43 6c 6f 73 65 28 29 | 3b 0d 09 7d 65 6c 73 65 |rClose()|;..}else|
|00000490| 7b 0d 09 09 50 61 72 61 | 6d 54 65 78 74 28 22 5c |{...Para|mText("\|
|000004a0| 70 43 61 6e 27 74 20 61 | 6c 6c 6f 63 61 74 65 20 |pCan't a|llocate |
|000004b0| 50 72 69 6e 74 20 52 65 | 63 6f 72 64 2e 22 2c 20 |Print Re|cord.", |
|000004c0| 22 5c 70 22 2c 20 22 5c | 70 22 2c 20 22 5c 70 22 |"\p", "\|p", "\p"|
|000004d0| 29 3b 0d 09 09 41 6c 65 | 72 74 28 6b 47 65 6e 65 |);...Ale|rt(kGene|
|000004e0| 72 69 63 45 72 72 6f 72 | 2c 20 4e 55 4c 4c 29 3b |ricError|, NULL);|
|000004f0| 09 0d 09 09 72 65 74 75 | 72 6e 20 69 4d 65 6d 46 |....retu|rn iMemF|
|00000500| 75 6c 6c 45 72 72 3b 09 | 0d 09 7d 0d 09 09 0d 09 |ullErr;.|..}.....|
|00000510| 2f 2f 20 43 68 65 63 6b | 20 74 6f 20 73 65 65 20 |// Check| to see |
|00000520| 69 66 20 74 68 65 72 65 | 20 61 72 65 20 61 6e 79 |if there| are any|
|00000530| 20 65 72 72 6f 72 73 20 | 61 6e 64 20 72 65 70 6f | errors |and repo|
|00000540| 72 74 20 74 68 65 6d 20 | 69 66 20 74 68 65 79 20 |rt them |if they |
|00000550| 6f 63 63 75 72 2e 0d 09 | 69 66 28 28 20 74 68 65 |occur...|if(( the|
|00000560| 45 72 72 20 3d 20 50 72 | 45 72 72 6f 72 28 29 29 |Err = Pr|Error())|
|00000570| 20 21 3d 20 6e 6f 45 72 | 72 29 7b 0d 09 09 53 74 | != noEr|r){...St|
|00000580| 72 32 35 35 20 73 63 72 | 61 74 63 68 53 74 72 69 |r255 scr|atchStri|
|00000590| 6e 67 3b 0d 09 09 4e 75 | 6d 54 6f 53 74 72 69 6e |ng;...Nu|mToStrin|
|000005a0| 67 28 28 6c 6f 6e 67 29 | 74 68 65 45 72 72 2c 20 |g((long)|theErr, |
|000005b0| 73 63 72 61 74 63 68 53 | 74 72 69 6e 67 29 3b 0d |scratchS|tring);.|
|000005c0| 09 09 50 61 72 61 6d 54 | 65 78 74 28 22 5c 70 43 |..ParamT|ext("\pC|
|000005d0| 61 6e 27 74 20 44 6f 20 | 50 72 44 65 66 61 75 6c |an't Do |PrDefaul|
|000005e0| 74 20 66 6f 72 20 73 6f | 6d 65 20 72 65 61 73 6f |t for so|me reaso|
|000005f0| 6e 2e 22 2c 20 73 63 72 | 61 74 63 68 53 74 72 69 |n.", scr|atchStri|
|00000600| 6e 67 2c 20 22 5c 70 22 | 2c 20 22 5c 70 22 29 3b |ng, "\p"|, "\p");|
|00000610| 0d 09 09 41 6c 65 72 74 | 28 6b 47 65 6e 65 72 69 |...Alert|(kGeneri|
|00000620| 63 45 72 72 6f 72 2c 20 | 4e 55 4c 4c 29 3b 09 0d |cError, |NULL);..|
|00000630| 09 7d 0d 0d 09 2f 2f 20 | 6d 61 6b 65 20 61 20 6e |.}...// |make a n|
|00000640| 65 77 20 49 43 4d 44 61 | 74 61 50 72 6f 63 20 72 |ew ICMDa|taProc r|
|00000650| 65 63 6f 72 64 20 66 6f | 72 20 75 73 69 6e 67 20 |ecord fo|r using |
|00000660| 61 20 44 61 74 61 4c 6f | 61 64 69 6e 67 20 70 72 |a DataLo|ading pr|
|00000670| 6f 63 20 77 69 74 68 20 | 2a 6f 75 72 2a 20 44 61 |oc with |*our* Da|
|00000680| 74 61 4c 6f 61 64 69 6e | 67 0d 09 2f 2f 20 70 72 |taLoadin|g..// pr|
|00000690| 6f 63 20 27 4d 79 44 61 | 74 61 4c 6f 61 64 69 6e |oc 'MyDa|taLoadin|
|000006a0| 67 50 72 6f 63 27 2e 0d | 09 67 54 68 65 49 43 4d |gProc'..|.gTheICM|
|000006b0| 44 61 74 61 50 72 6f 63 | 52 65 63 6f 72 64 2e 64 |DataProc|Record.d|
|000006c0| 61 74 61 50 72 6f 63 20 | 3d 20 4e 65 77 49 43 4d |ataProc |= NewICM|
|000006d0| 44 61 74 61 50 72 6f 63 | 28 4d 79 44 61 74 61 4c |DataProc|(MyDataL|
|000006e0| 6f 61 64 69 6e 67 50 72 | 6f 63 29 3b 0d 0d 09 69 |oadingPr|oc);...i|
|000006f0| 66 28 67 54 68 65 49 43 | 4d 44 61 74 61 50 72 6f |f(gTheIC|MDataPro|
|00000700| 63 52 65 63 6f 72 64 2e | 64 61 74 61 50 72 6f 63 |cRecord.|dataProc|
|00000710| 20 21 3d 20 4e 55 4c 4c | 20 26 26 20 28 4d 65 6d | != NULL| && (Mem|
|00000720| 45 72 72 6f 72 28 29 20 | 3d 3d 20 6e 6f 45 72 72 |Error() |== noErr|
|00000730| 29 20 29 7b 0d 09 09 0d | 09 09 2f 2f 20 6d 61 6b |) ){....|..// mak|
|00000740| 65 20 61 20 70 6f 69 6e | 74 65 72 20 74 68 65 20 |e a poin|ter the |
|00000750| 73 69 7a 65 20 6f 66 20 | 74 68 65 20 44 61 74 61 |size of |the Data|
|00000760| 4c 6f 61 64 20 64 61 74 | 61 20 73 74 72 75 63 74 |Load dat|a struct|
|00000770| 75 72 65 20 28 64 65 66 | 69 6e 65 64 20 69 6e 20 |ure (def|ined in |
|00000780| 6f 75 72 20 2e 68 20 66 | 69 6c 65 29 20 0d 09 09 |our .h f|ile) ...|
|00000790| 2f 2f 20 61 6e 64 20 70 | 75 74 20 69 74 20 69 6e |// and p|ut it in|
|000007a0| 74 6f 20 74 68 65 20 27 | 64 61 74 61 52 65 66 43 |to the '|dataRefC|
|000007b0| 6f 6e 27 20 66 69 65 6c | 64 20 6f 66 20 6f 75 72 |on' fiel|d of our|
|000007c0| 20 49 43 4d 44 61 74 61 | 50 72 6f 63 20 73 74 72 | ICMData|Proc str|
|000007d0| 75 63 74 75 72 65 2e 0d | 09 09 67 54 68 65 49 43 |ucture..|..gTheIC|
|000007e0| 4d 44 61 74 61 50 72 6f | 63 52 65 63 6f 72 64 2e |MDataPro|cRecord.|
|000007f0| 64 61 74 61 52 65 66 43 | 6f 6e 20 3d 20 28 6c 6f |dataRefC|on = (lo|
|00000800| 6e 67 29 4e 65 77 50 74 | 72 28 73 69 7a 65 6f 66 |ng)NewPt|r(sizeof|
|00000810| 28 44 61 74 61 4c 6f 61 | 64 29 29 3b 0d 09 7d 0d |(DataLoa|d));..}.|
|00000820| 09 09 0d 09 6d 79 44 61 | 74 61 4c 6f 61 64 50 74 |....myDa|taLoadPt|
|00000830| 72 20 3d 20 28 44 61 74 | 61 4c 6f 61 64 50 74 72 |r = (Dat|aLoadPtr|
|00000840| 29 67 54 68 65 49 43 4d | 44 61 74 61 50 72 6f 63 |)gTheICM|DataProc|
|00000850| 52 65 63 6f 72 64 2e 64 | 61 74 61 52 65 66 43 6f |Record.d|ataRefCo|
|00000860| 6e 3b 0d 09 0d 09 69 66 | 28 67 54 68 65 49 43 4d |n;....if|(gTheICM|
|00000870| 44 61 74 61 50 72 6f 63 | 52 65 63 6f 72 64 2e 64 |DataProc|Record.d|
|00000880| 61 74 61 52 65 66 43 6f | 6e 20 21 3d 20 4e 55 4c |ataRefCo|n != NUL|
|00000890| 4c 20 26 26 20 28 4d 65 | 6d 45 72 72 6f 72 28 29 |L && (Me|mError()|
|000008a0| 20 3d 3d 20 6e 6f 45 72 | 72 29 20 29 7b 0d 09 09 | == noEr|r) ){...|
|000008b0| 2f 2f 20 6d 61 6b 65 20 | 61 20 6e 65 77 20 68 61 |// make |a new ha|
|000008c0| 6e 64 6c 65 20 74 68 65 | 20 73 69 7a 65 20 6f 66 |ndle the| size of|
|000008d0| 20 6f 75 72 20 62 75 66 | 66 65 72 73 69 7a 65 20 | our buf|fersize |
|000008e0| 61 6e 64 20 70 75 74 20 | 69 74 20 69 6e 74 6f 20 |and put |it into |
|000008f0| 6f 75 72 20 44 61 74 61 | 4c 6f 61 64 20 73 74 72 |our Data|Load str|
|00000900| 75 63 74 75 72 65 2e 0d | 09 09 6d 79 44 61 74 61 |ucture..|..myData|
|00000910| 4c 6f 61 64 50 74 72 2d | 3e 74 68 65 44 61 74 61 |LoadPtr-|>theData|
|00000920| 42 75 66 66 65 72 48 20 | 3d 20 4e 65 77 48 61 6e |BufferH |= NewHan|
|00000930| 64 6c 65 28 6b 4d 59 42 | 55 46 46 45 52 53 49 5a |dle(kMYB|UFFERSIZ|
|00000940| 45 29 3b 0d 09 09 0d 09 | 09 2f 2f 20 66 69 6c 6c |E);.....|.// fill|
|00000950| 20 69 6e 20 74 68 65 20 | 73 69 7a 65 20 66 69 65 | in the |size fie|
|00000960| 6c 64 20 74 6f 6f 2e 0d | 09 09 6d 79 44 61 74 61 |ld too..|..myData|
|00000970| 4c 6f 61 64 50 74 72 2d | 3e 74 68 65 42 75 66 66 |LoadPtr-|>theBuff|
|00000980| 65 72 53 69 7a 65 20 3d | 20 6b 4d 59 42 55 46 46 |erSize =| kMYBUFF|
|00000990| 45 52 53 49 5a 45 3b 0d | 09 09 2f 2f 20 69 6e 69 |ERSIZE;.|..// ini|
|000009a0| 74 69 61 6c 69 7a 65 20 | 74 68 65 20 72 65 66 6e |tialize |the refn|
|000009b0| 75 6d 20 66 69 65 6c 64 | 20 74 6f 20 7a 65 72 6f |um field| to zero|
|000009c0| 2e 0d 09 09 6d 79 44 61 | 74 61 4c 6f 61 64 50 74 |....myDa|taLoadPt|
|000009d0| 72 2d 3e 74 68 65 52 65 | 66 4e 75 6d 20 3d 20 30 |r->theRe|fNum = 0|
|000009e0| 3b 0d 09 7d 0d 0d 09 2f | 2f 20 6d 61 6b 65 20 73 |;..}.../|/ make s|
|000009f0| 75 72 65 20 77 65 20 63 | 6f 75 6c 64 20 67 65 74 |ure we c|ould get|
|00000a00| 20 74 68 65 20 6d 65 6d | 6f 72 79 20 66 6f 72 20 | the mem|ory for |
|00000a10| 6f 75 72 20 62 75 66 66 | 65 72 0d 09 69 66 28 6d |our buff|er..if(m|
|00000a20| 79 44 61 74 61 4c 6f 61 | 64 50 74 72 2d 3e 74 68 |yDataLoa|dPtr->th|
|00000a30| 65 44 61 74 61 42 75 66 | 66 65 72 48 20 3d 3d 20 |eDataBuf|ferH == |
|00000a40| 4e 55 4c 4c 20 7c 7c 20 | 4d 65 6d 45 72 72 6f 72 |NULL || |MemError|
|00000a50| 28 29 20 21 3d 20 6e 6f | 45 72 72 29 7b 0d 09 09 |() != no|Err){...|
|00000a60| 50 61 72 61 6d 54 65 78 | 74 28 22 5c 70 43 61 6e |ParamTex|t("\pCan|
|00000a70| 27 74 20 61 6c 6c 6f 63 | 61 74 65 20 44 61 74 61 |'t alloc|ate Data|
|00000a80| 20 4c 6f 61 64 69 6e 67 | 20 42 75 66 66 65 72 22 | Loading| Buffer"|
|00000a90| 2c 20 22 5c 70 22 2c 20 | 22 5c 70 22 2c 20 22 5c |, "\p", |"\p", "\|
|00000aa0| 70 22 29 3b 0d 09 09 41 | 6c 65 72 74 28 6b 47 65 |p");...A|lert(kGe|
|00000ab0| 6e 65 72 69 63 45 72 72 | 6f 72 2c 20 4e 55 4c 4c |nericErr|or, NULL|
|00000ac0| 29 3b 0d 09 09 72 65 74 | 75 72 6e 20 31 3b 0d 09 |);...ret|urn 1;..|
|00000ad0| 7d 0d 0d 09 0d 09 2f 2f | 20 69 6e 69 74 69 61 6c |}.....//| initial|
|00000ae0| 69 7a 65 20 6f 75 72 20 | 4a 50 45 47 49 6d 61 67 |ize our |JPEGImag|
|00000af0| 65 20 44 61 74 61 20 53 | 74 72 75 63 74 75 72 65 |e Data S|tructure|
|00000b00| 2e 0d 09 67 54 68 65 4a | 50 45 47 49 6d 61 67 65 |...gTheJ|PEGImage|
|00000b10| 2e 74 68 65 52 65 66 4e | 75 6d 20 3d 20 30 3b 0d |.theRefN|um = 0;.|
|00000b20| 09 53 65 74 52 65 63 74 | 28 26 67 54 68 65 4a 50 |.SetRect|(&gTheJP|
|00000b30| 45 47 49 6d 61 67 65 2e | 74 68 65 42 6f 75 6e 64 |EGImage.|theBound|
|00000b40| 73 2c 30 2c 30 2c 30 2c | 30 29 3b 0d 09 67 54 68 |s,0,0,0,|0);..gTh|
|00000b50| 65 4a 50 45 47 49 6d 61 | 67 65 2e 74 68 65 44 65 |eJPEGIma|ge.theDe|
|00000b60| 73 63 20 3d 20 4e 55 4c | 4c 3b 0d 0d 09 2f 2f 20 |sc = NUL|L;...// |
|00000b70| 47 6f 20 61 68 65 61 64 | 20 61 6e 64 20 67 65 74 |Go ahead| and get|
|00000b80| 20 61 6e 20 69 6d 61 67 | 65 2e 2e 2e 0d 09 44 6f | an imag|e.....Do|
|00000b90| 54 68 65 4f 70 65 6e 43 | 6f 6d 6d 61 6e 64 28 29 |TheOpenC|ommand()|
|00000ba0| 3b 0d 09 0d 09 2f 2f 20 | 50 72 6f 63 65 73 73 20 |;....// |Process |
|00000bb0| 65 76 65 6e 74 73 2c 20 | 65 74 63 2e 0d 09 66 6f |events, |etc...fo|
|00000bc0| 72 20 28 3b 20 68 61 6e | 64 6c 65 45 76 65 6e 74 |r (; han|dleEvent|
|00000bd0| 28 29 3b 29 0d 09 09 7b | 0d 09 09 7d 09 2f 2a 20 |();)...{|...}./* |
|00000be0| 66 6f 72 20 2a 2f 0d 09 | 72 65 74 75 72 6e 20 31 |for */..|return 1|
|00000bf0| 3b 0d 7d 20 2f 2a 20 6d | 61 69 6e 20 2a 2f 0d 09 |;.} /* m|ain */..|
|00000c00| 0d 0d 2f 2f 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |..//====|========|
|00000c10| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000c20| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000c30| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000c40| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000c50| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 0d 2f 2f 20 4f 53 45 |========|=.// OSE|
|00000c60| 72 72 20 44 72 61 77 4a | 50 45 47 49 6d 61 67 65 |rr DrawJ|PEGImage|
|00000c70| 28 4a 50 45 47 49 6d 61 | 67 65 20 74 68 65 4a 50 |(JPEGIma|ge theJP|
|00000c80| 45 47 49 6d 61 67 65 2c | 20 42 6f 6f 6c 65 61 6e |EGImage,| Boolean|
|00000c90| 20 69 73 43 6f 6c 6f 72 | 50 6f 72 74 29 0d 2f 2f | isColor|Port).//|
|00000ca0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000cb0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000cc0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000cd0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000ce0| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000cf0| 3d 3d 3d 3d 3d 0d 2f 2f | 20 44 72 61 77 73 20 61 |=====.//| Draws a|
|00000d00| 20 4a 50 45 47 20 69 6d | 61 67 65 2c 20 77 68 6f | JPEG im|age, who|
|00000d10| 73 65 20 64 61 74 61 20 | 69 73 20 6f 6e 20 64 69 |se data |is on di|
|00000d20| 73 6b 2c 20 74 6f 20 74 | 68 65 20 63 75 72 72 65 |sk, to t|he curre|
|00000d30| 6e 74 20 70 6f 72 74 2e | 0d 2f 2f 3d 3d 3d 3d 3d |nt port.|.//=====|
|00000d40| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000d50| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000d60| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000d70| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000d80| 3d 3d 3d 3d 3d 3d 3d 3d | 3d 3d 3d 3d 3d 3d 3d 3d |========|========|
|00000d90| 0d 0d 0d 73 74 61 74 69 | 63 20 4f 53 45 72 72 20 |...stati|c OSErr |
|00000da0| 44 72 61 77 4a 50 45 47 | 49 6d 61 67 65 28 4a 50 |DrawJPEG|Image(JP|
|00000db0| 45 47 49 6d 61 67 65 20 | 74 68 65 4a 50 45 47 49 |EGImage |theJPEGI|
|00000dc0| 6d 61 67 65 2c 20 42 6f | 6f 6c 65 61 6e 20 69 73 |mage, Bo|olean is|
|00000dd0| 43 6f 6c 6f 72 50 6f 72 | 74 29 0d 7b 0d 09 52 65 |ColorPor|t).{..Re|
|00000de0| 63 74 20 73 72 63 52 65 | 63 74 3b 0d 0d 09 4f 53 |ct srcRe|ct;...OS|
|00000df0| 45 72 72 20 74 68 65 45 | 72 72 20 3d 20 6e 6f 45 |Err theE|rr = noE|
|00000e00| 72 72 3b 0d 09 09 09 0d | 09 44 61 74 61 4c 6f 61 |rr;.....|.DataLoa|
|00000e10| 64 50 74 72 20 6d 79 44 | 61 74 61 4c 6f 61 64 50 |dPtr myD|ataLoadP|
|00000e20| 74 72 20 3d 20 28 44 61 | 74 61 4c 6f 61 64 50 74 |tr = (Da|taLoadPt|
|00000e30| 72 29 67 54 68 65 49 43 | 4d 44 61 74 61 50 72 6f |r)gTheIC|MDataPro|
|00000e40| 63 52 65 63 6f 72 64 2e | 64 61 74 61 52 65 66 43 |cRecord.|dataRefC|
|00000e50| 6f 6e 3b 20 0d 09 6c 6f | 6e 67 20 74 68 65 42 75 |on; ..lo|ng theBu|
|00000e60| 66 66 65 72 53 69 7a 65 | 20 3d 20 6d 79 44 61 74 |fferSize| = myDat|
|00000e70| 61 4c 6f 61 64 50 74 72 | 2d 3e 74 68 65 42 75 66 |aLoadPtr|->theBuf|
|00000e80| 66 65 72 53 69 7a 65 3b | 0d 09 73 68 6f 72 74 20 |ferSize;|..short |
|00000e90| 74 68 65 52 65 66 4e 75 | 6d 20 3d 20 74 68 65 4a |theRefNu|m = theJ|
|00000ea0| 50 45 47 49 6d 61 67 65 | 2e 74 68 65 52 65 66 4e |PEGImage|.theRefN|
|00000eb0| 75 6d 3b 0d 0d 09 48 61 | 6e 64 6c 65 20 74 68 65 |um;...Ha|ndle the|
|00000ec0| 44 61 74 61 48 61 6e 64 | 6c 65 20 3d 20 6d 79 44 |DataHand|le = myD|
|00000ed0| 61 74 61 4c 6f 61 64 50 | 74 72 2d 3e 74 68 65 44 |ataLoadP|tr->theD|
|00000ee0| 61 74 61 42 75 66 66 65 | 72 48 3b 0d 09 50 74 72 |ataBuffe|rH;..Ptr|
|00000ef0| 09 74 68 65 44 61 74 61 | 50 74 72 20 3b 0d 09 6c |.theData|Ptr ;..l|
|00000f00| 6f 6e 67 20 74 68 65 41 | 6d 6f 75 6e 74 54 6f 52 |ong theA|mountToR|
|00000f10| 65 61 64 3b 0d 09 49 43 | 4d 44 61 74 61 50 72 6f |ead;..IC|MDataPro|
|00000f20| 63 52 65 63 6f 72 64 20 | 2a 74 68 65 44 61 74 61 |cRecord |*theData|
|00000f30| 50 72 6f 63 52 65 63 6f | 72 64 3b 0d 0d 09 49 6d |ProcReco|rd;...Im|
|00000f40| 61 67 65 44 65 73 63 72 | 69 70 74 69 6f 6e 48 61 |ageDescr|iptionHa|
|00000f50| 6e 64 6c 65 20 74 68 65 | 44 65 73 63 20 3d 20 74 |ndle the|Desc = t|
|00000f60| 68 65 4a 50 45 47 49 6d | 61 67 65 2e 74 68 65 44 |heJPEGIm|age.theD|
|00000f70| 65 73 63 3b 0d 09 0d 09 | 69 66 20 28 74 68 65 44 |esc;....|if (theD|
|00000f80| 61 74 61 48 61 6e 64 6c | 65 20 21 3d 20 4e 55 4c |ataHandl|e != NUL|
|00000f90| 4c 29 7b 0d 09 09 50 69 | 78 4d 61 70 48 61 6e 64 |L){...Pi|xMapHand|
|00000fa0| 6c 65 20 64 50 69 78 4d | 61 70 20 3d 20 28 28 43 |le dPixM|ap = ((C|
|00000fb0| 47 72 61 66 50 74 72 29 | 71 64 2e 74 68 65 50 6f |GrafPtr)|qd.thePo|
|00000fc0| 72 74 29 2d 3e 70 6f 72 | 74 50 69 78 4d 61 70 3b |rt)->por|tPixMap;|
|00000fd0| 0d 0d 09 09 63 68 61 72 | 20 68 53 74 61 74 65 20 |....char| hState |
|00000fe0| 3d 20 48 47 65 74 53 74 | 61 74 65 28 74 68 65 44 |= HGetSt|ate(theD|
|00000ff0| 61 74 61 48 61 6e 64 6c | 65 29 3b 0d 09 09 48 4c |ataHandl|e);...HL|
|00001000| 6f 63 6b 28 74 68 65 44 | 61 74 61 48 61 6e 64 6c |ock(theD|ataHandl|
|00001010| 65 29 3b 09 09 09 09 2f | 2f 20 4c 6f 63 6b 20 64 |e);..../|/ Lock d|
|00001020| 6f 77 6e 20 74 68 65 20 | 64 61 74 61 20 62 65 66 |own the |data bef|
|00001030| 6f 72 65 20 75 73 69 6e | 67 20 2a 74 68 65 44 61 |ore usin|g *theDa|
|00001040| 74 61 48 61 6e 64 6c 65 | 0d 09 09 74 68 65 44 61 |taHandle|...theDa|
|00001050| 74 61 50 74 72 20 3d 20 | 53 74 72 69 70 41 64 64 |taPtr = |StripAdd|
|00001060| 72 65 73 73 28 2a 74 68 | 65 44 61 74 61 48 61 6e |ress(*th|eDataHan|
|00001070| 64 6c 65 29 3b 0d 09 09 | 09 0d 09 09 2f 2f 20 73 |dle);...|....// s|
|00001080| 72 63 52 65 63 74 20 77 | 69 6c 6c 20 62 65 20 74 |rcRect w|ill be t|
|00001090| 68 65 20 73 6f 75 72 63 | 65 20 72 65 63 74 61 6e |he sourc|e rectan|
|000010a0| 67 6c 65 20 6f 66 20 74 | 68 65 20 69 6d 61 67 65 |gle of t|he image|
|000010b0| 20 77 65 20 77 69 6c 6c | 20 64 72 61 77 20 0d 09 | we will| draw ..|
|000010c0| 09 53 65 74 52 65 63 74 | 28 26 73 72 63 52 65 63 |.SetRect|(&srcRec|
|000010d0| 74 2c 20 30 2c 20 30 2c | 20 28 2a 74 68 65 44 65 |t, 0, 0,| (*theDe|
|000010e0| 73 63 29 2d 3e 77 69 64 | 74 68 2c 20 28 2a 74 68 |sc)->wid|th, (*th|
|000010f0| 65 44 65 73 63 29 2d 3e | 68 65 69 67 68 74 29 3b |eDesc)->|height);|
|00001100| 09 09 09 0d 0d 09 09 2f | 2f 20 73 65 74 20 75 70 |......./|/ set up|
|00001110| 20 74 68 65 20 64 61 74 | 61 20 6c 6f 61 64 69 6e | the dat|a loadin|
|00001120| 67 20 70 72 6f 63 65 64 | 75 72 65 2c 20 61 73 20 |g proced|ure, as |
|00001130| 6e 65 63 65 73 73 61 72 | 79 2e 0d 09 09 0d 09 09 |necessar|y.......|
|00001140| 2f 2f 20 68 6f 77 20 6d | 75 63 68 20 64 61 74 61 |// how m|uch data|
|00001150| 20 73 68 6f 75 6c 64 20 | 77 65 20 72 65 61 64 3f | should |we read?|
|00001160| 20 49 74 20 69 73 20 74 | 68 65 20 73 6d 61 6c 6c | It is t|he small|
|00001170| 65 72 20 6f 66 20 74 68 | 65 20 73 69 7a 65 20 6f |er of th|e size o|
|00001180| 66 20 74 68 65 20 69 6d | 61 67 65 20 6f 72 0d 09 |f the im|age or..|
|00001190| 09 2f 2f 20 6f 75 72 20 | 62 75 66 66 65 72 20 73 |.// our |buffer s|
|000011a0| 69 7a 65 2e 0d 09 09 74 | 68 65 41 6d 6f 75 6e 74 |ize....t|heAmount|
|000011b0| 54 6f 52 65 61 64 20 3d | 20 4d 49 4e 28 74 68 65 |ToRead =| MIN(the|
|000011c0| 42 75 66 66 65 72 53 69 | 7a 65 2c 20 28 2a 74 68 |BufferSi|ze, (*th|
|000011d0| 65 44 65 73 63 29 2d 3e | 64 61 74 61 53 69 7a 65 |eDesc)->|dataSize|
|000011e0| 20 29 3b 0d 09 09 0d 09 | 09 2f 2f 20 6d 61 6b 65 | );.....|.// make|
|000011f0| 20 73 75 72 65 20 77 65 | 27 72 65 20 61 74 20 74 | sure we|'re at t|
|00001200| 68 65 20 62 65 67 69 6e | 6e 69 6e 67 20 6f 66 20 |he begin|ning of |
|00001210| 74 68 65 20 66 69 6c 65 | 20 62 65 66 6f 72 65 20 |the file| before |
|00001220| 77 65 20 73 74 61 72 74 | 20 72 65 61 64 69 6e 67 |we start| reading|
|00001230| 20 64 61 74 61 2e 0d 09 | 09 69 66 28 74 68 65 45 | data...|.if(theE|
|00001240| 72 72 20 3d 3d 20 6e 6f | 45 72 72 29 74 68 65 45 |rr == no|Err)theE|
|00001250| 72 72 20 3d 20 53 65 74 | 46 50 6f 73 28 74 68 65 |rr = Set|FPos(the|
|00001260| 52 65 66 4e 75 6d 2c 20 | 66 73 46 72 6f 6d 53 74 |RefNum, |fsFromSt|
|00001270| 61 72 74 2c 20 30 29 3b | 0d 09 09 0d 09 09 2f 2f |art, 0);|......//|
|00001280| 20 66 69 6c 6c 20 75 70 | 20 74 68 65 20 62 75 66 | fill up| the buf|
|00001290| 66 65 72 20 77 69 74 68 | 20 74 68 65 20 61 70 70 |fer with| the app|
|000012a0| 72 6f 70 72 69 61 74 65 | 20 61 6d 74 20 6f 66 20 |ropriate| amt of |
|000012b0| 64 61 74 61 2e 20 54 68 | 69 73 20 69 73 20 65 69 |data. Th|is is ei|
|000012c0| 74 68 65 72 20 61 6c 6c | 20 74 68 65 0d 09 09 2f |ther all| the.../|
|000012d0| 2f 20 64 61 74 61 20 77 | 65 20 6e 65 65 64 20 6f |/ data w|e need o|
|000012e0| 72 20 6f 6e 65 20 62 75 | 66 66 65 72 27 73 20 77 |r one bu|ffer's w|
|000012f0| 6f 72 74 68 0d 09 09 69 | 66 28 74 68 65 45 72 72 |orth...i|f(theErr|
|00001300| 20 3d 3d 20 6e 6f 45 72 | 72 29 74 68 65 45 72 72 | == noEr|r)theErr|
|00001310| 20 3d 20 46 53 52 65 61 | 64 28 74 68 65 52 65 66 | = FSRea|d(theRef|
|00001320| 4e 75 6d 2c 20 26 74 68 | 65 41 6d 6f 75 6e 74 54 |Num, &th|eAmountT|
|00001330| 6f 52 65 61 64 2c 74 68 | 65 44 61 74 61 50 74 72 |oRead,th|eDataPtr|
|00001340| 29 3b 0d 0d 09 09 69 66 | 28 74 68 65 45 72 72 20 |);....if|(theErr |
|00001350| 3d 3d 20 6e 6f 45 72 72 | 29 20 7b 0d 09 09 09 2f |== noErr|) {..../|
|00001360| 2f 20 69 66 20 74 68 65 | 20 61 6d 6f 75 6e 74 20 |/ if the| amount |
|00001370| 6f 66 20 64 61 74 61 20 | 72 65 61 64 20 69 73 20 |of data |read is |
|00001380| 74 68 65 20 73 61 6d 65 | 20 61 73 20 74 68 65 20 |the same| as the |
|00001390| 73 69 7a 65 20 6f 66 20 | 74 68 65 20 69 6d 61 67 |size of |the imag|
|000013a0| 65 2c 20 74 68 65 6e 0d | 09 09 09 2f 2f 20 77 65 |e, then.|...// we|
|000013b0| 20 64 6f 6e 27 74 20 6e | 65 65 64 20 61 20 64 61 | don't n|eed a da|
|000013c0| 74 61 20 6c 6f 61 64 69 | 6e 67 20 70 72 6f 63 2e |ta loadi|ng proc.|
|000013d0| 20 0d 09 09 09 69 66 28 | 74 68 65 41 6d 6f 75 6e | ....if(|theAmoun|
|000013e0| 74 54 6f 52 65 61 64 20 | 3d 3d 20 28 2a 74 68 65 |tToRead |== (*the|
|000013f0| 44 65 73 63 29 2d 3e 64 | 61 74 61 53 69 7a 65 29 |Desc)->d|ataSize)|
|00001400| 7b 0d 09 09 09 09 74 68 | 65 44 61 74 61 50 72 6f |{.....th|eDataPro|
|00001410| 63 52 65 63 6f 72 64 20 | 3d 20 4e 55 4c 4c 3b 0d |cRecord |= NULL;.|
|00001420| 09 09 09 09 0d 09 09 09 | 09 2f 2f 20 74 68 69 73 |........|.// this|
|00001430| 20 77 69 6c 6c 20 62 65 | 20 75 73 65 64 20 69 6e | will be| used in|
|00001440| 20 46 44 65 63 6f 6d 70 | 72 65 73 73 49 6d 61 67 | FDecomp|ressImag|
|00001450| 65 20 6f 72 20 53 74 64 | 50 69 78 20 73 69 6e 63 |e or Std|Pix sinc|
|00001460| 65 20 77 65 20 61 72 65 | 6e 27 74 20 75 73 69 6e |e we are|n't usin|
|00001470| 67 20 61 0d 09 09 09 09 | 2f 2f 20 64 61 74 61 20 |g a.....|// data |
|00001480| 6c 6f 61 64 69 6e 67 20 | 70 72 6f 63 2e 0d 09 09 |loading |proc....|
|00001490| 09 09 74 68 65 41 6d 6f | 75 6e 74 54 6f 52 65 61 |..theAmo|untToRea|
|000014a0| 64 20 3d 20 30 3b 0d 09 | 09 09 7d 65 6c 73 65 7b |d = 0;..|..}else{|
|000014b0| 09 09 09 09 0d 09 09 09 | 09 2f 2f 20 57 65 20 63 |........|.// We c|
|000014c0| 6f 6d 65 20 68 65 72 65 | 20 69 66 20 77 65 20 6e |ome here| if we n|
|000014d0| 65 65 64 20 74 6f 20 75 | 73 65 20 61 20 64 61 74 |eed to u|se a dat|
|000014e0| 61 20 6c 6f 61 64 69 6e | 67 20 70 72 6f 63 2e 20 |a loadin|g proc. |
|000014f0| 42 79 20 73 65 74 74 69 | 6e 67 20 74 68 65 44 61 |By setti|ng theDa|
|00001500| 74 61 50 72 6f 63 52 65 | 63 6f 72 64 0d 09 09 09 |taProcRe|cord....|
|00001510| 09 2f 2f 20 74 6f 20 6f | 75 72 20 49 43 4d 44 61 |.// to o|ur ICMDa|
|00001520| 74 61 50 72 6f 63 52 65 | 63 6f 72 64 20 77 65 20 |taProcRe|cord we |
|00001530| 77 69 6c 6c 20 75 73 65 | 20 74 68 65 20 64 61 74 |will use| the dat|
|00001540| 61 20 6c 6f 61 64 69 6e | 67 20 70 72 6f 63 20 77 |a loadin|g proc w|
|00001550| 65 27 76 65 20 73 65 74 | 20 75 70 2e 0d 09 09 09 |e've set| up.....|
|00001560| 09 0d 09 09 09 09 74 68 | 65 44 61 74 61 50 72 6f |......th|eDataPro|
|00001570| 63 52 65 63 6f 72 64 20 | 3d 20 26 67 54 68 65 49 |cRecord |= &gTheI|
|00001580| 43 4d 44 61 74 61 50 72 | 6f 63 52 65 63 6f 72 64 |CMDataPr|ocRecord|
|00001590| 3b 0d 09 09 09 7d 0d 09 | 09 09 0d 09 09 09 69 66 |;....}..|......if|
|000015a0| 28 69 73 43 6f 6c 6f 72 | 50 6f 72 74 29 7b 09 09 |(isColor|Port){..|
|000015b0| 09 09 09 0d 09 09 09 09 | 4d 61 74 72 69 78 52 65 |........|MatrixRe|
|000015c0| 63 6f 72 64 20 74 68 65 | 4d 61 74 72 69 78 3b 0d |cord the|Matrix;.|
|000015d0| 09 09 09 09 43 51 44 50 | 72 6f 63 73 20 6d 79 53 |....CQDP|rocs myS|
|000015e0| 74 64 50 72 6f 63 73 3b | 0d 09 09 09 09 53 74 64 |tdProcs;|.....Std|
|000015f0| 50 69 78 50 72 6f 63 50 | 74 72 20 4d 79 50 72 6f |PixProcP|tr MyPro|
|00001600| 63 50 74 72 3b 0d 09 09 | 09 09 2f 2f 20 73 65 74 |cPtr;...|..// set|
|00001610| 20 62 6f 74 68 20 66 6c | 61 67 20 62 69 74 73 20 | both fl|ag bits |
|00001620| 64 65 73 63 72 69 62 65 | 64 20 69 6e 20 49 4d 20 |describe|d in IM |
|00001630| 51 75 69 63 6b 54 69 6d | 65 20 70 2e 33 2d 31 33 |QuickTim|e p.3-13|
|00001640| 39 20 66 6f 72 20 53 74 | 64 50 69 78 0d 09 09 09 |9 for St|dPix....|
|00001650| 09 73 68 6f 72 74 20 66 | 6c 61 67 73 20 3d 20 6b |.short f|lags = k|
|00001660| 43 61 6c 6c 4f 6c 64 42 | 69 74 73 20 7c 20 6b 43 |CallOldB|its | kC|
|00001670| 61 6c 6c 53 74 64 42 69 | 74 73 3b 09 09 0d 09 0d |allStdBi|ts;.....|
|00001680| 09 09 09 09 2f 2f 20 77 | 65 20 6e 65 65 64 20 61 |....// w|e need a|
|00001690| 20 70 69 78 6d 61 70 20 | 66 6f 72 20 6f 75 72 20 | pixmap |for our |
|000016a0| 63 61 6c 6c 20 74 6f 20 | 74 68 65 20 53 74 64 50 |call to |the StdP|
|000016b0| 69 78 20 62 6f 74 74 6c | 65 6e 65 63 6b 0d 09 09 |ix bottl|eneck...|
|000016c0| 09 09 50 69 78 4d 61 70 | 48 61 6e 64 6c 65 20 53 |..PixMap|Handle S|
|000016d0| 70 65 63 69 61 6c 50 69 | 78 4d 61 70 48 20 3d 20 |pecialPi|xMapH = |
|000016e0| 4e 65 77 50 69 78 4d 61 | 70 28 29 3b 0d 09 09 09 |NewPixMa|p();....|
|000016f0| 09 50 69 78 4d 61 70 50 | 74 72 20 53 70 65 63 69 |.PixMapP|tr Speci|
|00001700| 61 6c 50 69 78 4d 61 70 | 50 3b 0d 09 09 0d 09 09 |alPixMap|P;......|
|00001710| 09 09 69 66 28 53 70 65 | 63 69 61 6c 50 69 78 4d |..if(Spe|cialPixM|
|00001720| 61 70 48 20 21 3d 20 4e | 55 4c 4c 20 26 26 20 4d |apH != N|ULL && M|
|00001730| 65 6d 45 72 72 6f 72 28 | 29 20 3d 3d 20 6e 6f 45 |emError(|) == noE|
|00001740| 72 72 29 7b 0d 09 0d 09 | 09 09 09 09 4d 6f 76 65 |rr){....|....Move|
|00001750| 48 48 69 28 28 48 61 6e | 64 6c 65 29 53 70 65 63 |HHi((Han|dle)Spec|
|00001760| 69 61 6c 50 69 78 4d 61 | 70 48 29 3b 0d 09 09 09 |ialPixMa|pH);....|
|00001770| 09 09 48 4c 6f 63 6b 28 | 28 48 61 6e 64 6c 65 29 |..HLock(|(Handle)|
|00001780| 53 70 65 63 69 61 6c 50 | 69 78 4d 61 70 48 29 3b |SpecialP|ixMapH);|
|00001790| 0d 09 09 09 09 0d 09 09 | 09 09 09 53 70 65 63 69 |........|...Speci|
|000017a0| 61 6c 50 69 78 4d 61 70 | 50 20 3d 20 28 50 69 78 |alPixMap|P = (Pix|
|000017b0| 4d 61 70 50 74 72 29 53 | 74 72 69 70 41 64 64 72 |MapPtr)S|tripAddr|
|000017c0| 65 73 73 28 2a 28 48 61 | 6e 64 6c 65 29 53 70 65 |ess(*(Ha|ndle)Spe|
|000017d0| 63 69 61 6c 50 69 78 4d | 61 70 48 29 3b 0d 09 09 |cialPixM|apH);...|
|000017e0| 09 09 09 0d 09 09 09 09 | 09 2f 2f 20 6d 61 6b 65 |........|.// make|
|000017f0| 20 61 20 6d 61 74 72 69 | 78 20 77 68 69 63 68 20 | a matri|x which |
|00001800| 64 65 73 63 72 69 62 65 | 73 20 74 68 65 20 6d 61 |describe|s the ma|
|00001810| 70 70 69 6e 67 20 62 65 | 74 77 65 65 6e 20 74 68 |pping be|tween th|
|00001820| 65 20 73 6f 75 72 63 65 | 0d 09 09 09 09 09 2f 2f |e source|......//|
|00001830| 20 61 6e 64 20 64 65 73 | 74 69 6e 61 74 69 6f 6e | and des|tination|
|00001840| 20 72 65 63 74 61 6e 67 | 6c 65 73 2e 20 49 6e 20 | rectang|les. In |
|00001850| 6f 75 72 20 63 61 73 65 | 2c 20 74 68 65 79 20 77 |our case|, they w|
|00001860| 69 6c 6c 20 62 65 20 74 | 68 65 0d 09 09 09 09 09 |ill be t|he......|
|00001870| 2f 2f 20 73 61 6d 65 20 | 72 65 63 74 61 6e 67 6c |// same |rectangl|
|00001880| 65 0d 09 0d 09 09 09 09 | 09 52 65 63 74 4d 61 74 |e.......|.RectMat|
|00001890| 72 69 78 28 26 74 68 65 | 4d 61 74 72 69 78 2c 20 |rix(&the|Matrix, |
|000018a0| 26 73 72 63 52 65 63 74 | 2c 20 26 73 72 63 52 65 |&srcRect|, &srcRe|
|000018b0| 63 74 29 3b 0d 09 09 09 | 09 09 0d 09 09 09 09 09 |ct);....|........|
|000018c0| 2f 2f 20 53 65 74 43 6f | 6d 70 72 65 73 73 65 64 |// SetCo|mpressed|
|000018d0| 50 69 78 4d 61 70 49 6e | 66 6f 20 6d 61 6b 65 73 |PixMapIn|fo makes|
|000018e0| 20 61 20 63 6f 6d 70 72 | 65 73 73 65 64 20 27 50 | a compr|essed 'P|
|000018f0| 69 78 4d 61 70 27 20 73 | 74 72 75 63 74 75 72 65 |ixMap' s|tructure|
|00001900| 20 69 6e 74 6f 20 53 70 | 65 63 69 61 6c 50 69 78 | into Sp|ecialPix|
|00001910| 4d 61 70 50 2c 20 75 73 | 69 6e 67 20 0d 09 09 09 |MapP, us|ing ....|
|00001920| 09 09 2f 2f 20 74 68 65 | 20 49 6d 61 67 65 44 65 |..// the| ImageDe|
|00001930| 73 63 72 69 70 74 69 6f | 6e 20 69 6e 20 27 74 68 |scriptio|n in 'th|
|00001940| 65 44 65 73 63 27 20 77 | 69 74 68 20 74 68 65 20 |eDesc' w|ith the |
|00001950| 63 6f 6d 70 72 65 73 73 | 65 64 20 69 6d 61 67 65 |compress|ed image|
|00001960| 20 64 61 74 61 20 69 6e | 20 27 74 68 65 44 61 74 | data in| 'theDat|
|00001970| 61 50 74 72 27 0d 09 09 | 09 09 09 0d 09 09 09 09 |aPtr'...|........|
|00001980| 09 2f 2f 20 57 65 27 76 | 65 20 73 65 74 20 74 68 |.// We'v|e set th|
|00001990| 69 73 20 75 70 20 73 6f | 20 69 66 20 61 6c 6c 20 |is up so| if all |
|000019a0| 74 68 65 20 64 61 74 61 | 20 69 73 20 69 6e 20 6d |the data| is in m|
|000019b0| 65 6d 6f 72 79 20 74 68 | 65 6e 20 74 68 65 41 6d |emory th|en theAm|
|000019c0| 6f 75 6e 74 54 6f 52 65 | 61 64 20 69 73 20 7a 65 |ountToRe|ad is ze|
|000019d0| 72 6f 0d 09 09 09 09 09 | 2f 2f 20 61 6e 64 20 74 |ro......|// and t|
|000019e0| 68 65 44 61 74 61 50 72 | 6f 63 52 65 63 6f 72 64 |heDataPr|ocRecord|
|000019f0| 20 69 73 20 4e 55 4c 4c | 2e 20 49 66 20 77 65 20 | is NULL|. If we |
|00001a00| 6e 65 65 64 20 74 6f 20 | 75 73 65 20 61 20 64 61 |need to |use a da|
|00001a10| 74 61 6c 6f 61 64 69 6e | 67 20 70 72 6f 63 2c 20 |taloadin|g proc, |
|00001a20| 74 68 65 6e 0d 09 09 09 | 09 09 2f 2f 20 74 68 65 |then....|..// the|
|00001a30| 41 6d 6f 75 6e 74 54 6f | 52 65 61 64 20 69 73 20 |AmountTo|Read is |
|00001a40| 74 68 65 20 73 69 7a 65 | 20 6f 66 20 6f 75 72 20 |the size| of our |
|00001a50| 62 75 66 66 65 72 20 61 | 6e 64 20 74 68 65 44 61 |buffer a|nd theDa|
|00001a60| 74 61 50 72 6f 63 52 65 | 63 6f 72 64 20 69 73 20 |taProcRe|cord is |
|00001a70| 6f 75 72 20 49 43 4d 44 | 61 74 61 50 72 6f 63 52 |our ICMD|ataProcR|
|00001a80| 65 63 6f 72 64 2e 0d 09 | 09 0d 09 09 09 09 09 74 |ecord...|.......t|
|00001a90| 68 65 45 72 72 20 3d 20 | 53 65 74 43 6f 6d 70 72 |heErr = |SetCompr|
|00001aa0| 65 73 73 65 64 50 69 78 | 4d 61 70 49 6e 66 6f 28 |essedPix|MapInfo(|
|00001ab0| 53 70 65 63 69 61 6c 50 | 69 78 4d 61 70 50 2c 20 |SpecialP|ixMapP, |
|00001ac0| 74 68 65 44 65 73 63 2c | 20 74 68 65 44 61 74 61 |theDesc,| theData|
|00001ad0| 50 74 72 2c 20 74 68 65 | 41 6d 6f 75 6e 74 54 6f |Ptr, the|AmountTo|
|00001ae0| 52 65 61 64 2c 74 68 65 | 44 61 74 61 50 72 6f 63 |Read,the|DataProc|
|00001af0| 52 65 63 6f 72 64 2c 4e | 55 4c 4c 29 3b 0d 09 09 |Record,N|ULL);...|
|00001b00| 09 09 09 0d 09 09 09 09 | 09 69 66 28 74 68 65 45 |........|.if(theE|
|00001b10| 72 72 20 3d 3d 20 6e 6f | 45 72 72 29 7b 0d 09 09 |rr == no|Err){...|
|00001b20| 09 09 09 09 2f 2f 20 4c | 6f 6f 6b 20 74 6f 20 73 |....// L|ook to s|
|00001b30| 65 65 20 69 66 20 74 68 | 65 72 65 20 61 72 65 20 |ee if th|ere are |
|00001b40| 63 75 73 74 6f 6d 20 51 | 75 69 63 6b 44 72 61 77 |custom Q|uickDraw|
|00001b50| 20 62 6f 74 74 6c 65 6e | 65 63 6b 73 20 69 6e 20 | bottlen|ecks in |
|00001b60| 74 68 65 20 63 75 72 72 | 65 6e 74 20 70 6f 72 74 |the curr|ent port|
|00001b70| 2e 0d 09 09 09 09 09 09 | 69 66 28 20 28 28 28 43 |........|if( (((C|
|00001b80| 47 72 61 66 50 74 72 29 | 71 64 2e 74 68 65 50 6f |GrafPtr)|qd.thePo|
|00001b90| 72 74 29 2d 3e 67 72 61 | 66 50 72 6f 63 73 29 20 |rt)->gra|fProcs) |
|00001ba0| 3d 3d 20 4e 55 4c 4c 29 | 0d 09 09 09 09 09 09 7b |== NULL)|.......{|
|00001bb0| 0d 09 09 09 09 09 09 09 | 2f 2f 20 47 65 74 20 74 |........|// Get t|
|00001bc0| 68 65 20 53 74 61 6e 64 | 61 72 64 20 42 6f 74 74 |he Stand|ard Bott|
|00001bd0| 6c 65 6e 65 63 6b 20 70 | 72 6f 63 73 2e 20 0d 09 |leneck p|rocs. ..|
|00001be0| 09 09 09 09 09 09 53 65 | 74 53 74 64 43 50 72 6f |......Se|tStdCPro|
|00001bf0| 63 73 28 26 6d 79 53 74 | 64 50 72 6f 63 73 29 3b |cs(&mySt|dProcs);|
|00001c00| 0d 09 09 09 09 09 09 09 | 0d 09 09 09 09 09 09 09 |........|........|
|00001c10| 2f 2f 20 54 68 65 20 27 | 6e 65 77 50 72 6f 63 31 |// The '|newProc1|
|00001c20| 27 20 62 6f 74 74 6c 65 | 6e 65 63 6b 20 69 73 20 |' bottle|neck is |
|00001c30| 74 68 65 20 27 53 74 64 | 50 69 78 27 20 62 6f 74 |the 'Std|Pix' bot|
|00001c40| 74 6c 65 6e 65 63 6b 2e | 0d 09 09 09 09 09 09 09 |tleneck.|........|
|00001c50| 4d 79 50 72 6f 63 50 74 | 72 20 3d 20 28 53 74 64 |MyProcPt|r = (Std|
|00001c60| 50 69 78 50 72 6f 63 50 | 74 72 29 6d 79 53 74 64 |PixProcP|tr)myStd|
|00001c70| 50 72 6f 63 73 2e 6e 65 | 77 50 72 6f 63 31 3b 0d |Procs.ne|wProc1;.|
|00001c80| 09 09 09 09 09 09 09 0d | 09 09 09 09 09 09 7d 65 |........|......}e|
|00001c90| 6c 73 65 7b 0d 09 09 09 | 09 09 09 09 2f 2f 20 55 |lse{....|....// U|
|00001ca0| 73 65 20 74 68 65 20 63 | 75 73 74 6f 6d 20 27 53 |se the c|ustom 'S|
|00001cb0| 74 64 50 69 78 27 20 62 | 6f 74 74 6c 65 6e 65 63 |tdPix' b|ottlenec|
|00001cc0| 6b 20 69 6e 20 74 68 65 | 20 67 72 61 66 50 6f 72 |k in the| grafPor|
|00001cd0| 74 2e 0d 09 09 09 09 09 | 09 09 2f 2f 20 54 68 65 |t.......|..// The|
|00001ce0| 20 27 6e 65 77 50 72 6f | 63 31 27 20 62 6f 74 74 | 'newPro|c1' bott|
|00001cf0| 6c 65 6e 65 63 6b 20 69 | 73 20 74 68 65 20 27 53 |leneck i|s the 'S|
|00001d00| 74 64 50 69 78 27 20 62 | 6f 74 74 6c 65 6e 65 63 |tdPix' b|ottlenec|
|00001d10| 6b 2e 0d 09 0d 09 09 09 | 09 09 09 09 4d 79 50 72 |k.......|....MyPr|
|00001d20| 6f 63 50 74 72 20 3d 20 | 28 53 74 64 50 69 78 50 |ocPtr = |(StdPixP|
|00001d30| 72 6f 63 50 74 72 29 28 | 28 43 47 72 61 66 50 74 |rocPtr)(|(CGrafPt|
|00001d40| 72 29 71 64 2e 74 68 65 | 50 6f 72 74 29 2d 3e 67 |r)qd.the|Port)->g|
|00001d50| 72 61 66 50 72 6f 63 73 | 2d 3e 6e 65 77 50 72 6f |rafProcs|->newPro|
|00001d60| 63 31 3b 0d 09 09 09 09 | 09 09 7d 0d 09 09 09 09 |c1;.....|..}.....|
|00001d70| 09 09 0d 09 09 09 09 09 | 09 2f 2f 20 43 61 6c 6c |........|.// Call|
|00001d80| 20 74 68 65 20 62 6f 74 | 74 6c 65 6e 65 63 6b 2e | the bot|tleneck.|
|00001d90| 20 54 68 65 20 66 75 6e | 63 74 69 6f 6e 20 63 61 | The fun|ction ca|
|00001da0| 6c 6c 20 62 65 69 6e 67 | 20 75 73 65 64 20 68 65 |ll being| used he|
|00001db0| 72 65 20 69 73 3a 0d 09 | 09 09 09 09 09 2f 2f 20 |re is:..|.....// |
|00001dc0| 53 74 64 50 69 78 28 53 | 70 65 63 69 61 6c 50 69 |StdPix(S|pecialPi|
|00001dd0| 78 4d 61 70 50 2c 20 26 | 73 72 63 52 65 63 74 2c |xMapP, &|srcRect,|
|00001de0| 20 26 74 68 65 4d 61 74 | 72 69 78 2c 20 64 69 74 | &theMat|rix, dit|
|00001df0| 68 65 72 43 6f 70 79 2c | 20 4e 55 4c 4c 2c 20 4e |herCopy,| NULL, N|
|00001e00| 55 4c 4c 2c 4e 55 4c 4c | 2c 66 6c 61 67 73 29 0d |ULL,NULL|,flags).|
|00001e10| 09 09 09 09 09 09 2f 2f | 20 77 69 74 68 20 74 68 |......//| with th|
|00001e20| 65 20 61 70 70 72 6f 70 | 72 69 61 74 65 20 53 74 |e approp|riate St|
|00001e30| 64 50 69 78 20 62 6f 74 | 74 6c 65 6e 65 63 6b 2e |dPix bot|tleneck.|
|00001e40| 0d 09 09 09 09 09 09 20 | 0d 09 09 09 09 09 09 43 |....... |.......C|
|00001e50| 61 6c 6c 53 74 64 50 69 | 78 50 72 6f 63 28 4d 79 |allStdPi|xProc(My|
|00001e60| 50 72 6f 63 50 74 72 2c | 53 70 65 63 69 61 6c 50 |ProcPtr,|SpecialP|
|00001e70| 69 78 4d 61 70 50 2c 20 | 26 73 72 63 52 65 63 74 |ixMapP, |&srcRect|
|00001e80| 2c 20 26 74 68 65 4d 61 | 74 72 69 78 2c 20 0d 09 |, &theMa|trix, ..|
|00001e90| 09 09 09 09 09 09 64 69 | 74 68 65 72 43 6f 70 79 |......di|therCopy|
|00001ea0| 2c 20 4e 55 4c 4c 2c 20 | 4e 55 4c 4c 2c 4e 55 4c |, NULL, |NULL,NUL|
|00001eb0| 4c 2c 66 6c 61 67 73 20 | 29 3b 0d 09 09 09 09 09 |L,flags |);......|
|00001ec0| 7d 0d 09 09 09 09 09 48 | 55 6e 6c 6f 63 6b 28 28 |}......H|Unlock((|
|00001ed0| 48 61 6e 64 6c 65 29 53 | 70 65 63 69 61 6c 50 69 |Handle)S|pecialPi|
|00001ee0| 78 4d 61 70 48 29 3b 0d | 09 09 09 09 7d 0d 09 09 |xMapH);.|....}...|
|00001ef0| 09 09 69 66 28 53 70 65 | 63 69 61 6c 50 69 78 4d |..if(Spe|cialPixM|
|00001f00| 61 70 48 29 44 69 73 70 | 6f 73 65 50 69 78 4d 61 |apH)Disp|osePixMa|
|00001f10| 70 28 53 70 65 63 69 61 | 6c 50 69 78 4d 61 70 48 |p(Specia|lPixMapH|
|00001f20| 29 3b 0d 09 09 09 7d 65 | 6c 73 65 7b 0d 09 09 09 |);....}e|lse{....|
|00001f30| 09 2f 2f 20 43 6f 6d 65 | 20 68 65 72 65 20 66 6f |.// Come| here fo|
|00001f40| 72 20 61 20 42 26 57 20 | 70 6f 72 74 20 73 69 6e |r a B&W |port sin|
|00001f50| 63 65 20 74 68 65 72 65 | 20 69 73 20 6e 6f 20 53 |ce there| is no S|
|00001f60| 74 64 50 69 78 20 62 6f | 74 74 6c 65 6e 65 63 6b |tdPix bo|ttleneck|
|00001f70| 20 66 6f 72 20 61 20 42 | 26 57 20 67 72 61 66 70 | for a B|&W grafp|
|00001f80| 6f 72 74 2e 20 0d 09 09 | 09 09 2f 2f 20 42 79 20 |ort. ...|..// By |
|00001f90| 64 65 66 69 6e 69 74 69 | 6f 6e 20 74 68 65 72 65 |definiti|on there|
|00001fa0| 20 69 73 6e 27 74 20 61 | 20 63 75 73 74 6f 6d 20 | isn't a| custom |
|00001fb0| 53 74 64 50 69 78 20 62 | 6f 74 74 6c 65 6e 65 63 |StdPix b|ottlenec|
|00001fc0| 6b 20 69 6e 20 61 20 42 | 26 57 20 67 72 61 66 70 |k in a B|&W grafp|
|00001fd0| 6f 72 74 2e 20 0d 09 09 | 09 09 2f 2f 20 57 65 27 |ort. ...|..// We'|
|00001fe0| 6c 6c 20 6c 65 74 20 51 | 75 69 63 6b 54 69 6d 65 |ll let Q|uickTime|
|00001ff0| 20 66 69 67 75 72 65 20 | 6f 75 74 20 68 6f 77 20 | figure |out how |
|00002000| 74 6f 20 68 61 6e 64 6c | 65 20 74 68 69 73 20 63 |to handl|e this c|
|00002010| 61 73 65 2e 20 0d 09 09 | 09 09 43 6f 64 65 63 43 |ase. ...|..CodecC|
|00002020| 6f 6d 70 6f 6e 65 6e 74 | 20 74 68 65 43 6f 64 65 |omponent| theCode|
|00002030| 63 3b 0d 09 09 09 09 0d | 09 09 09 09 69 66 20 28 |c;......|....if (|
|00002040| 20 74 68 65 45 72 72 20 | 3d 3d 20 6e 6f 45 72 72 | theErr |== noErr|
|00002050| 29 20 7b 0d 09 09 09 09 | 09 43 6f 64 65 63 49 6e |) {.....|.CodecIn|
|00002060| 66 6f 20 74 68 65 49 6e | 66 6f 3b 0d 09 09 09 09 |fo theIn|fo;.....|
|00002070| 09 0d 09 09 09 09 09 2f | 2f 20 75 73 65 20 74 68 |......./|/ use th|
|00002080| 65 20 62 65 73 74 46 69 | 64 65 6c 69 74 79 43 6f |e bestFi|delityCo|
|00002090| 64 65 63 20 69 66 20 69 | 74 20 69 73 20 61 76 61 |dec if i|t is ava|
|000020a0| 69 6c 61 62 6c 65 2c 20 | 6f 74 68 65 72 77 69 73 |ilable, |otherwis|
|000020b0| 65 20 6a 75 73 74 20 75 | 73 65 20 61 6e 79 0d 09 |e just u|se any..|
|000020c0| 09 09 09 09 74 68 65 45 | 72 72 20 3d 20 47 65 74 |....theE|rr = Get|
|000020d0| 43 6f 64 65 63 49 6e 66 | 6f 28 26 74 68 65 49 6e |CodecInf|o(&theIn|
|000020e0| 66 6f 2c 20 27 6a 70 65 | 67 27 2c 20 62 65 73 74 |fo, 'jpe|g', best|
|000020f0| 46 69 64 65 6c 69 74 79 | 43 6f 64 65 63 29 3b 20 |Fidelity|Codec); |
|00002100| 0d 09 09 09 09 69 66 28 | 74 68 65 45 72 72 20 3d |.....if(|theErr =|
|00002110| 3d 20 6e 6f 45 72 72 29 | 7b 0d 09 09 09 09 09 74 |= noErr)|{......t|
|00002120| 68 65 43 6f 64 65 63 20 | 3d 20 62 65 73 74 46 69 |heCodec |= bestFi|
|00002130| 64 65 6c 69 74 79 43 6f | 64 65 63 3b 0d 09 09 09 |delityCo|dec;....|
|00002140| 09 7d 65 6c 73 65 0d 09 | 09 09 09 09 2f 2f 20 77 |.}else..|....// w|
|00002150| 65 20 6b 6e 6f 77 20 74 | 68 69 73 20 43 6f 64 65 |e know t|his Code|
|00002160| 63 20 65 78 69 73 74 73 | 20 62 65 63 61 75 73 65 |c exists| because|
|00002170| 20 61 74 20 73 74 61 72 | 74 75 70 20 77 65 20 63 | at star|tup we c|
|00002180| 68 65 63 6b 65 64 20 69 | 6e 20 74 68 65 20 49 6e |hecked i|n the In|
|00002190| 69 74 4d 61 63 69 6e 74 | 6f 73 68 20 70 72 6f 63 |itMacint|osh proc|
|000021a0| 0d 09 09 09 09 09 74 68 | 65 43 6f 64 65 63 20 3d |......th|eCodec =|
|000021b0| 20 61 6e 79 43 6f 64 65 | 63 3b 09 0d 09 09 09 09 | anyCode|c;......|
|000021c0| 7d 0d 09 0d 09 09 09 09 | 74 68 65 45 72 72 20 3d |}.......|theErr =|
|000021d0| 20 46 44 65 63 6f 6d 70 | 72 65 73 73 49 6d 61 67 | FDecomp|ressImag|
|000021e0| 65 28 74 68 65 44 61 74 | 61 50 74 72 2c 20 74 68 |e(theDat|aPtr, th|
|000021f0| 65 44 65 73 63 2c 20 0d | 09 09 09 09 09 09 09 09 |eDesc, .|........|
|00002200| 64 50 69 78 4d 61 70 2c | 20 26 73 72 63 52 65 63 |dPixMap,| &srcRec|
|00002210| 74 2c 20 4e 55 4c 4c 2c | 20 64 69 74 68 65 72 43 |t, NULL,| ditherC|
|00002220| 6f 70 79 2c 0d 09 09 09 | 09 09 09 09 09 4e 55 4c |opy,....|.....NUL|
|00002230| 4c 2c 20 4e 55 4c 4c 2c | 20 4e 55 4c 4c 2c 20 63 |L, NULL,| NULL, c|
|00002240| 6f 64 65 63 4d 61 78 51 | 75 61 6c 69 74 79 2c 20 |odecMaxQ|uality, |
|00002250| 74 68 65 43 6f 64 65 63 | 2c 20 74 68 65 41 6d 6f |theCodec|, theAmo|
|00002260| 75 6e 74 54 6f 52 65 61 | 64 2c 74 68 65 44 61 74 |untToRea|d,theDat|
|00002270| 61 50 72 6f 63 52 65 63 | 6f 72 64 2c 20 4e 55 4c |aProcRec|ord, NUL|
|00002280| 4c 29 3b 09 09 09 0d 09 | 09 09 7d 0d 09 09 7d 0d |L);.....|..}...}.|
|00002290| 09 09 48 53 65 74 53 74 | 61 74 65 28 74 68 65 44 |..HSetSt|ate(theD|
|000022a0| 61 74 61 48 61 6e 64 6c | 65 2c 20 68 53 74 61 74 |ataHandl|e, hStat|
|000022b0| 65 29 3b 0d 09 09 72 65 | 74 75 72 6e 20 74 68 65 |e);...re|turn the|
|000022c0| 45 72 72 3b 0d 09 7d 0d | 7d 09 2f 2a 20 44 72 61 |Err;..}.|}./* Dra|
|000022d0| 77 4a 50 45 47 49 6d 61 | 67 65 20 2a 2f 0d 0d 0d |wJPEGIma|ge */...|
|000022e0| 73 74 61 74 69 63 20 76 | 6f 69 64 20 44 6f 54 68 |static v|oid DoTh|
|000022f0| 65 4f 70 65 6e 43 6f 6d | 6d 61 6e 64 28 29 0d 7b |eOpenCom|mand().{|
|00002300| 0d 4f 53 45 72 72 20 74 | 68 65 45 72 72 20 3d 20 |.OSErr t|heErr = |
|00002310| 6e 6f 45 72 72 3b 0d 4f | 53 54 79 70 65 20 74 68 |noErr;.O|SType th|
|00002320| 65 54 79 70 65 73 5b 5d | 20 3d 20 7b 20 27 4a 50 |eTypes[]| = { 'JP|
|00002330| 45 47 27 20 7d 3b 0d 53 | 74 61 6e 64 61 72 64 46 |EG' };.S|tandardF|
|00002340| 69 6c 65 52 65 70 6c 79 | 20 74 68 65 52 65 70 6c |ileReply| theRepl|
|00002350| 79 3b 0d 52 65 63 74 20 | 62 6f 75 6e 64 73 3b 0d |y;.Rect |bounds;.|
|00002360| 53 49 6e 74 31 36 20 77 | 69 6e 64 6f 77 54 6f 70 |SInt16 w|indowTop|
|00002370| 20 3d 20 47 65 74 4d 42 | 61 72 48 65 69 67 68 74 | = GetMB|arHeight|
|00002380| 28 29 2b 20 31 39 3b 0d | 53 49 6e 74 31 36 20 72 |()+ 19;.|SInt16 r|
|00002390| 69 67 68 74 2c 62 6f 74 | 74 6f 6d 3b 0d 0d 09 2f |ight,bot|tom;.../|
|000023a0| 2f 20 63 68 65 63 6b 20 | 74 6f 20 73 65 65 20 69 |/ check |to see i|
|000023b0| 66 20 77 65 20 61 6c 72 | 65 61 64 79 20 68 61 76 |f we alr|eady hav|
|000023c0| 65 20 61 20 66 69 6c 65 | 20 72 65 66 65 72 65 6e |e a file| referen|
|000023d0| 63 65 2e 20 49 66 20 73 | 6f 2c 20 77 65 27 6c 6c |ce. If s|o, we'll|
|000023e0| 20 63 6c 6f 73 65 20 74 | 68 65 20 66 69 6c 65 20 | close t|he file |
|000023f0| 73 69 6e 63 65 20 77 65 | 27 72 65 20 67 6f 69 6e |since we|'re goin|
|00002400| 67 20 74 6f 20 6f 70 65 | 6e 20 61 20 6e 65 77 20 |g to ope|n a new |
|00002410| 6f 6e 65 2e 0d 09 69 66 | 28 20 67 54 68 65 4a 50 |one...if|( gTheJP|
|00002420| 45 47 49 6d 61 67 65 2e | 74 68 65 52 65 66 4e 75 |EGImage.|theRefNu|
|00002430| 6d 29 7b 0d 09 09 46 53 | 43 6c 6f 73 65 28 67 54 |m){...FS|Close(gT|
|00002440| 68 65 4a 50 45 47 49 6d | 61 67 65 2e 74 68 65 52 |heJPEGIm|age.theR|
|00002450| 65 66 4e 75 6d 29 3b 0d | 09 09 67 54 68 65 4a 50 |efNum);.|..gTheJP|
|00002460| 45 47 49 6d 61 67 65 2e | 74 68 65 52 65 66 4e 75 |EGImage.|theRefNu|
|00002470| 6d 20 3d 20 30 3b 0d 09 | 7d 0d 0d 09 2f 2f 20 64 |m = 0;..|}...// d|
|00002480| 69 73 61 62 6c 65 20 74 | 68 65 20 50 72 69 6e 74 |isable t|he Print|
|00002490| 20 6d 65 6e 75 20 69 74 | 65 6d 20 73 69 6e 63 65 | menu it|em since|
|000024a0| 20 77 65 20 63 61 6e 27 | 74 20 70 72 69 6e 74 20 | we can'|t print |
|000024b0| 64 61 74 61 20 61 6e 79 | 6d 6f 72 65 2e 0d 09 44 |data any|more...D|
|000024c0| 69 73 61 62 6c 65 49 74 | 65 6d 28 47 65 74 4d 48 |isableIt|em(GetMH|
|000024d0| 61 6e 64 6c 65 28 6b 46 | 69 6c 65 4d 65 6e 75 49 |andle(kF|ileMenuI|
|000024e0| 44 29 2c 20 6b 50 72 69 | 6e 74 43 6f 6d 6d 61 6e |D), kPri|ntComman|
|000024f0| 64 29 3b 0d 0d 09 2f 2f | 20 48 69 64 65 20 74 68 |d);...//| Hide th|
|00002500| 65 20 65 78 69 73 74 69 | 6e 67 20 77 69 6e 64 6f |e existi|ng windo|
|00002510| 77 2c 20 69 66 20 74 68 | 65 72 65 20 69 73 20 6f |w, if th|ere is o|
|00002520| 6e 65 2e 0d 09 69 66 28 | 67 54 68 65 57 69 6e 64 |ne...if(|gTheWind|
|00002530| 6f 77 20 21 3d 20 4e 55 | 4c 4c 29 48 69 64 65 57 |ow != NU|LL)HideW|
|00002540| 69 6e 64 6f 77 28 67 54 | 68 65 57 69 6e 64 6f 77 |indow(gT|heWindow|
|00002550| 29 3b 0d 0d 09 2f 2f 20 | 47 65 74 20 61 20 4a 50 |);...// |Get a JP|
|00002560| 45 47 20 66 69 6c 65 20 | 61 6e 64 20 72 65 61 64 |EG file |and read|
|00002570| 20 74 68 65 20 64 61 74 | 61 2e 0d 09 69 66 28 74 | the dat|a...if(t|
|00002580| 68 65 45 72 72 20 3d 3d | 20 6e 6f 45 72 72 29 7b |heErr ==| noErr){|
|00002590| 0d 09 09 53 74 61 6e 64 | 61 72 64 47 65 74 46 69 |...Stand|ardGetFi|
|000025a0| 6c 65 28 6e 69 6c 2c 20 | 31 2c 20 74 68 65 54 79 |le(nil, |1, theTy|
|000025b0| 70 65 73 2c 20 26 74 68 | 65 52 65 70 6c 79 29 3b |pes, &th|eReply);|
|000025c0| 0d 09 09 69 66 20 28 74 | 68 65 52 65 70 6c 79 2e |...if (t|heReply.|
|000025d0| 73 66 47 6f 6f 64 29 20 | 7b 0d 09 09 09 2f 2f 20 |sfGood) |{....// |
|000025e0| 4f 70 65 6e 20 74 68 65 | 20 46 69 6c 65 20 73 6f |Open the| File so|
|000025f0| 20 77 65 20 68 61 76 65 | 20 61 20 72 65 66 6e 75 | we have| a refnu|
|00002600| 6d 20 61 6e 64 20 72 65 | 61 64 20 69 74 0d 09 09 |m and re|ad it...|
|00002610| 09 74 68 65 45 72 72 20 | 3d 20 46 53 70 4f 70 65 |.theErr |= FSpOpe|
|00002620| 6e 44 46 28 26 74 68 65 | 52 65 70 6c 79 2e 73 66 |nDF(&the|Reply.sf|
|00002630| 46 69 6c 65 2c 20 66 73 | 52 64 50 65 72 6d 2c 20 |File, fs|RdPerm, |
|00002640| 26 67 54 68 65 4a 50 45 | 47 49 6d 61 67 65 2e 74 |&gTheJPE|GImage.t|
|00002650| 68 65 52 65 66 4e 75 6d | 29 3b 09 0d 09 09 09 0d |heRefNum|);......|
|00002660| 09 09 09 69 66 28 74 68 | 65 45 72 72 20 21 3d 20 |...if(th|eErr != |
|00002670| 6e 6f 45 72 72 29 7b 0d | 09 09 09 09 50 61 72 61 |noErr){.|....Para|
|00002680| 6d 54 65 78 74 28 22 5c | 70 43 61 6e 27 74 20 4f |mText("\|pCan't O|
|00002690| 70 65 6e 20 74 68 65 20 | 46 69 6c 65 22 2c 20 22 |pen the |File", "|
|000026a0| 5c 70 22 2c 20 22 5c 70 | 22 2c 20 22 5c 70 22 29 |\p", "\p|", "\p")|
|000026b0| 3b 0d 09 09 09 09 41 6c | 65 72 74 28 6b 47 65 6e |;.....Al|ert(kGen|
|000026c0| 65 72 69 63 45 72 72 6f | 72 2c 20 6e 69 6c 29 3b |ericErro|r, nil);|
|000026d0| 0d 09 09 09 09 72 65 74 | 75 72 6e 3b 09 0d 09 09 |.....ret|urn;....|
|000026e0| 09 7d 0d 0d 09 09 09 2f | 2f 20 53 65 74 20 74 68 |.}...../|/ Set th|
|000026f0| 65 20 66 69 6c 65 20 72 | 65 66 65 72 65 6e 63 65 |e file r|eference|
|00002700| 20 6e 75 6d 62 65 72 20 | 69 6e 20 74 68 65 20 6d | number |in the m|
|00002710| 79 44 61 74 61 4c 6f 61 | 64 20 73 74 72 75 63 74 |yDataLoa|d struct|
|00002720| 75 72 65 0d 09 09 09 2f | 2f 20 74 68 61 74 20 69 |ure..../|/ that i|
|00002730| 73 20 73 74 6f 72 65 64 | 20 69 6e 20 74 68 65 20 |s stored| in the |
|00002740| 64 61 74 61 52 65 66 43 | 6f 6e 20 66 69 65 6c 64 |dataRefC|on field|
|00002750| 20 6f 66 20 74 68 65 20 | 67 54 68 65 49 43 4d 44 | of the |gTheICMD|
|00002760| 61 74 61 50 72 6f 63 52 | 65 63 6f 72 64 2e 20 57 |ataProcR|ecord. W|
|00002770| 65 27 6c 6c 20 75 73 65 | 20 74 68 69 73 0d 09 09 |e'll use| this...|
|00002780| 09 2f 2f 20 69 66 20 77 | 65 20 6e 65 65 64 20 74 |.// if w|e need t|
|00002790| 6f 20 75 73 65 20 61 20 | 44 61 74 61 4c 6f 61 64 |o use a |DataLoad|
|000027a0| 69 6e 67 20 70 72 6f 63 | 20 66 6f 72 20 6f 75 72 |ing proc| for our|
|000027b0| 20 69 6d 61 67 65 2e 0d | 09 09 09 28 28 44 61 74 | image..|...((Dat|
|000027c0| 61 4c 6f 61 64 50 74 72 | 29 67 54 68 65 49 43 4d |aLoadPtr|)gTheICM|
|000027d0| 44 61 74 61 50 72 6f 63 | 52 65 63 6f 72 64 2e 64 |DataProc|Record.d|
|000027e0| 61 74 61 52 65 66 43 6f | 6e 29 2d 3e 74 68 65 52 |ataRefCo|n)->theR|
|000027f0| 65 66 4e 75 6d 20 3d 20 | 67 54 68 65 4a 50 45 47 |efNum = |gTheJPEG|
|00002800| 49 6d 61 67 65 2e 74 68 | 65 52 65 66 4e 75 6d 3b |Image.th|eRefNum;|
|00002810| 0d 0d 09 09 7d 65 6c 73 | 65 20 7b 0d 09 09 09 2f |....}els|e {..../|
|00002820| 2f 20 6e 6f 20 66 69 6c | 65 20 73 65 6c 65 63 74 |/ no fil|e select|
|00002830| 65 64 20 73 6f 20 6a 75 | 73 74 20 72 65 74 75 72 |ed so ju|st retur|
|00002840| 6e 2e 0d 09 09 09 72 65 | 74 75 72 6e 3b 0d 09 09 |n.....re|turn;...|
|00002850| 7d 3b 0d 09 7d 3b 0d 0d | 09 2f 2f 20 4d 61 6b 65 |};..};..|.// Make|
|00002860| 20 61 20 4a 50 45 47 20 | 49 6d 61 67 65 20 44 65 | a JPEG |Image De|
|00002870| 73 63 72 69 70 74 69 6f | 6e 20 66 6f 72 20 74 68 |scriptio|n for th|
|00002880| 65 20 63 75 72 72 65 6e | 74 20 69 6d 61 67 65 2e |e curren|t image.|
|00002890| 0d 09 69 66 20 28 74 68 | 65 45 72 72 20 3d 3d 20 |..if (th|eErr == |
|000028a0| 6e 6f 45 72 72 29 20 74 | 68 65 45 72 72 20 3d 20 |noErr) t|heErr = |
|000028b0| 4d 61 6b 65 4a 50 45 47 | 49 6d 61 67 65 44 65 73 |MakeJPEG|ImageDes|
|000028c0| 63 72 69 70 74 69 6f 6e | 28 26 67 54 68 65 4a 50 |cription|(&gTheJP|
|000028d0| 45 47 49 6d 61 67 65 29 | 3b 0d 09 0d 09 69 66 28 |EGImage)|;....if(|
|000028e0| 74 68 65 45 72 72 20 3d | 3d 20 69 4e 6f 74 4a 50 |theErr =|= iNotJP|
|000028f0| 45 47 44 61 74 61 29 7b | 0d 09 09 50 61 72 61 6d |EGData){|...Param|
|00002900| 54 65 78 74 28 0d 09 09 | 22 5c 70 54 68 65 20 73 |Text(...|"\pThe s|
|00002910| 65 6c 65 63 74 65 64 20 | 66 69 6c 65 20 65 69 74 |elected |file eit|
|00002920| 68 65 72 20 64 6f 65 73 | 6e 27 74 20 63 6f 6e 74 |her does|n't cont|
|00002930| 61 69 6e 20 4a 50 45 47 | 20 64 61 74 61 20 6f 72 |ain JPEG| data or|
|00002940| 20 61 20 4a 50 45 47 20 | 76 65 72 73 69 6f 6e 20 | a JPEG |version |
|00002950| 74 68 61 74 20 63 61 6e | 27 74 20 62 65 20 72 65 |that can|'t be re|
|00002960| 61 64 20 62 79 20 74 68 | 69 73 20 70 72 6f 67 72 |ad by th|is progr|
|00002970| 61 6d 2e 22 0d 09 09 2c | 20 22 5c 70 22 2c 20 22 |am."...,| "\p", "|
|00002980| 5c 70 22 2c 20 22 5c 70 | 22 29 3b 0d 09 09 41 6c |\p", "\p|");...Al|
|00002990| 65 72 74 28 6b 47 65 6e | 65 72 69 63 45 72 72 6f |ert(kGen|ericErro|
|000029a0| 72 2c 20 4e 55 4c 4c 29 | 3b 09 0d 0d 09 7d 0d 09 |r, NULL)|;....}..|
|000029b0| 0d 09 2f 2f 20 53 65 74 | 20 74 68 65 20 62 6f 75 |..// Set| the bou|
|000029c0| 6e 64 73 20 64 61 74 61 | 20 69 6e 20 74 68 65 20 |nds data| in the |
|000029d0| 4a 50 45 47 44 61 74 61 | 20 73 74 72 75 63 74 75 |JPEGData| structu|
|000029e0| 72 65 2e 0d 09 69 66 20 | 28 74 68 65 45 72 72 20 |re...if |(theErr |
|000029f0| 3d 3d 20 6e 6f 45 72 72 | 29 20 74 68 65 45 72 72 |== noErr|) theErr|
|00002a00| 20 3d 20 53 65 74 4a 50 | 45 47 42 6f 75 6e 64 73 | = SetJP|EGBounds|
|00002a10| 28 26 67 54 68 65 4a 50 | 45 47 49 6d 61 67 65 29 |(&gTheJP|EGImage)|
|00002a20| 3b 0d 09 0d 09 0d 0d 09 | 2f 2f 20 4e 6f 77 20 6d |;.......|// Now m|
|00002a30| 61 6b 65 20 61 20 57 69 | 6e 64 6f 77 20 6f 66 20 |ake a Wi|ndow of |
|00002a40| 61 6e 20 61 70 70 72 6f | 70 72 69 61 74 65 20 73 |an appro|priate s|
|00002a50| 69 7a 65 20 74 6f 20 68 | 6f 6c 64 20 6f 75 72 20 |ize to h|old our |
|00002a60| 69 6d 61 67 65 2e 20 49 | 66 20 77 65 20 61 6c 72 |image. I|f we alr|
|00002a70| 65 61 64 79 0d 09 2f 2f | 20 68 61 76 65 20 61 20 |eady..//| have a |
|00002a80| 77 69 6e 64 6f 77 20 74 | 68 65 6e 20 73 69 7a 65 |window t|hen size|
|00002a90| 20 69 74 20 70 72 6f 70 | 65 72 6c 79 2e 0d 0d 0d | it prop|erly....|
|00002aa0| 09 2f 2f 20 4d 61 78 20 | 6f 75 74 20 74 68 65 20 |.// Max |out the |
|00002ab0| 57 69 6e 64 6f 77 20 73 | 69 7a 65 20 61 74 20 61 |Window s|ize at a|
|00002ac0| 70 70 72 6f 78 69 6d 61 | 74 65 6c 79 20 74 68 65 |pproxima|tely the|
|00002ad0| 20 6d 61 69 6e 20 73 63 | 72 65 65 6e 20 73 69 7a | main sc|reen siz|
|00002ae0| 65 2e 09 0d 09 69 66 20 | 28 74 68 65 45 72 72 20 |e....if |(theErr |
|00002af0| 3d 3d 20 6e 6f 45 72 72 | 29 20 7b 0d 09 09 72 69 |== noErr|) {...ri|
|00002b00| 67 68 74 20 3d 20 4d 49 | 4e 28 67 54 68 65 4a 50 |ght = MI|N(gTheJP|
|00002b10| 45 47 49 6d 61 67 65 2e | 74 68 65 42 6f 75 6e 64 |EGImage.|theBound|
|00002b20| 73 2e 72 69 67 68 74 20 | 2c 20 71 64 2e 73 63 72 |s.right |, qd.scr|
|00002b30| 65 65 6e 42 69 74 73 2e | 62 6f 75 6e 64 73 2e 72 |eenBits.|bounds.r|
|00002b40| 69 67 68 74 20 2d 20 6b | 49 6e 73 65 74 42 69 74 |ight - k|InsetBit|
|00002b50| 73 20 29 3b 0d 09 09 62 | 6f 74 74 6f 6d 20 3d 20 |s );...b|ottom = |
|00002b60| 4d 49 4e 28 67 54 68 65 | 4a 50 45 47 49 6d 61 67 |MIN(gThe|JPEGImag|
|00002b70| 65 2e 74 68 65 42 6f 75 | 6e 64 73 2e 62 6f 74 74 |e.theBou|nds.bott|
|00002b80| 6f 6d 2c 20 71 64 2e 73 | 63 72 65 65 6e 42 69 74 |om, qd.s|creenBit|
|00002b90| 73 2e 62 6f 75 6e 64 73 | 2e 62 6f 74 74 6f 6d 20 |s.bounds|.bottom |
|00002ba0| 2d 20 28 6b 49 6e 73 65 | 74 42 69 74 73 2b 77 69 |- (kInse|tBits+wi|
|00002bb0| 6e 64 6f 77 54 6f 70 29 | 20 29 3b 0d 09 09 53 65 |ndowTop)| );...Se|
|00002bc0| 74 52 65 63 74 28 26 62 | 6f 75 6e 64 73 2c 20 30 |tRect(&b|ounds, 0|
|00002bd0| 20 2c 30 20 2c 20 72 69 | 67 68 74 2c 20 62 6f 74 | ,0 , ri|ght, bot|
|00002be0| 74 6f 6d 29 3b 0d 09 7d | 0d 09 0d 09 69 66 20 28 |tom);..}|....if (|
|00002bf0| 74 68 65 45 72 72 20 3d | 3d 20 6e 6f 45 72 72 29 |theErr =|= noErr)|
|00002c00| 7b 0d 09 09 0d 09 09 4f | 66 66 73 65 74 52 65 63 |{......O|ffsetRec|
|00002c10| 74 28 26 62 6f 75 6e 64 | 73 2c 20 30 2c 20 77 69 |t(&bound|s, 0, wi|
|00002c20| 6e 64 6f 77 54 6f 70 29 | 3b 0d 0d 09 09 69 66 28 |ndowTop)|;....if(|
|00002c30| 67 54 68 65 57 69 6e 64 | 6f 77 20 3d 3d 20 4e 55 |gTheWind|ow == NU|
|00002c40| 4c 4c 29 20 7b 0d 09 09 | 09 67 54 68 65 57 69 6e |LL) {...|.gTheWin|
|00002c50| 64 6f 77 20 3d 20 4e 65 | 77 43 57 69 6e 64 6f 77 |dow = Ne|wCWindow|
|00002c60| 28 4e 55 4c 4c 2c 20 26 | 62 6f 75 6e 64 73 2c 09 |(NULL, &|bounds,.|
|00002c70| 0d 09 09 09 09 09 28 53 | 74 72 69 6e 67 50 74 72 |......(S|tringPtr|
|00002c80| 29 26 28 74 68 65 52 65 | 70 6c 79 2e 73 66 46 69 |)&(theRe|ply.sfFi|
|00002c90| 6c 65 2e 6e 61 6d 65 29 | 2c 0d 09 09 09 09 09 66 |le.name)|,......f|
|00002ca0| 61 6c 73 65 2c 20 6e 6f | 47 72 6f 77 44 6f 63 50 |alse, no|GrowDocP|
|00002cb0| 72 6f 63 2c 20 28 57 69 | 6e 64 6f 77 50 74 72 29 |roc, (Wi|ndowPtr)|
|00002cc0| 2d 31 2c 20 74 72 75 65 | 2c 20 30 29 3b 0d 09 09 |-1, true|, 0);...|
|00002cd0| 09 69 66 20 28 67 54 68 | 65 57 69 6e 64 6f 77 20 |.if (gTh|eWindow |
|00002ce0| 3d 3d 20 4e 55 4c 4c 29 | 20 7b 0d 09 09 09 09 74 |== NULL)| {.....t|
|00002cf0| 68 65 45 72 72 20 3d 20 | 69 4d 65 6d 46 75 6c 6c |heErr = |iMemFull|
|00002d00| 45 72 72 3b 09 0d 09 09 | 09 7d 0d 09 09 7d 20 65 |Err;....|.}...} e|
|00002d10| 6c 73 65 7b 0d 09 09 09 | 4d 6f 76 65 57 69 6e 64 |lse{....|MoveWind|
|00002d20| 6f 77 20 28 67 54 68 65 | 57 69 6e 64 6f 77 2c 20 |ow (gThe|Window, |
|00002d30| 30 2c 20 77 69 6e 64 6f | 77 54 6f 70 2c 20 74 72 |0, windo|wTop, tr|
|00002d40| 75 65 29 3b 09 0d 09 09 | 09 53 65 74 57 54 69 74 |ue);....|.SetWTit|
|00002d50| 6c 65 28 67 54 68 65 57 | 69 6e 64 6f 77 2c 20 74 |le(gTheW|indow, t|
|00002d60| 68 65 52 65 70 6c 79 2e | 73 66 46 69 6c 65 2e 6e |heReply.|sfFile.n|
|00002d70| 61 6d 65 29 3b 0d 09 09 | 09 53 69 7a 65 57 69 6e |ame);...|.SizeWin|
|00002d80| 64 6f 77 20 28 67 54 68 | 65 57 69 6e 64 6f 77 2c |dow (gTh|eWindow,|
|00002d90| 20 62 6f 75 6e 64 73 2e | 72 69 67 68 74 20 2d 20 | bounds.|right - |
|00002da0| 62 6f 75 6e 64 73 2e 6c | 65 66 74 2c 20 62 6f 75 |bounds.l|eft, bou|
|00002db0| 6e 64 73 2e 62 6f 74 74 | 6f 6d 2d 62 6f 75 6e 64 |nds.bott|om-bound|
|00002dc0| 73 2e 74 6f 70 2c 20 74 | 72 75 65 29 3b 0d 09 09 |s.top, t|rue);...|
|00002dd0| 7d 0d 09 7d 0d 09 0d 09 | 69 66 20 28 74 68 65 45 |}..}....|if (theE|
|00002de0| 72 72 20 3d 3d 20 6e 6f | 45 72 72 29 20 7b 0d 09 |rr == no|Err) {..|
|00002df0| 09 41 6c 69 67 6e 57 69 | 6e 64 6f 77 28 67 54 68 |.AlignWi|ndow(gTh|
|00002e00| 65 57 69 6e 64 6f 77 2c | 20 74 72 75 65 2c 20 4e |eWindow,| true, N|
|00002e10| 55 4c 4c 2c 20 4e 55 4c | 4c 29 3b 0d 09 09 53 68 |ULL, NUL|L);...Sh|
|00002e20| 6f 77 57 69 6e 64 6f 77 | 28 67 54 68 65 57 69 6e |owWindow|(gTheWin|
|00002e30| 64 6f 77 29 3b 0d 09 09 | 53 65 74 50 6f 72 74 28 |dow);...|SetPort(|
|00002e40| 67 54 68 65 57 69 6e 64 | 6f 77 29 3b 0d 09 09 4f |gTheWind|ow);...O|
|00002e50| 66 66 73 65 74 52 65 63 | 74 28 26 62 6f 75 6e 64 |ffsetRec|t(&bound|
|00002e60| 73 2c 20 30 2c 20 2d 77 | 69 6e 64 6f 77 54 6f 70 |s, 0, -w|indowTop|
|00002e70| 29 3b 0d 09 09 43 6c 69 | 70 52 65 63 74 28 26 62 |);...Cli|pRect(&b|
|00002e80| 6f 75 6e 64 73 29 3b 0d | 09 7d 3b 0d 0d 09 2f 2f |ounds);.|.};...//|
|00002e90| 20 53 69 6e 63 65 20 77 | 65 20 68 61 76 65 20 61 | Since w|e have a|
|00002ea0| 6e 20 69 6d 61 67 65 2c | 20 77 65 27 6c 6c 20 65 |n image,| we'll e|
|00002eb0| 6e 61 62 6c 65 20 74 68 | 65 20 27 50 72 69 6e 74 |nable th|e 'Print|
|00002ec0| 27 20 6d 65 6e 75 20 69 | 74 65 6d 2e 0d 09 0d 09 |' menu i|tem.....|
|00002ed0| 69 66 20 28 74 68 65 45 | 72 72 20 3d 3d 20 6e 6f |if (theE|rr == no|
|00002ee0| 45 72 72 29 20 7b 0d 09 | 20 20 45 6e 61 62 6c 65 |Err) {..| Enable|
|00002ef0| 49 74 65 6d 28 47 65 74 | 4d 48 61 6e 64 6c 65 28 |Item(Get|MHandle(|
|00002f00| 6b 46 69 6c 65 4d 65 6e | 75 49 44 29 2c 20 6b 50 |kFileMen|uID), kP|
|00002f10| 72 69 6e 74 43 6f 6d 6d | 61 6e 64 29 3b 0d 09 7d |rintComm|and);..}|
|00002f20| 09 09 0d 09 0d 09 2f 2f | 20 49 6e 76 61 6c 69 64 |......//| Invalid|
|00002f30| 61 74 65 20 74 68 65 20 | 57 69 6e 64 6f 77 20 63 |ate the |Window c|
|00002f40| 6f 6e 74 65 6e 74 73 20 | 73 6f 20 77 65 27 6c 6c |ontents |so we'll|
|00002f50| 20 67 65 74 20 61 6e 20 | 75 70 64 61 74 65 20 65 | get an |update e|
|00002f60| 76 65 6e 74 2e 0d 09 69 | 66 28 20 74 68 65 45 72 |vent...i|f( theEr|
|00002f70| 72 20 3d 3d 20 6e 6f 45 | 72 72 29 49 6e 76 61 6c |r == noE|rr)Inval|
|00002f80| 52 65 63 74 28 26 67 54 | 68 65 57 69 6e 64 6f 77 |Rect(&gT|heWindow|
|00002f90| 2d 3e 70 6f 72 74 52 65 | 63 74 29 3b 0d 0d 09 44 |->portRe|ct);...D|
|00002fa0| 72 61 77 4d 65 6e 75 42 | 61 72 28 29 3b 0d 09 0d |rawMenuB|ar();...|
|00002fb0| 09 72 65 74 75 72 6e 3b | 0d 7d 20 2f 2a 20 44 6f |.return;|.} /* Do|
|00002fc0| 54 68 65 4f 70 65 6e 43 | 6f 6d 6d 61 6e 64 20 2a |TheOpenC|ommand *|
|00002fd0| 2f 0d 0d 2f 2f 20 49 6e | 69 74 69 61 6c 69 7a 65 |/..// In|itialize|
|00002fe0| 20 74 68 65 20 57 6f 72 | 6c 64 20 61 6e 64 20 63 | the Wor|ld and c|
|00002ff0| 68 65 63 6b 20 77 68 65 | 74 68 65 72 20 74 68 65 |heck whe|ther the|
|00003000| 20 61 70 70 72 6f 70 72 | 69 61 74 65 20 6d 61 6e | appropr|iate man|
|00003010| 61 67 65 72 73 20 61 72 | 65 20 61 76 61 69 6c 61 |agers ar|e availa|
|00003020| 62 6c 65 2e 0d 73 74 61 | 74 69 63 20 4f 53 45 72 |ble..sta|tic OSEr|
|00003030| 72 20 69 6e 69 74 4d 61 | 63 69 6e 74 6f 73 68 28 |r initMa|cintosh(|
|00003040| 29 0d 7b 0d 09 6c 6f 6e | 67 20 76 65 72 73 69 6f |).{..lon|g versio|
|00003050| 6e 3b 0d 09 4f 53 45 72 | 72 20 74 68 65 45 72 72 |n;..OSEr|r theErr|
|00003060| 20 3d 20 6e 6f 45 72 72 | 3b 0d 20 20 20 09 0d 09 | = noErr|;. ...|
|00003070| 49 6e 69 74 47 72 61 66 | 28 26 71 64 2e 74 68 65 |InitGraf|(&qd.the|
|00003080| 50 6f 72 74 29 3b 0d 09 | 49 6e 69 74 46 6f 6e 74 |Port);..|InitFont|
|00003090| 73 28 29 3b 0d 09 49 6e | 69 74 57 69 6e 64 6f 77 |s();..In|itWindow|
|000030a0| 73 28 29 3b 0d 09 46 6c | 75 73 68 45 76 65 6e 74 |s();..Fl|ushEvent|
|000030b0| 73 28 65 76 65 72 79 45 | 76 65 6e 74 2c 20 30 29 |s(everyE|vent, 0)|
|000030c0| 3b 0d 20 20 09 49 6e 69 | 74 44 69 61 6c 6f 67 73 |;. .Ini|tDialogs|
|000030d0| 28 4e 55 4c 4c 29 3b 0d | 09 54 45 49 6e 69 74 28 |(NULL);.|.TEInit(|
|000030e0| 29 3b 0d 09 49 6e 69 74 | 43 75 72 73 6f 72 28 29 |);..Init|Cursor()|
|000030f0| 3b 0d 09 53 65 74 46 72 | 61 63 74 45 6e 61 62 6c |;..SetFr|actEnabl|
|00003100| 65 28 74 72 75 65 29 3b | 09 09 09 2f 2f 20 49 20 |e(true);|...// I |
|00003110| 67 75 65 73 73 20 74 68 | 69 73 20 75 72 67 65 20 |guess th|is urge |
|00003120| 63 6f 6d 65 73 20 66 72 | 6f 6d 20 6d 79 20 6f 6c |comes fr|om my ol|
|00003130| 64 20 64 61 79 73 20 61 | 74 20 41 64 6f 62 65 0d |d days a|t Adobe.|
|00003140| 09 0d 09 74 68 65 45 72 | 72 20 3d 20 53 65 74 75 |...theEr|r = Setu|
|00003150| 70 4d 65 6e 75 73 28 29 | 3b 0d 09 0d 09 69 66 28 |pMenus()|;....if(|
|00003160| 74 68 65 45 72 72 20 21 | 3d 20 6e 6f 45 72 72 29 |theErr !|= noErr)|
|00003170| 7b 0d 09 09 50 61 72 61 | 6d 54 65 78 74 28 22 5c |{...Para|mText("\|
|00003180| 70 43 6f 75 6c 64 6e 27 | 74 20 6c 6f 61 64 20 4d |pCouldn'|t load M|
|00003190| 65 6e 75 73 2e 22 2c 20 | 22 5c 70 22 2c 20 22 5c |enus.", |"\p", "\|
|000031a0| 70 22 2c 20 22 5c 70 22 | 29 3b 0d 09 7d 0d 0d 09 |p", "\p"|);..}...|
|000031b0| 69 66 28 74 68 65 45 72 | 72 20 3d 3d 20 6e 6f 45 |if(theEr|r == noE|
|000031c0| 72 72 29 7b 0d 09 09 74 | 68 65 45 72 72 20 3d 20 |rr){...t|heErr = |
|000031d0| 47 65 73 74 61 6c 74 28 | 67 65 73 74 61 6c 74 53 |Gestalt(|gestaltS|
|000031e0| 79 73 74 65 6d 56 65 72 | 73 69 6f 6e 2c 20 26 76 |ystemVer|sion, &v|
|000031f0| 65 72 73 69 6f 6e 29 3b | 0d 09 09 69 66 28 20 28 |ersion);|...if( (|
|00003200| 74 68 65 45 72 72 20 21 | 3d 20 6e 6f 45 72 72 29 |theErr !|= noErr)|
|00003210| 20 7c 7c 20 28 76 65 72 | 73 69 6f 6e 20 3c 20 30 | || (ver|sion < 0|
|00003220| 78 30 37 30 30 29 20 29 | 7b 0d 09 09 09 09 50 61 |x0700) )|{.....Pa|
|00003230| 72 61 6d 54 65 78 74 28 | 22 5c 70 54 68 69 73 20 |ramText(|"\pThis |
|00003240| 73 6f 66 74 77 61 72 65 | 20 72 65 71 75 69 72 65 |software| require|
|00003250| 73 20 53 79 73 74 65 6d | 20 37 2e 30 20 6f 72 20 |s System| 7.0 or |
|00003260| 68 69 67 68 65 72 2e 22 | 2c 20 22 5c 70 22 2c 20 |higher."|, "\p", |
|00003270| 22 5c 70 22 2c 20 22 5c | 70 22 29 3b 0d 09 09 09 |"\p", "\|p");....|
|00003280| 09 74 68 65 45 72 72 20 | 3d 20 6b 41 70 70 45 72 |.theErr |= kAppEr|
|00003290| 72 6f 72 3b 0d 09 09 7d | 0d 09 7d 09 0d 0d 09 69 |ror;...}|..}....i|
|000032a0| 66 28 74 68 65 45 72 72 | 20 3d 3d 20 6e 6f 45 72 |f(theErr| == noEr|
|000032b0| 72 29 7b 0d 09 09 74 68 | 65 45 72 72 20 3d 20 47 |r){...th|eErr = G|
|000032c0| 65 73 74 61 6c 74 28 67 | 65 73 74 61 6c 74 51 75 |estalt(g|estaltQu|
|000032d0| 69 63 6b 54 69 6d 65 56 | 65 72 73 69 6f 6e 2c 20 |ickTimeV|ersion, |
|000032e0| 26 76 65 72 73 69 6f 6e | 29 3b 0d 09 09 69 66 28 |&version|);...if(|
|000032f0| 20 28 74 68 65 45 72 72 | 20 21 3d 20 6e 6f 45 72 | (theErr| != noEr|
|00003300| 72 29 20 29 7b 0d 09 09 | 09 09 50 61 72 61 6d 54 |r) ){...|..ParamT|
|00003310| 65 78 74 28 22 5c 70 51 | 75 69 63 6b 54 69 6d 65 |ext("\pQ|uickTime|
|00003320| 20 6e 6f 74 20 69 6e 73 | 74 61 6c 6c 65 64 2e 20 | not ins|talled. |
|00003330| 20 54 68 69 73 20 64 65 | 6d 6f 20 72 65 71 75 69 | This de|mo requi|
|00003340| 72 65 73 20 51 75 69 63 | 6b 74 69 6d 65 2e 22 2c |res Quic|ktime.",|
|00003350| 20 22 5c 70 22 2c 20 22 | 5c 70 22 2c 20 22 5c 70 | "\p", "|\p", "\p|
|00003360| 22 29 3b 0d 09 09 7d 0d | 09 7d 09 0d 09 0d 09 69 |");...}.|.}.....i|
|00003370| 66 28 74 68 65 45 72 72 | 20 3d 3d 20 6e 6f 45 72 |f(theErr| == noEr|
|00003380| 72 29 7b 0d 09 09 74 68 | 65 45 72 72 20 3d 20 47 |r){...th|eErr = G|
|00003390| 65 73 74 61 6c 74 28 67 | 65 73 74 61 6c 74 43 6f |estalt(g|estaltCo|
|000033a0| 6d 70 72 65 73 73 69 6f | 6e 4d 67 72 2c 20 26 76 |mpressio|nMgr, &v|
|000033b0| 65 72 73 69 6f 6e 29 3b | 0d 2f 2f 09 43 68 65 63 |ersion);|.//.Chec|
|000033c0| 6b 69 6e 67 20 66 6f 72 | 20 76 65 72 73 69 6f 6e |king for| version|
|000033d0| 20 31 2e 35 20 6f 66 20 | 74 68 65 20 49 43 4d 20 | 1.5 of |the ICM |
|000033e0| 63 6f 6d 65 73 20 66 72 | 6f 6d 20 74 68 65 20 4a |comes fr|om the J|
|000033f0| 46 49 46 2d 50 49 43 54 | 20 63 6f 6e 76 65 72 73 |FIF-PICT| convers|
|00003400| 69 6f 6e 20 70 72 6f 67 | 72 61 6d 20 0d 2f 2f 09 |ion prog|ram .//.|
|00003410| 70 72 6f 76 69 64 65 64 | 20 61 73 20 61 20 73 61 |provided| as a sa|
|00003420| 6d 70 6c 65 20 70 72 6f | 67 72 61 6d 20 69 6e 20 |mple pro|gram in |
|00003430| 74 68 65 20 51 75 69 63 | 6b 54 69 6d 65 20 73 65 |the Quic|kTime se|
|00003440| 63 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 53 44 4b |ction of| the SDK|
|00003450| 2e 20 41 70 70 61 72 65 | 6e 74 6c 79 20 74 68 65 |. Appare|ntly the|
|00003460| 72 65 0d 2f 2f 09 61 72 | 65 20 70 72 6f 62 6c 65 |re.//.ar|e proble|
|00003470| 6d 73 20 77 69 74 68 20 | 76 65 72 73 69 6f 6e 73 |ms with |versions|
|00003480| 20 70 72 69 6f 72 20 74 | 6f 20 76 65 72 73 69 6f | prior t|o versio|
|00003490| 6e 20 31 2e 35 2e 09 0d | 09 09 69 66 28 20 28 74 |n 1.5...|..if( (t|
|000034a0| 68 65 45 72 72 20 21 3d | 20 6e 6f 45 72 72 20 7c |heErr !=| noErr ||
|000034b0| 7c 20 76 65 72 73 69 6f | 6e 20 3c 20 31 35 29 20 || versio|n < 15) |
|000034c0| 29 7b 0d 09 09 09 09 69 | 66 28 74 68 65 45 72 72 |){.....i|f(theErr|
|000034d0| 20 3d 3d 20 6e 6f 45 72 | 72 29 20 74 68 65 45 72 | == noEr|r) theEr|
|000034e0| 72 20 3d 20 6b 41 70 70 | 45 72 72 6f 72 3b 0d 09 |r = kApp|Error;..|
|000034f0| 09 09 09 50 61 72 61 6d | 54 65 78 74 28 22 5c 70 |...Param|Text("\p|
|00003500| 56 65 72 73 69 6f 6e 20 | 31 2e 35 20 6f 72 20 47 |Version |1.5 or G|
|00003510| 72 65 61 74 65 72 20 6f | 66 20 74 68 65 20 49 6d |reater o|f the Im|
|00003520| 61 67 65 20 43 6f 6d 70 | 72 65 73 73 69 6f 6e 20 |age Comp|ression |
|00003530| 4d 67 72 20 69 73 20 72 | 65 71 75 69 72 65 64 2e |Mgr is r|equired.|
|00003540| 22 2c 20 22 5c 70 22 2c | 20 22 5c 70 22 2c 20 22 |", "\p",| "\p", "|
|00003550| 5c 70 22 29 3b 0d 09 09 | 7d 0d 09 7d 09 0d 0d 09 |\p");...|}..}....|
|00003560| 69 66 28 74 68 65 45 72 | 72 20 3d 3d 20 6e 6f 45 |if(theEr|r == noE|
|00003570| 72 72 29 7b 0d 09 09 74 | 68 65 45 72 72 20 3d 20 |rr){...t|heErr = |
|00003580| 47 65 73 74 61 6c 74 28 | 67 65 73 74 61 6c 74 43 |Gestalt(|gestaltC|
|00003590| 6f 6d 70 6f 6e 65 6e 74 | 4d 67 72 2c 20 26 76 65 |omponent|Mgr, &ve|
|000035a0| 72 73 69 6f 6e 29 3b 0d | 09 09 69 66 28 20 28 74 |rsion);.|..if( (t|
|000035b0| 68 65 45 72 72 20 21 3d | 20 6e 6f 45 72 72 29 20 |heErr !=| noErr) |
|000035c0| 29 7b 0d 09 09 09 09 50 | 61 72 61 6d 54 65 78 74 |){.....P|aramText|
|000035d0| 28 22 5c 70 54 68 65 20 | 63 6f 6d 70 6f 6e 65 6e |("\pThe |componen|
|000035e0| 74 20 6d 61 6e 61 67 65 | 72 20 69 73 20 72 65 71 |t manage|r is req|
|000035f0| 75 69 72 65 64 20 62 75 | 74 20 69 74 20 69 73 6e |uired bu|t it isn|
|00003600| 27 74 20 61 76 61 69 6c | 61 62 6c 65 2e 22 2c 20 |'t avail|able.", |
|00003610| 22 5c 70 22 2c 20 22 5c | 70 22 2c 20 22 5c 70 22 |"\p", "\|p", "\p"|
|00003620| 29 3b 0d 09 09 7d 0d 09 | 7d 0d 09 0d 09 69 66 20 |);...}..|}....if |
|00003630| 28 20 74 68 65 45 72 72 | 20 3d 3d 20 6e 6f 45 72 |( theErr| == noEr|
|00003640| 72 29 20 7b 09 09 2f 2f | 20 6d 61 6b 65 20 73 75 |r) {..//| make su|
|00003650| 72 65 20 74 68 65 72 65 | 20 69 73 20 73 6f 6d 65 |re there| is some|
|00003660| 20 43 6f 64 65 63 20 61 | 76 61 69 6c 61 62 6c 65 | Codec a|vailable|
|00003670| 20 74 68 61 74 20 63 61 | 6e 20 68 61 6e 64 6c 65 | that ca|n handle|
|00003680| 20 4a 50 45 47 2e 0d 09 | 09 43 6f 64 65 63 49 6e | JPEG...|.CodecIn|
|00003690| 66 6f 20 74 68 65 49 6e | 66 6f 3b 0d 09 09 0d 09 |fo theIn|fo;.....|
|000036a0| 09 74 68 65 45 72 72 20 | 3d 20 47 65 74 43 6f 64 |.theErr |= GetCod|
|000036b0| 65 63 49 6e 66 6f 28 26 | 74 68 65 49 6e 66 6f 2c |ecInfo(&|theInfo,|
|000036c0| 20 27 6a 70 65 67 27 2c | 20 61 6e 79 43 6f 64 65 | 'jpeg',| anyCode|
|000036d0| 63 29 3b 0d 09 09 69 66 | 28 74 68 65 45 72 72 20 |c);...if|(theErr |
|000036e0| 21 3d 20 6e 6f 45 72 72 | 29 50 61 72 61 6d 54 65 |!= noErr|)ParamTe|
|000036f0| 78 74 28 22 5c 70 54 68 | 65 72 65 20 64 6f 6e 27 |xt("\pTh|ere don'|
|00003700| 74 20 61 70 70 65 61 72 | 20 74 6f 20 62 65 20 61 |t appear| to be a|
|00003710| 6e 79 20 4a 50 45 47 20 | 64 65 63 6f 6d 70 72 65 |ny JPEG |decompre|
|00003720| 73 73 6f 72 73 21 22 2c | 20 22 5c 70 22 2c 20 22 |ssors!",| "\p", "|
|00003730| 5c 70 22 2c 20 22 5c 70 | 22 29 3b 09 09 0d 09 7d |\p", "\p|");....}|
|00003740| 0d 09 0d 09 69 66 28 74 | 68 65 45 72 72 20 21 3d |....if(t|heErr !=|
|00003750| 20 6e 6f 45 72 72 29 7b | 0d 09 09 41 6c 65 72 74 | noErr){|...Alert|
|00003760| 28 6b 47 65 6e 65 72 69 | 63 45 72 72 6f 72 2c 20 |(kGeneri|cError, |
|00003770| 4e 55 4c 4c 29 3b 09 0d | 09 7d 0d 09 0d 09 72 65 |NULL);..|.}....re|
|00003780| 74 75 72 6e 20 74 68 65 | 45 72 72 3b 0d 7d 09 2f |turn the|Err;.}./|
|00003790| 2a 20 69 6e 69 74 4d 61 | 63 69 6e 74 6f 73 68 20 |* initMa|cintosh |
|000037a0| 2a 2f 0d 0d 0d 73 74 61 | 74 69 63 20 53 49 6e 74 |*/...sta|tic SInt|
|000037b0| 31 36 20 68 61 6e 64 6c | 65 45 76 65 6e 74 28 29 |16 handl|eEvent()|
|000037c0| 0d 7b 0d 09 45 76 65 6e | 74 52 65 63 6f 72 64 20 |.{..Even|tRecord |
|000037d0| 65 3b 0d 09 57 69 6e 64 | 6f 77 52 65 63 6f 72 64 |e;..Wind|owRecord|
|000037e0| 20 2a 77 3b 0d 09 53 49 | 6e 74 33 32 20 73 3b 0d | *w;..SI|nt32 s;.|
|000037f0| 09 52 65 63 74 20 62 3b | 0d 09 52 67 6e 48 61 6e |.Rect b;|..RgnHan|
|00003800| 64 6c 65 20 63 75 72 72 | 65 6e 74 47 72 61 79 52 |dle curr|entGrayR|
|00003810| 65 67 69 6f 6e 3b 0d 09 | 4f 53 45 72 72 20 74 68 |egion;..|OSErr th|
|00003820| 65 45 72 72 3b 0d 09 47 | 72 61 66 50 74 72 20 6f |eErr;..G|rafPtr o|
|00003830| 6c 64 50 6f 72 74 3b 0d | 09 0d 09 69 66 20 28 57 |ldPort;.|...if (W|
|00003840| 61 69 74 4e 65 78 74 45 | 76 65 6e 74 28 65 76 65 |aitNextE|vent(eve|
|00003850| 72 79 45 76 65 6e 74 2c | 20 26 65 2c 20 6b 53 6c |ryEvent,| &e, kSl|
|00003860| 65 65 70 54 69 6d 65 2c | 20 30 4c 29 29 0d 09 09 |eepTime,| 0L))...|
|00003870| 7b 0d 09 09 73 77 69 74 | 63 68 20 28 65 2e 77 68 |{...swit|ch (e.wh|
|00003880| 61 74 29 0d 09 09 09 7b | 0d 09 09 09 63 61 73 65 |at)....{|....case|
|00003890| 20 6d 6f 75 73 65 44 6f | 77 6e 3a 0d 09 09 09 09 | mouseDo|wn:.....|
|000038a0| 73 77 69 74 63 68 20 28 | 46 69 6e 64 57 69 6e 64 |switch (|FindWind|
|000038b0| 6f 77 28 65 2e 77 68 65 | 72 65 2c 20 28 57 69 6e |ow(e.whe|re, (Win|
|000038c0| 64 6f 77 50 74 72 20 2a | 29 26 77 29 29 0d 09 09 |dowPtr *|)&w))...|
|000038d0| 09 09 09 7b 0d 09 09 09 | 09 09 63 61 73 65 20 69 |...{....|..case i|
|000038e0| 6e 43 6f 6e 74 65 6e 74 | 3a 0d 09 09 09 09 09 09 |nContent|:.......|
|000038f0| 69 66 20 28 28 57 69 6e | 64 6f 77 52 65 63 6f 72 |if ((Win|dowRecor|
|00003900| 64 20 2a 29 20 46 72 6f | 6e 74 57 69 6e 64 6f 77 |d *) Fro|ntWindow|
|00003910| 28 29 20 21 3d 20 77 29 | 0d 09 09 09 09 09 09 09 |() != w)|........|
|00003920| 53 65 6c 65 63 74 57 69 | 6e 64 6f 77 28 28 57 69 |SelectWi|ndow((Wi|
|00003930| 6e 64 6f 77 50 74 72 29 | 77 29 3b 0d 09 09 09 09 |ndowPtr)|w);.....|
|00003940| 09 09 65 6c 73 65 20 69 | 66 20 28 28 28 57 69 6e |..else i|f (((Win|
|00003950| 64 6f 77 52 65 63 6f 72 | 64 20 2a 29 20 77 29 2d |dowRecor|d *) w)-|
|00003960| 3e 77 69 6e 64 6f 77 4b | 69 6e 64 20 3c 20 30 29 |>windowK|ind < 0)|
|00003970| 0d 09 09 09 09 09 09 09 | 53 79 73 74 65 6d 43 6c |........|SystemCl|
|00003980| 69 63 6b 28 26 65 2c 20 | 28 57 69 6e 64 6f 77 50 |ick(&e, |(WindowP|
|00003990| 74 72 20 29 77 29 3b 0d | 09 09 09 09 09 09 62 72 |tr )w);.|......br|
|000039a0| 65 61 6b 3b 0d 09 09 09 | 09 09 63 61 73 65 20 69 |eak;....|..case i|
|000039b0| 6e 44 72 61 67 3a 0d 09 | 09 09 09 09 09 63 75 72 |nDrag:..|.....cur|
|000039c0| 72 65 6e 74 47 72 61 79 | 52 65 67 69 6f 6e 20 3d |rentGray|Region =|
|000039d0| 20 47 65 74 47 72 61 79 | 52 67 6e 28 29 3b 0d 09 | GetGray|Rgn();..|
|000039e0| 09 09 09 09 09 62 20 3d | 20 28 2a 2a 28 52 67 6e |.....b =| (**(Rgn|
|000039f0| 48 61 6e 64 6c 65 29 63 | 75 72 72 65 6e 74 47 72 |Handle)c|urrentGr|
|00003a00| 61 79 52 65 67 69 6f 6e | 29 2e 72 67 6e 42 42 6f |ayRegion|).rgnBBo|
|00003a10| 78 3b 0d 09 09 09 09 09 | 09 2f 2f 20 6d 61 6b 65 |x;......|.// make|
|00003a20| 20 73 75 72 65 20 64 72 | 61 67 73 20 61 6c 69 67 | sure dr|ags alig|
|00003a30| 6e 20 77 65 6c 6c 20 66 | 6f 72 20 62 65 73 74 20 |n well f|or best |
|00003a40| 70 65 72 66 6f 72 6d 61 | 6e 63 65 20 69 6e 20 72 |performa|nce in r|
|00003a50| 65 64 72 61 77 73 2e 0d | 09 09 09 09 09 09 44 72 |edraws..|......Dr|
|00003a60| 61 67 41 6c 69 67 6e 65 | 64 57 69 6e 64 6f 77 28 |agAligne|dWindow(|
|00003a70| 28 57 69 6e 64 6f 77 50 | 74 72 20 29 77 2c 20 65 |(WindowP|tr )w, e|
|00003a80| 2e 77 68 65 72 65 2c 20 | 26 62 2c 20 4e 55 4c 4c |.where, |&b, NULL|
|00003a90| 2c 20 4e 55 4c 4c 29 3b | 0d 09 09 09 09 09 09 62 |, NULL);|.......b|
|00003aa0| 72 65 61 6b 3b 0d 09 09 | 09 09 09 63 61 73 65 20 |reak;...|...case |
|00003ab0| 69 6e 47 6f 41 77 61 79 | 3a 0d 09 09 09 09 09 09 |inGoAway|:.......|
|00003ac0| 69 66 20 28 54 72 61 63 | 6b 47 6f 41 77 61 79 28 |if (Trac|kGoAway(|
|00003ad0| 28 57 69 6e 64 6f 77 50 | 74 72 20 29 77 2c 20 65 |(WindowP|tr )w, e|
|00003ae0| 2e 77 68 65 72 65 29 29 | 7b 09 09 09 09 09 09 0d |.where))|{.......|
|00003af0| 09 09 09 09 09 09 09 2f | 2f 20 77 65 20 73 68 6f |......./|/ we sho|
|00003b00| 75 6c 64 20 63 6c 6f 73 | 65 20 74 68 65 20 66 69 |uld clos|e the fi|
|00003b10| 6c 65 20 68 65 72 65 2e | 2e 2e 0d 09 09 09 09 09 |le here.|........|
|00003b20| 09 09 69 66 28 67 54 68 | 65 4a 50 45 47 49 6d 61 |..if(gTh|eJPEGIma|
|00003b30| 67 65 2e 74 68 65 52 65 | 66 4e 75 6d 29 7b 0d 09 |ge.theRe|fNum){..|
|00003b40| 09 09 09 09 09 09 09 46 | 53 43 6c 6f 73 65 28 67 |.......F|SClose(g|
|00003b50| 54 68 65 4a 50 45 47 49 | 6d 61 67 65 2e 74 68 65 |TheJPEGI|mage.the|
|00003b60| 52 65 66 4e 75 6d 29 3b | 0d 09 09 09 09 09 09 09 |RefNum);|........|
|00003b70| 09 67 54 68 65 4a 50 45 | 47 49 6d 61 67 65 2e 74 |.gTheJPE|GImage.t|
|00003b80| 68 65 52 65 66 4e 75 6d | 20 3d 20 30 3b 0d 09 09 |heRefNum| = 0;...|
|00003b90| 09 09 09 09 09 7d 0d 09 | 09 09 09 09 09 09 48 69 |.....}..|......Hi|
|00003ba0| 64 65 57 69 6e 64 6f 77 | 28 28 57 69 6e 64 6f 77 |deWindow|((Window|
|00003bb0| 50 74 72 20 29 77 29 3b | 0d 09 09 09 09 09 09 09 |Ptr )w);|........|
|00003bc0| 44 69 73 61 62 6c 65 49 | 74 65 6d 28 47 65 74 4d |DisableI|tem(GetM|
|00003bd0| 48 61 6e 64 6c 65 28 6b | 46 69 6c 65 4d 65 6e 75 |Handle(k|FileMenu|
|00003be0| 49 44 29 2c 20 6b 50 72 | 69 6e 74 43 6f 6d 6d 61 |ID), kPr|intComma|
|00003bf0| 6e 64 29 3b 0d 09 09 09 | 09 09 09 09 44 72 61 77 |nd);....|....Draw|
|00003c00| 4d 65 6e 75 42 61 72 28 | 29 3b 0d 09 09 09 09 09 |MenuBar(|);......|
|00003c10| 09 7d 0d 09 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |.}......|.break;.|
|00003c20| 09 09 09 09 09 63 61 73 | 65 20 69 6e 47 72 6f 77 |.....cas|e inGrow|
|00003c30| 3a 0d 09 09 09 09 09 09 | 53 65 74 52 65 63 74 28 |:.......|SetRect(|
|00003c40| 26 62 2c 20 33 30 2c 20 | 33 30 2c 20 30 78 37 66 |&b, 30, |30, 0x7f|
|00003c50| 66 66 2c 20 30 78 37 66 | 66 66 29 3b 0d 09 09 09 |ff, 0x7f|ff);....|
|00003c60| 09 09 09 73 20 3d 20 47 | 72 6f 77 57 69 6e 64 6f |...s = G|rowWindo|
|00003c70| 77 28 28 57 69 6e 64 6f | 77 50 74 72 20 29 77 2c |w((Windo|wPtr )w,|
|00003c80| 20 65 2e 77 68 65 72 65 | 2c 20 26 62 29 3b 0d 09 | e.where|, &b);..|
|00003c90| 09 09 09 09 09 69 66 20 | 28 73 29 7b 0d 09 09 09 |.....if |(s){....|
|00003ca0| 09 09 09 09 53 69 7a 65 | 57 69 6e 64 6f 77 28 28 |....Size|Window((|
|00003cb0| 57 69 6e 64 6f 77 50 74 | 72 20 29 77 2c 20 4c 6f |WindowPt|r )w, Lo|
|00003cc0| 57 6f 72 64 28 73 29 2c | 20 48 69 57 6f 72 64 28 |Word(s),| HiWord(|
|00003cd0| 73 29 2c 20 31 29 3b 0d | 09 09 09 09 09 09 09 53 |s), 1);.|.......S|
|00003ce0| 65 74 50 6f 72 74 28 28 | 57 69 6e 64 6f 77 50 74 |etPort((|WindowPt|
|00003cf0| 72 20 29 77 29 3b 0d 09 | 09 09 09 09 09 09 49 6e |r )w);..|......In|
|00003d00| 76 61 6c 52 65 63 74 28 | 26 67 54 68 65 57 69 6e |valRect(|&gTheWin|
|00003d10| 64 6f 77 2d 3e 70 6f 72 | 74 52 65 63 74 29 3b 0d |dow->por|tRect);.|
|00003d20| 09 09 09 09 09 09 7d 0d | 09 09 09 09 09 09 62 72 |......}.|......br|
|00003d30| 65 61 6b 3b 0d 09 09 09 | 09 09 63 61 73 65 20 69 |eak;....|..case i|
|00003d40| 6e 5a 6f 6f 6d 49 6e 3a | 0d 09 09 09 09 09 09 69 |nZoomIn:|.......i|
|00003d50| 66 20 28 54 72 61 63 6b | 42 6f 78 28 28 57 69 6e |f (Track|Box((Win|
|00003d60| 64 6f 77 50 74 72 20 29 | 77 2c 20 65 2e 77 68 65 |dowPtr )|w, e.whe|
|00003d70| 72 65 2c 20 69 6e 5a 6f | 6f 6d 49 6e 29 29 7b 0d |re, inZo|omIn)){.|
|00003d80| 09 09 09 09 09 09 09 5a | 6f 6f 6d 57 69 6e 64 6f |.......Z|oomWindo|
|00003d90| 77 28 28 57 69 6e 64 6f | 77 50 74 72 20 29 77 2c |w((Windo|wPtr )w,|
|00003da0| 20 69 6e 5a 6f 6f 6d 49 | 6e 2c 20 30 29 3b 0d 09 | inZoomI|n, 0);..|
|00003db0| 09 09 09 09 09 09 53 65 | 74 50 6f 72 74 28 28 57 |......Se|tPort((W|
|00003dc0| 69 6e 64 6f 77 50 74 72 | 20 29 77 29 3b 0d 09 09 |indowPtr| )w);...|
|00003dd0| 09 09 09 09 09 49 6e 76 | 61 6c 52 65 63 74 28 26 |.....Inv|alRect(&|
|00003de0| 67 54 68 65 57 69 6e 64 | 6f 77 2d 3e 70 6f 72 74 |gTheWind|ow->port|
|00003df0| 52 65 63 74 29 3b 0d 09 | 09 09 09 09 09 7d 0d 09 |Rect);..|.....}..|
|00003e00| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 09 09 |.....bre|ak;.....|
|00003e10| 09 63 61 73 65 20 69 6e | 5a 6f 6f 6d 4f 75 74 3a |.case in|ZoomOut:|
|00003e20| 0d 09 09 09 09 09 09 69 | 66 20 28 54 72 61 63 6b |.......i|f (Track|
|00003e30| 42 6f 78 28 28 57 69 6e | 64 6f 77 50 74 72 20 29 |Box((Win|dowPtr )|
|00003e40| 77 2c 20 65 2e 77 68 65 | 72 65 2c 20 69 6e 5a 6f |w, e.whe|re, inZo|
|00003e50| 6f 6d 4f 75 74 29 29 7b | 0d 09 09 09 09 09 09 09 |omOut)){|........|
|00003e60| 5a 6f 6f 6d 57 69 6e 64 | 6f 77 28 28 57 69 6e 64 |ZoomWind|ow((Wind|
|00003e70| 6f 77 50 74 72 20 29 77 | 2c 20 69 6e 5a 6f 6f 6d |owPtr )w|, inZoom|
|00003e80| 4f 75 74 2c 20 30 29 3b | 0d 09 09 09 09 09 09 09 |Out, 0);|........|
|00003e90| 53 65 74 50 6f 72 74 28 | 28 57 69 6e 64 6f 77 50 |SetPort(|(WindowP|
|00003ea0| 74 72 20 29 77 29 3b 0d | 09 09 09 09 09 09 09 49 |tr )w);.|.......I|
|00003eb0| 6e 76 61 6c 52 65 63 74 | 28 26 67 54 68 65 57 69 |nvalRect|(&gTheWi|
|00003ec0| 6e 64 6f 77 2d 3e 70 6f | 72 74 52 65 63 74 29 3b |ndow->po|rtRect);|
|00003ed0| 0d 09 09 09 09 09 09 7d | 0d 09 09 09 09 09 09 62 |.......}|.......b|
|00003ee0| 72 65 61 6b 3b 0d 09 09 | 09 09 09 63 61 73 65 20 |reak;...|...case |
|00003ef0| 69 6e 4d 65 6e 75 42 61 | 72 3a 20 0d 09 09 09 09 |inMenuBa|r: .....|
|00003f00| 09 7b 0d 09 09 09 09 20 | 20 20 20 09 53 49 6e 74 |.{..... | .SInt|
|00003f10| 33 32 20 6d 52 65 73 75 | 6c 74 20 3d 20 4d 65 6e |32 mResu|lt = Men|
|00003f20| 75 53 65 6c 65 63 74 28 | 65 2e 77 68 65 72 65 29 |uSelect(|e.where)|
|00003f30| 3b 0d 20 20 09 09 09 09 | 09 09 53 49 6e 74 31 36 |;. ....|..SInt16|
|00003f40| 20 74 68 65 4d 65 6e 75 | 2c 20 74 68 65 49 74 65 | theMenu|, theIte|
|00003f50| 6d 3b 0d 20 20 09 09 09 | 09 09 09 74 68 65 4d 65 |m;. ...|...theMe|
|00003f60| 6e 75 20 3d 20 48 69 57 | 6f 72 64 28 6d 52 65 73 |nu = HiW|ord(mRes|
|00003f70| 75 6c 74 29 3b 20 0d 20 | 20 09 09 09 09 09 09 74 |ult); . | ......t|
|00003f80| 68 65 49 74 65 6d 20 3d | 20 4c 6f 57 6f 72 64 28 |heItem =| LoWord(|
|00003f90| 6d 52 65 73 75 6c 74 29 | 3b 0d 09 09 09 09 09 09 |mResult)|;.......|
|00003fa0| 64 6f 43 6f 6d 6d 61 6e | 64 28 74 68 65 4d 65 6e |doComman|d(theMen|
|00003fb0| 75 2c 20 74 68 65 49 74 | 65 6d 29 3b 0d 20 20 09 |u, theIt|em);. .|
|00003fc0| 09 09 09 09 09 62 72 65 | 61 6b 3b 0d 20 20 09 09 |.....bre|ak;. ..|
|00003fd0| 09 09 09 7d 0d 09 09 09 | 09 7d 0d 09 09 09 09 62 |...}....|.}.....b|
|00003fe0| 72 65 61 6b 3b 0d 09 09 | 09 63 61 73 65 20 75 70 |reak;...|.case up|
|00003ff0| 64 61 74 65 45 76 74 3a | 0d 09 09 09 09 42 65 67 |dateEvt:|.....Beg|
|00004000| 69 6e 55 70 64 61 74 65 | 28 28 57 69 6e 64 6f 77 |inUpdate|((Window|
|00004010| 50 74 72 29 65 2e 6d 65 | 73 73 61 67 65 29 3b 0d |Ptr)e.me|ssage);.|
|00004020| 09 09 09 09 47 65 74 50 | 6f 72 74 28 26 6f 6c 64 |....GetP|ort(&old|
|00004030| 50 6f 72 74 29 3b 0d 09 | 09 09 09 53 65 74 50 6f |Port);..|...SetPo|
|00004040| 72 74 28 28 57 69 6e 64 | 6f 77 50 74 72 29 65 2e |rt((Wind|owPtr)e.|
|00004050| 6d 65 73 73 61 67 65 29 | 3b 0d 09 09 09 09 0d 09 |message)|;.......|
|00004060| 09 09 09 74 68 65 45 72 | 72 20 3d 20 44 72 61 77 |...theEr|r = Draw|
|00004070| 4a 50 45 47 49 6d 61 67 | 65 28 67 54 68 65 4a 50 |JPEGImag|e(gTheJP|
|00004080| 45 47 49 6d 61 67 65 2c | 49 53 43 4f 4c 4f 52 50 |EGImage,|ISCOLORP|
|00004090| 4f 52 54 28 28 57 69 6e | 64 6f 77 50 74 72 29 65 |ORT((Win|dowPtr)e|
|000040a0| 2e 6d 65 73 73 61 67 65 | 29 29 3b 0d 0d 09 09 09 |.message|));.....|
|000040b0| 09 53 65 74 50 6f 72 74 | 28 6f 6c 64 50 6f 72 74 |.SetPort|(oldPort|
|000040c0| 29 3b 0d 09 09 09 09 45 | 6e 64 55 70 64 61 74 65 |);.....E|ndUpdate|
|000040d0| 28 28 57 69 6e 64 6f 77 | 50 74 72 29 65 2e 6d 65 |((Window|Ptr)e.me|
|000040e0| 73 73 61 67 65 29 3b 0d | 0d 09 09 09 09 62 72 65 |ssage);.|.....bre|
|000040f0| 61 6b 3b 0d 09 09 09 63 | 61 73 65 20 6b 65 79 44 |ak;....c|ase keyD|
|00004100| 6f 77 6e 3a 0d 20 20 20 | 20 20 20 09 09 63 61 73 |own:. | ..cas|
|00004110| 65 20 61 75 74 6f 4b 65 | 79 3a 0d 09 09 09 09 44 |e autoKe|y:.....D|
|00004120| 6f 4b 65 79 44 6f 77 6e | 28 26 65 29 3b 0d 09 09 |oKeyDown|(&e);...|
|00004130| 09 09 62 72 65 61 6b 3b | 0d 20 20 20 20 20 20 09 |..break;|. .|
|00004140| 09 64 65 66 61 75 6c 74 | 3a 20 62 72 65 61 6b 3b |.default|: break;|
|00004150| 0d 0d 09 09 09 7d 09 2f | 2a 20 73 77 69 74 63 68 |.....}./|* switch|
|00004160| 20 2a 2f 0d 09 09 7d 09 | 2f 2a 20 69 66 20 2a 2f | */...}.|/* if */|
|00004170| 0d 09 72 65 74 75 72 6e | 20 31 3b 0d 7d 09 2f 2a |..return| 1;.}./*|
|00004180| 20 68 61 6e 64 6c 65 45 | 76 65 6e 74 20 2a 2f 0d | handleE|vent */.|
|00004190| 0d 0d 73 74 61 74 69 63 | 20 4f 53 45 72 72 20 53 |..static| OSErr S|
|000041a0| 65 74 75 70 4d 65 6e 75 | 73 28 76 6f 69 64 29 20 |etupMenu|s(void) |
|000041b0| 0d 7b 0d 09 4f 53 45 72 | 72 20 74 68 65 45 72 72 |.{..OSEr|r theErr|
|000041c0| 20 3d 20 6e 6f 45 72 72 | 3b 0d 09 48 61 6e 64 6c | = noErr|;..Handl|
|000041d0| 65 20 4d 79 4d 42 61 72 | 3b 0d 09 09 0d 09 4d 79 |e MyMBar|;.....My|
|000041e0| 4d 42 61 72 20 3d 20 47 | 65 74 4e 65 77 4d 42 61 |MBar = G|etNewMBa|
|000041f0| 72 28 31 32 38 29 3b 0d | 09 69 66 28 4d 79 4d 42 |r(128);.|.if(MyMB|
|00004200| 61 72 29 20 7b 0d 09 09 | 53 65 74 4d 65 6e 75 42 |ar) {...|SetMenuB|
|00004210| 61 72 28 4d 79 4d 42 61 | 72 29 3b 0d 09 09 41 64 |ar(MyMBa|r);...Ad|
|00004220| 64 52 65 73 4d 65 6e 75 | 28 47 65 74 4d 48 61 6e |dResMenu|(GetMHan|
|00004230| 64 6c 65 28 6b 41 70 70 | 6c 65 4d 65 6e 75 49 44 |dle(kApp|leMenuID|
|00004240| 29 2c 27 44 52 56 52 27 | 29 3b 0d 09 09 44 69 73 |),'DRVR'|);...Dis|
|00004250| 61 62 6c 65 49 74 65 6d | 28 47 65 74 4d 48 61 6e |ableItem|(GetMHan|
|00004260| 64 6c 65 28 6b 46 69 6c | 65 4d 65 6e 75 49 44 29 |dle(kFil|eMenuID)|
|00004270| 2c 20 6b 50 72 69 6e 74 | 43 6f 6d 6d 61 6e 64 29 |, kPrint|Command)|
|00004280| 3b 0d 09 09 44 72 61 77 | 4d 65 6e 75 42 61 72 28 |;...Draw|MenuBar(|
|00004290| 29 3b 0d 09 7d 20 65 6c | 73 65 20 7b 0d 09 09 74 |);..} el|se {...t|
|000042a0| 68 65 45 72 72 20 3d 20 | 6b 43 6f 75 6c 64 6e 74 |heErr = |kCouldnt|
|000042b0| 4c 6f 61 64 4d 65 6e 75 | 3b 0d 09 7d 0d 09 72 65 |LoadMenu|;..}..re|
|000042c0| 74 75 72 6e 20 74 68 65 | 45 72 72 3b 0d 7d 20 2f |turn the|Err;.} /|
|000042d0| 2a 20 53 65 74 75 70 4d | 65 6e 75 73 20 2a 2f 0d |* SetupM|enus */.|
|000042e0| 0d 73 74 61 74 69 63 20 | 76 6f 69 64 20 44 6f 4b |.static |void DoK|
|000042f0| 65 79 44 6f 77 6e 28 6d | 79 45 76 65 6e 74 29 20 |eyDown(m|yEvent) |
|00004300| 0d 09 45 76 65 6e 74 52 | 65 63 6f 72 64 20 2a 6d |..EventR|ecord *m|
|00004310| 79 45 76 65 6e 74 3b 20 | 0d 7b 0d 09 75 6e 73 69 |yEvent; |.{..unsi|
|00004320| 67 6e 65 64 20 63 68 61 | 72 20 63 68 61 72 43 6f |gned cha|r charCo|
|00004330| 64 65 20 3d 20 28 75 6e | 73 69 67 6e 65 64 20 63 |de = (un|signed c|
|00004340| 68 61 72 29 20 28 6d 79 | 45 76 65 6e 74 2d 3e 6d |har) (my|Event->m|
|00004350| 65 73 73 61 67 65 20 26 | 20 63 68 61 72 43 6f 64 |essage &| charCod|
|00004360| 65 4d 61 73 6b 29 3b 0d | 09 0d 09 69 66 20 28 6d |eMask);.|...if (m|
|00004370| 79 45 76 65 6e 74 2d 3e | 6d 6f 64 69 66 69 65 72 |yEvent->|modifier|
|00004380| 73 20 26 20 63 6d 64 4b | 65 79 29 20 0d 20 20 09 |s & cmdK|ey) . .|
|00004390| 7b 20 2f 2a 20 63 6f 6d | 6d 61 6e 64 20 6b 65 79 |{ /* com|mand key|
|000043a0| 20 2a 2f 0d 09 09 53 49 | 6e 74 33 32 20 6d 52 65 | */...SI|nt32 mRe|
|000043b0| 73 75 6c 74 20 3d 20 4d | 65 6e 75 4b 65 79 28 63 |sult = M|enuKey(c|
|000043c0| 68 61 72 43 6f 64 65 29 | 3b 0d 09 09 53 49 6e 74 |harCode)|;...SInt|
|000043d0| 31 36 20 74 68 65 4d 65 | 6e 75 20 3d 20 48 69 57 |16 theMe|nu = HiW|
|000043e0| 6f 72 64 28 6d 52 65 73 | 75 6c 74 29 3b 20 0d 09 |ord(mRes|ult); ..|
|000043f0| 09 53 49 6e 74 31 36 20 | 74 68 65 49 74 65 6d 20 |.SInt16 |theItem |
|00004400| 3d 20 4c 6f 57 6f 72 64 | 28 6d 52 65 73 75 6c 74 |= LoWord|(mResult|
|00004410| 29 3b 0d 09 09 64 6f 43 | 6f 6d 6d 61 6e 64 28 74 |);...doC|ommand(t|
|00004420| 68 65 4d 65 6e 75 2c 20 | 74 68 65 49 74 65 6d 29 |heMenu, |theItem)|
|00004430| 3b 0d 09 7d 0d 09 72 65 | 74 75 72 6e 20 3b 0d 7d |;..}..re|turn ;.}|
|00004440| 09 2f 2a 20 4b 65 79 44 | 6f 77 6e 20 2a 2f 0d 0d |./* KeyD|own */..|
|00004450| 0d 2f 2a 0d 20 20 20 44 | 69 73 70 6c 61 79 20 74 |./*. D|isplay t|
|00004460| 68 65 20 41 62 6f 75 74 | 20 64 69 61 6c 6f 67 2e |he About| dialog.|
|00004470| 0d 2a 2f 0d 73 74 61 74 | 69 63 20 76 6f 69 64 20 |.*/.stat|ic void |
|00004480| 73 68 6f 77 41 62 6f 75 | 74 4d 65 44 69 61 6c 6f |showAbou|tMeDialo|
|00004490| 67 28 29 20 0d 7b 0d 20 | 20 47 72 61 66 50 74 72 |g() .{. | GrafPtr|
|000044a0| 20 73 61 76 65 50 6f 72 | 74 3b 0d 20 20 53 49 6e | savePor|t;. SIn|
|000044b0| 74 31 36 20 69 74 65 6d | 48 69 74 3b 0d 20 20 44 |t16 item|Hit;. D|
|000044c0| 69 61 6c 6f 67 50 74 72 | 20 74 68 65 44 69 61 6c |ialogPtr| theDial|
|000044d0| 6f 67 3b 0d 0d 20 20 47 | 65 74 50 6f 72 74 28 26 |og;.. G|etPort(&|
|000044e0| 73 61 76 65 50 6f 72 74 | 29 3b 0d 20 20 74 68 65 |savePort|);. the|
|000044f0| 44 69 61 6c 6f 67 20 3d | 20 47 65 74 4e 65 77 44 |Dialog =| GetNewD|
|00004500| 69 61 6c 6f 67 28 6b 41 | 62 6f 75 74 4d 65 44 4c |ialog(kA|boutMeDL|
|00004510| 4f 47 2c 20 4e 55 4c 4c | 2c 20 28 57 69 6e 64 6f |OG, NULL|, (Windo|
|00004520| 77 50 74 72 29 20 2d 31 | 29 3b 0d 20 20 53 65 74 |wPtr) -1|);. Set|
|00004530| 50 6f 72 74 28 74 68 65 | 44 69 61 6c 6f 67 29 3b |Port(the|Dialog);|
|00004540| 0d 0d 20 20 64 6f 20 7b | 20 4d 6f 64 61 6c 44 69 |.. do {| ModalDi|
|00004550| 61 6c 6f 67 28 4e 55 4c | 4c 2c 20 26 69 74 65 6d |alog(NUL|L, &item|
|00004560| 48 69 74 29 3b 20 7d 20 | 77 68 69 6c 65 20 28 69 |Hit); } |while (i|
|00004570| 74 65 6d 48 69 74 20 21 | 3d 20 6b 4f 4b 42 75 74 |temHit !|= kOKBut|
|00004580| 74 6f 6e 29 3b 0d 0d 20 | 20 43 6c 6f 73 65 44 69 |ton);.. | CloseDi|
|00004590| 61 6c 6f 67 28 74 68 65 | 44 69 61 6c 6f 67 29 3b |alog(the|Dialog);|
|000045a0| 0d 0d 20 20 53 65 74 50 | 6f 72 74 28 73 61 76 65 |.. SetP|ort(save|
|000045b0| 50 6f 72 74 29 3b 0d 20 | 20 72 65 74 75 72 6e 3b |Port);. | return;|
|000045c0| 0d 7d 09 2f 2a 20 73 68 | 6f 77 41 62 6f 75 74 4d |.}./* sh|owAboutM|
|000045d0| 65 44 69 61 6c 6f 67 20 | 2a 2f 0d 0d 2f 2a 0d 20 |eDialog |*/../*. |
|000045e0| 2a 20 50 72 6f 63 65 73 | 73 20 4d 65 6e 75 20 53 |* Proces|s Menu S|
|000045f0| 65 6c 65 63 74 69 6f 6e | 73 0d 2a 2f 0d 73 74 61 |election|s.*/.sta|
|00004600| 74 69 63 20 76 6f 69 64 | 20 64 6f 43 6f 6d 6d 61 |tic void| doComma|
|00004610| 6e 64 28 53 49 6e 74 31 | 36 20 74 68 65 4d 65 6e |nd(SInt1|6 theMen|
|00004620| 75 2c 53 49 6e 74 31 36 | 20 74 68 65 49 74 65 6d |u,SInt16| theItem|
|00004630| 29 0d 7b 0d 4f 53 45 72 | 72 20 74 68 65 45 72 72 |).{.OSEr|r theErr|
|00004640| 20 3d 20 6e 6f 45 72 72 | 20 3b 0d 0d 09 20 20 73 | = noErr| ;... s|
|00004650| 77 69 74 63 68 20 28 74 | 68 65 4d 65 6e 75 29 20 |witch (t|heMenu) |
|00004660| 0d 09 20 20 7b 0d 09 20 | 20 20 20 63 61 73 65 20 |.. {.. | case |
|00004670| 6b 41 70 70 6c 65 4d 65 | 6e 75 49 44 3a 0d 09 20 |kAppleMe|nuID:.. |
|00004680| 20 20 20 20 20 69 66 20 | 28 74 68 65 49 74 65 6d | if |(theItem|
|00004690| 20 3d 3d 20 6b 41 62 6f | 75 74 4d 65 43 6f 6d 6d | == kAbo|utMeComm|
|000046a0| 61 6e 64 29 20 0d 09 20 | 20 20 20 20 20 7b 0d 09 |and) .. | {..|
|000046b0| 20 20 20 20 20 20 20 20 | 09 73 68 6f 77 41 62 6f | |.showAbo|
|000046c0| 75 74 4d 65 44 69 61 6c | 6f 67 28 29 3b 0d 09 20 |utMeDial|og();.. |
|000046d0| 20 20 20 20 20 7d 0d 09 | 20 20 20 20 20 20 65 6c | }..| el|
|000046e0| 73 65 20 0d 09 20 20 20 | 20 20 20 7b 0d 09 20 20 |se .. | {.. |
|000046f0| 20 20 20 20 20 20 47 72 | 61 66 50 74 72 20 73 61 | Gr|afPtr sa|
|00004700| 76 65 50 6f 72 74 3b 0d | 09 20 20 20 20 20 20 20 |vePort;.|. |
|00004710| 20 53 74 72 32 35 35 20 | 64 61 4e 61 6d 65 3b 0d | Str255 |daName;.|
|00004720| 09 20 20 20 20 20 20 20 | 20 47 65 74 49 74 65 6d |. | GetItem|
|00004730| 28 47 65 74 4d 48 61 6e | 64 6c 65 28 6b 41 70 70 |(GetMHan|dle(kApp|
|00004740| 6c 65 4d 65 6e 75 49 44 | 29 2c 20 74 68 65 49 74 |leMenuID|), theIt|
|00004750| 65 6d 2c 20 64 61 4e 61 | 6d 65 29 3b 0d 09 20 20 |em, daNa|me);.. |
|00004760| 20 20 20 20 20 20 47 65 | 74 50 6f 72 74 28 26 73 | Ge|tPort(&s|
|00004770| 61 76 65 50 6f 72 74 29 | 3b 0d 09 20 20 20 20 20 |avePort)|;.. |
|00004780| 20 20 20 28 76 6f 69 64 | 29 20 4f 70 65 6e 44 65 | (void|) OpenDe|
|00004790| 73 6b 41 63 63 28 64 61 | 4e 61 6d 65 29 3b 0d 09 |skAcc(da|Name);..|
|000047a0| 20 20 20 20 20 20 20 20 | 53 65 74 50 6f 72 74 28 | |SetPort(|
|000047b0| 73 61 76 65 50 6f 72 74 | 29 3b 0d 09 20 20 20 20 |savePort|);.. |
|000047c0| 20 20 7d 0d 09 20 20 20 | 20 20 20 62 72 65 61 6b | }.. | break|
|000047d0| 3b 0d 09 0d 09 20 20 20 | 20 63 61 73 65 20 6b 46 |;.... | case kF|
|000047e0| 69 6c 65 4d 65 6e 75 49 | 44 3a 0d 09 20 20 20 20 |ileMenuI|D:.. |
|000047f0| 20 20 73 77 69 74 63 68 | 20 28 74 68 65 49 74 65 | switch| (theIte|
|00004800| 6d 29 20 0d 09 20 20 20 | 20 20 20 7b 0d 09 20 20 |m) .. | {.. |
|00004810| 20 20 20 20 20 20 63 61 | 73 65 20 6b 4f 70 65 6e | ca|se kOpen|
|00004820| 43 6f 6d 6d 61 6e 64 3a | 0d 09 09 09 09 44 6f 54 |Command:|.....DoT|
|00004830| 68 65 4f 70 65 6e 43 6f | 6d 6d 61 6e 64 28 29 3b |heOpenCo|mmand();|
|00004840| 0d 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 20 20 20 |.....bre|ak;.. |
|00004850| 20 20 20 20 20 63 61 73 | 65 20 6b 53 61 76 65 43 | cas|e kSaveC|
|00004860| 6f 6d 6d 61 6e 64 3a 0d | 09 09 09 09 62 72 65 61 |ommand:.|....brea|
|00004870| 6b 3b 0d 09 20 20 20 20 | 20 20 20 20 63 61 73 65 |k;.. | case|
|00004880| 20 6b 50 61 67 65 53 65 | 74 75 70 43 6f 6d 6d 61 | kPageSe|tupComma|
|00004890| 6e 64 3a 0d 09 09 09 09 | 09 09 09 09 0d 09 09 09 |nd:.....|........|
|000048a0| 09 50 72 4f 70 65 6e 28 | 29 3b 0d 09 09 09 09 74 |.PrOpen(|);.....t|
|000048b0| 68 65 45 72 72 20 3d 20 | 50 72 45 72 72 6f 72 28 |heErr = |PrError(|
|000048c0| 29 3b 0d 09 09 09 09 09 | 0d 09 09 09 09 69 66 28 |);......|.....if(|
|000048d0| 74 68 65 45 72 72 20 3d | 3d 20 6e 6f 45 72 72 20 |theErr =|= noErr |
|000048e0| 29 7b 0d 09 09 09 09 09 | 50 72 56 61 6c 69 64 61 |){......|PrValida|
|000048f0| 74 65 28 20 67 50 72 69 | 6e 74 65 72 52 65 63 6f |te( gPri|nterReco|
|00004900| 72 64 20 29 3b 0d 09 09 | 09 09 09 74 68 65 45 72 |rd );...|...theEr|
|00004910| 72 20 3d 20 50 72 45 72 | 72 6f 72 28 29 3b 09 0d |r = PrEr|ror();..|
|00004920| 09 09 09 09 7d 0d 0d 09 | 09 09 09 69 66 28 74 68 |....}...|...if(th|
|00004930| 65 45 72 72 20 3d 3d 20 | 6e 6f 45 72 72 29 7b 0d |eErr == |noErr){.|
|00004940| 09 09 09 09 09 50 72 53 | 74 6c 44 69 61 6c 6f 67 |.....PrS|tlDialog|
|00004950| 28 67 50 72 69 6e 74 65 | 72 52 65 63 6f 72 64 29 |(gPrinte|rRecord)|
|00004960| 3b 0d 09 09 09 09 09 74 | 68 65 45 72 72 20 3d 20 |;......t|heErr = |
|00004970| 50 72 45 72 72 6f 72 28 | 29 3b 0d 09 09 09 09 7d |PrError(|);.....}|
|00004980| 0d 09 09 09 09 50 72 43 | 6c 6f 73 65 28 29 3b 0d |.....PrC|lose();.|
|00004990| 09 09 09 09 0d 09 09 09 | 09 69 66 28 74 68 65 45 |........|.if(theE|
|000049a0| 72 72 20 21 3d 20 6e 6f | 45 72 72 29 7b 0d 09 09 |rr != no|Err){...|
|000049b0| 09 09 09 53 74 72 32 35 | 35 20 73 63 72 61 74 63 |...Str25|5 scratc|
|000049c0| 68 53 74 72 69 6e 67 3b | 0d 09 09 09 09 09 4e 75 |hString;|......Nu|
|000049d0| 6d 54 6f 53 74 72 69 6e | 67 28 28 6c 6f 6e 67 29 |mToStrin|g((long)|
|000049e0| 74 68 65 45 72 72 2c 20 | 73 63 72 61 74 63 68 53 |theErr, |scratchS|
|000049f0| 74 72 69 6e 67 29 3b 0d | 09 09 09 09 09 50 61 72 |tring);.|.....Par|
|00004a00| 61 6d 54 65 78 74 28 22 | 5c 70 54 68 65 72 65 20 |amText("|\pThere |
|00004a10| 77 61 73 20 61 20 70 72 | 69 6e 74 20 6d 61 6e 61 |was a pr|int mana|
|00004a20| 67 65 72 20 65 72 72 6f | 72 2e 22 2c 20 73 63 72 |ger erro|r.", scr|
|00004a30| 61 74 63 68 53 74 72 69 | 6e 67 2c 20 22 5c 70 22 |atchStri|ng, "\p"|
|00004a40| 2c 20 22 5c 70 22 29 3b | 0d 09 09 09 09 09 41 6c |, "\p");|......Al|
|00004a50| 65 72 74 28 6b 47 65 6e | 65 72 69 63 45 72 72 6f |ert(kGen|ericErro|
|00004a60| 72 2c 20 4e 55 4c 4c 29 | 3b 09 0d 09 09 09 09 7d |r, NULL)|;......}|
|00004a70| 0d 09 09 09 09 62 72 65 | 61 6b 3b 0d 09 20 20 20 |.....bre|ak;.. |
|00004a80| 20 20 20 20 20 63 61 73 | 65 20 6b 50 72 69 6e 74 | cas|e kPrint|
|00004a90| 43 6f 6d 6d 61 6e 64 3a | 0d 09 09 09 09 74 68 65 |Command:|.....the|
|00004aa0| 45 72 72 20 3d 20 50 72 | 69 6e 74 28 67 54 68 65 |Err = Pr|int(gThe|
|00004ab0| 4a 50 45 47 49 6d 61 67 | 65 2c 20 67 50 72 69 6e |JPEGImag|e, gPrin|
|00004ac0| 74 65 72 52 65 63 6f 72 | 64 29 3b 0d 09 09 09 09 |terRecor|d);.....|
|00004ad0| 0d 09 09 09 09 69 66 28 | 74 68 65 45 72 72 20 21 |.....if(|theErr !|
|00004ae0| 3d 20 6e 6f 45 72 72 29 | 7b 0d 09 09 09 09 09 53 |= noErr)|{......S|
|00004af0| 74 72 32 35 35 20 73 63 | 72 61 74 63 68 53 74 72 |tr255 sc|ratchStr|
|00004b00| 69 6e 67 3b 0d 09 09 09 | 09 09 4e 75 6d 54 6f 53 |ing;....|..NumToS|
|00004b10| 74 72 69 6e 67 28 28 6c | 6f 6e 67 29 74 68 65 45 |tring((l|ong)theE|
|00004b20| 72 72 2c 20 73 63 72 61 | 74 63 68 53 74 72 69 6e |rr, scra|tchStrin|
|00004b30| 67 29 3b 0d 09 09 09 09 | 09 50 61 72 61 6d 54 65 |g);.....|.ParamTe|
|00004b40| 78 74 28 22 5c 70 54 68 | 65 72 65 20 77 61 73 20 |xt("\pTh|ere was |
|00004b50| 61 6e 20 65 72 72 6f 72 | 20 64 75 72 69 6e 67 20 |an error| during |
|00004b60| 70 72 69 6e 74 69 6e 67 | 2e 22 2c 20 73 63 72 61 |printing|.", scra|
|00004b70| 74 63 68 53 74 72 69 6e | 67 2c 20 22 5c 70 22 2c |tchStrin|g, "\p",|
|00004b80| 20 22 5c 70 22 29 3b 0d | 09 09 09 09 09 41 6c 65 | "\p");.|.....Ale|
|00004b90| 72 74 28 6b 47 65 6e 65 | 72 69 63 45 72 72 6f 72 |rt(kGene|ricError|
|00004ba0| 2c 20 4e 55 4c 4c 29 3b | 09 0d 09 09 09 09 7d 0d |, NULL);|......}.|
|00004bb0| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 20 20 20 20 |....brea|k;.. |
|00004bc0| 20 20 20 20 63 61 73 65 | 20 6b 51 75 69 74 43 6f | case| kQuitCo|
|00004bd0| 6d 6d 61 6e 64 3a 0d 09 | 09 09 09 45 78 69 74 54 |mmand:..|...ExitT|
|00004be0| 6f 53 68 65 6c 6c 28 29 | 3b 0d 09 09 09 09 62 72 |oShell()|;.....br|
|00004bf0| 65 61 6b 3b 0d 09 20 20 | 20 20 20 20 20 20 64 65 |eak;.. | de|
|00004c00| 66 61 75 6c 74 3a 0d 09 | 20 20 20 20 20 20 20 20 |fault:..| |
|00004c10| 09 62 72 65 61 6b 3b 0d | 09 20 20 20 20 20 20 7d |.break;.|. }|
|00004c20| 0d 09 20 20 20 20 20 20 | 62 72 65 61 6b 3b 0d 09 |.. |break;..|
|00004c30| 0d 09 20 20 20 20 63 61 | 73 65 20 6b 45 64 69 74 |.. ca|se kEdit|
|00004c40| 4d 65 6e 75 49 44 3a 0d | 09 20 20 20 20 20 20 2f |MenuID:.|. /|
|00004c50| 2a 0d 09 20 20 20 20 20 | 20 20 2a 20 52 75 6e 20 |*.. | * Run |
|00004c60| 74 68 69 73 20 74 68 72 | 6f 75 67 68 20 53 79 73 |this thr|ough Sys|
|00004c70| 74 65 6d 45 64 69 74 20 | 66 69 72 73 74 2e 0d 09 |temEdit |first...|
|00004c80| 20 20 20 20 20 20 20 2a | 20 53 79 73 74 65 6d 45 | *| SystemE|
|00004c90| 64 69 74 20 77 69 6c 6c | 20 72 65 74 75 72 6e 20 |dit will| return |
|00004ca0| 46 41 4c 53 45 20 69 66 | 20 69 74 27 73 20 6e 6f |FALSE if| it's no|
|00004cb0| 74 20 61 20 73 79 73 74 | 65 6d 20 77 69 6e 64 6f |t a syst|em windo|
|00004cc0| 77 2e 0d 09 20 20 20 20 | 20 20 20 2a 2f 0d 09 20 |w... | */.. |
|00004cd0| 20 20 20 20 20 69 66 20 | 28 53 79 73 74 65 6d 45 | if |(SystemE|
|00004ce0| 64 69 74 28 74 68 65 49 | 74 65 6d 2d 31 29 29 20 |dit(theI|tem-1)) |
|00004cf0| 62 72 65 61 6b 3b 0d 09 | 09 0d 09 20 20 20 20 64 |break;..|... d|
|00004d00| 65 66 61 75 6c 74 3a 0d | 09 20 20 20 20 20 20 62 |efault:.|. b|
|00004d10| 72 65 61 6b 3b 0d 09 20 | 20 20 20 7d 20 2f 2a 20 |reak;.. | } /* |
|00004d20| 73 77 69 74 63 68 20 74 | 68 65 4d 65 6e 75 20 2a |switch t|heMenu *|
|00004d30| 2f 0d 09 0d 09 20 20 48 | 69 6c 69 74 65 4d 65 6e |/.... H|iliteMen|
|00004d40| 75 28 30 29 3b 0d 09 20 | 20 72 65 74 75 72 6e 3b |u(0);.. | return;|
|00004d50| 0d 7d 09 2f 2a 20 64 6f | 43 6f 6d 6d 61 6e 64 20 |.}./* do|Command |
|00004d60| 2a 2f 0d 0d 0d 73 74 61 | 74 69 63 20 4f 53 45 72 |*/...sta|tic OSEr|
|00004d70| 72 20 50 72 69 6e 74 28 | 4a 50 45 47 49 6d 61 67 |r Print(|JPEGImag|
|00004d80| 65 20 74 68 65 4a 50 45 | 47 49 6d 61 67 65 2c 20 |e theJPE|GImage, |
|00004d90| 20 54 48 50 72 69 6e 74 | 20 20 74 68 65 50 72 69 | THPrint| thePri|
|00004da0| 6e 74 52 65 63 6f 72 64 | 29 0d 7b 0d 4f 53 45 72 |ntRecord|).{.OSEr|
|00004db0| 72 20 74 68 65 44 72 61 | 77 69 6e 67 45 72 72 20 |r theDra|wingErr |
|00004dc0| 3d 20 6e 6f 45 72 72 3b | 0d 4f 53 45 72 72 20 61 |= noErr;|.OSErr a|
|00004dd0| 50 72 69 6e 74 69 6e 67 | 45 72 72 20 3d 20 6e 6f |Printing|Err = no|
|00004de0| 45 72 72 3b 0d 0d 47 72 | 61 66 50 74 72 20 6f 6c |Err;..Gr|afPtr ol|
|00004df0| 64 50 6f 72 74 3b 0d 54 | 50 72 53 74 61 74 75 73 |dPort;.T|PrStatus|
|00004e00| 20 74 68 65 50 72 69 6e | 74 65 72 53 74 61 74 75 | thePrin|terStatu|
|00004e10| 73 3b 0d 54 50 50 72 50 | 6f 72 74 20 50 72 69 6e |s;.TPPrP|ort Prin|
|00004e20| 74 65 72 50 6f 72 74 3b | 0d 42 6f 6f 6c 65 61 6e |terPort;|.Boolean|
|00004e30| 20 4f 4b 54 6f 50 72 69 | 6e 74 3b 0d 0d 09 47 65 | OKToPri|nt;...Ge|
|00004e40| 74 50 6f 72 74 28 20 26 | 6f 6c 64 50 6f 72 74 20 |tPort( &|oldPort |
|00004e50| 29 3b 20 0d 09 09 09 0d | 09 50 72 4f 70 65 6e 28 |); .....|.PrOpen(|
|00004e60| 29 3b 0d 09 09 0d 09 69 | 66 28 20 50 72 45 72 72 |);.....i|f( PrErr|
|00004e70| 6f 72 28 29 20 3d 3d 20 | 6e 6f 45 72 72 29 7b 0d |or() == |noErr){.|
|00004e80| 09 09 50 72 56 61 6c 69 | 64 61 74 65 28 74 68 65 |..PrVali|date(the|
|00004e90| 50 72 69 6e 74 52 65 63 | 6f 72 64 29 3b 0d 09 09 |PrintRec|ord);...|
|00004ea0| 69 66 28 20 50 72 45 72 | 72 6f 72 28 29 20 3d 3d |if( PrEr|ror() ==|
|00004eb0| 20 6e 6f 45 72 72 29 7b | 0d 09 09 09 4f 4b 54 6f | noErr){|....OKTo|
|00004ec0| 50 72 69 6e 74 20 3d 20 | 50 72 4a 6f 62 44 69 61 |Print = |PrJobDia|
|00004ed0| 6c 6f 67 28 74 68 65 50 | 72 69 6e 74 52 65 63 6f |log(theP|rintReco|
|00004ee0| 72 64 29 3b 0d 09 09 09 | 69 66 28 4f 4b 54 6f 50 |rd);....|if(OKToP|
|00004ef0| 72 69 6e 74 29 7b 0d 09 | 09 09 09 50 72 69 6e 74 |rint){..|...Print|
|00004f00| 65 72 50 6f 72 74 20 3d | 20 50 72 4f 70 65 6e 44 |erPort =| PrOpenD|
|00004f10| 6f 63 28 74 68 65 50 72 | 69 6e 74 52 65 63 6f 72 |oc(thePr|intRecor|
|00004f20| 64 2c 4e 55 4c 4c 2c 4e | 55 4c 4c 29 3b 0d 09 09 |d,NULL,N|ULL);...|
|00004f30| 09 09 69 66 28 50 72 45 | 72 72 6f 72 28 29 20 3d |..if(PrE|rror() =|
|00004f40| 3d 20 6e 6f 45 72 72 29 | 7b 0d 09 09 09 09 09 50 |= noErr)|{......P|
|00004f50| 72 4f 70 65 6e 50 61 67 | 65 28 50 72 69 6e 74 65 |rOpenPag|e(Printe|
|00004f60| 72 50 6f 72 74 2c 4e 55 | 4c 4c 29 3b 0d 09 09 09 |rPort,NU|LL);....|
|00004f70| 09 09 69 66 28 50 72 45 | 72 72 6f 72 28 29 20 3d |..if(PrE|rror() =|
|00004f80| 3d 20 6e 6f 45 72 72 29 | 7b 0d 09 09 09 09 09 09 |= noErr)|{.......|
|00004f90| 74 68 65 44 72 61 77 69 | 6e 67 45 72 72 20 3d 20 |theDrawi|ngErr = |
|00004fa0| 44 72 61 77 4a 50 45 47 | 49 6d 61 67 65 28 74 68 |DrawJPEG|Image(th|
|00004fb0| 65 4a 50 45 47 49 6d 61 | 67 65 2c 49 53 43 4f 4c |eJPEGIma|ge,ISCOL|
|00004fc0| 4f 52 50 4f 52 54 28 28 | 47 72 61 66 50 74 72 29 |ORPORT((|GrafPtr)|
|00004fd0| 50 72 69 6e 74 65 72 50 | 6f 72 74 29 29 3b 0d 09 |PrinterP|ort));..|
|00004fe0| 09 09 09 09 7d 0d 09 09 | 09 09 09 50 72 43 6c 6f |....}...|...PrClo|
|00004ff0| 73 65 50 61 67 65 28 50 | 72 69 6e 74 65 72 50 6f |sePage(P|rinterPo|
|00005000| 72 74 29 3b 0d 09 09 09 | 09 7d 0d 09 09 09 09 50 |rt);....|.}.....P|
|00005010| 72 43 6c 6f 73 65 44 6f | 63 28 50 72 69 6e 74 65 |rCloseDo|c(Printe|
|00005020| 72 50 6f 72 74 29 3b 0d | 09 09 09 09 69 66 28 20 |rPort);.|....if( |
|00005030| 0d 09 09 09 09 09 28 20 | 28 2a 74 68 65 50 72 69 |......( |(*thePri|
|00005040| 6e 74 52 65 63 6f 72 64 | 29 2d 3e 70 72 4a 6f 62 |ntRecord|)->prJob|
|00005050| 2e 62 4a 44 6f 63 4c 6f | 6f 70 20 3d 3d 20 62 53 |.bJDocLo|op == bS|
|00005060| 70 6f 6f 6c 4c 6f 6f 70 | 20 29 20 26 26 20 0d 09 |poolLoop| ) && ..|
|00005070| 09 09 09 09 28 20 50 72 | 45 72 72 6f 72 28 29 20 |....( Pr|Error() |
|00005080| 3d 3d 20 6e 6f 45 72 72 | 20 29 0d 09 09 09 09 29 |== noErr| ).....)|
|00005090| 7b 0d 09 09 09 09 09 50 | 72 50 69 63 46 69 6c 65 |{......P|rPicFile|
|000050a0| 28 74 68 65 50 72 69 6e | 74 52 65 63 6f 72 64 2c |(thePrin|tRecord,|
|000050b0| 4e 55 4c 4c 2c 4e 55 4c | 4c 2c 4e 55 4c 4c 2c 20 |NULL,NUL|L,NULL, |
|000050c0| 26 74 68 65 50 72 69 6e | 74 65 72 53 74 61 74 75 |&thePrin|terStatu|
|000050d0| 73 29 3b 0d 09 09 09 09 | 7d 0d 09 09 09 7d 0d 09 |s);.....|}....}..|
|000050e0| 09 7d 20 0d 09 7d 0d 09 | 61 50 72 69 6e 74 69 6e |.} ..}..|aPrintin|
|000050f0| 67 45 72 72 20 3d 20 50 | 72 45 72 72 6f 72 28 29 |gErr = P|rError()|
|00005100| 3b 0d 09 50 72 43 6c 6f | 73 65 28 29 3b 0d 09 53 |;..PrClo|se();..S|
|00005110| 65 74 50 6f 72 74 28 6f | 6c 64 50 6f 72 74 29 3b |etPort(o|ldPort);|
|00005120| 0d 09 72 65 74 75 72 6e | 20 28 20 28 61 50 72 69 |..return| ( (aPri|
|00005130| 6e 74 69 6e 67 45 72 72 | 20 3d 3d 20 6e 6f 45 72 |ntingErr| == noEr|
|00005140| 72 29 20 3f 20 74 68 65 | 44 72 61 77 69 6e 67 45 |r) ? the|DrawingE|
|00005150| 72 72 20 3a 20 61 50 72 | 69 6e 74 69 6e 67 45 72 |rr : aPr|intingEr|
|00005160| 72 29 20 3b 0d 7d 09 2f | 2a 20 50 72 69 6e 74 20 |r) ;.}./|* Print |
|00005170| 2a 2f 0d 0d 2f 2f 20 54 | 68 69 73 20 69 73 20 6f |*/..// T|his is o|
|00005180| 75 72 20 64 61 74 61 20 | 6c 6f 61 64 69 6e 67 20 |ur data |loading |
|00005190| 70 72 6f 63 65 64 75 72 | 65 20 74 6f 20 6c 6f 61 |procedur|e to loa|
|000051a0| 64 20 74 68 65 20 64 61 | 74 61 20 6f 66 66 20 74 |d the da|ta off t|
|000051b0| 68 65 20 64 69 73 6b 20 | 6f 6e 20 61 6e 20 61 73 |he disk |on an as|
|000051c0| 20 6e 65 65 64 65 64 20 | 62 61 73 69 73 2e 0d 2f | needed |basis../|
|000051d0| 2f 20 49 74 20 77 69 6c | 6c 20 62 65 20 63 61 6c |/ It wil|l be cal|
|000051e0| 6c 65 64 20 62 79 20 51 | 75 69 63 6b 54 69 6d 65 |led by Q|uickTime|
|000051f0| 20 61 73 20 61 20 72 65 | 73 75 6c 74 20 6f 66 20 | as a re|sult of |
|00005200| 6f 75 72 20 53 74 64 50 | 69 78 20 6f 72 20 46 44 |our StdP|ix or FD|
|00005210| 65 63 6f 6d 70 72 65 73 | 73 20 66 75 6e 63 74 69 |ecompres|s functi|
|00005220| 6f 6e 20 63 61 6c 6c 2e | 0d 0d 73 74 61 74 69 63 |on call.|..static|
|00005230| 20 70 61 73 63 61 6c 20 | 4f 53 45 72 72 20 4d 79 | pascal |OSErr My|
|00005240| 44 61 74 61 4c 6f 61 64 | 69 6e 67 50 72 6f 63 28 |DataLoad|ingProc(|
|00005250| 50 74 72 20 2a 64 61 74 | 61 50 2c 20 6c 6f 6e 67 |Ptr *dat|aP, long|
|00005260| 20 62 79 74 65 73 4e 65 | 65 64 65 64 2c 20 6c 6f | bytesNe|eded, lo|
|00005270| 6e 67 20 72 65 66 63 6f | 6e 29 0d 7b 0d 09 4f 53 |ng refco|n).{..OS|
|00005280| 45 72 72 20 74 68 65 45 | 72 72 20 3d 20 6e 6f 45 |Err theE|rr = noE|
|00005290| 72 72 3b 0d 09 0d 09 69 | 66 28 64 61 74 61 50 20 |rr;....i|f(dataP |
|000052a0| 21 3d 20 4e 55 4c 4c 29 | 7b 0d 09 09 44 61 74 61 |!= NULL)|{...Data|
|000052b0| 4c 6f 61 64 50 74 72 20 | 74 68 65 44 61 74 61 4c |LoadPtr |theDataL|
|000052c0| 6f 61 64 50 74 72 20 3d | 20 28 44 61 74 61 4c 6f |oadPtr =| (DataLo|
|000052d0| 61 64 50 74 72 29 72 65 | 66 63 6f 6e 3b 0d 09 09 |adPtr)re|fcon;...|
|000052e0| 50 74 72 20 74 68 65 44 | 61 74 61 42 75 66 66 65 |Ptr theD|ataBuffe|
|000052f0| 72 50 20 3d 20 53 74 72 | 69 70 41 64 64 72 65 73 |rP = Str|ipAddres|
|00005300| 73 28 2a 28 74 68 65 44 | 61 74 61 4c 6f 61 64 50 |s(*(theD|ataLoadP|
|00005310| 74 72 2d 3e 74 68 65 44 | 61 74 61 42 75 66 66 65 |tr->theD|ataBuffe|
|00005320| 72 48 29 29 3b 0d 09 09 | 6c 6f 6e 67 20 74 68 65 |rH));...|long the|
|00005330| 42 75 66 66 65 72 53 69 | 7a 65 20 3d 20 74 68 65 |BufferSi|ze = the|
|00005340| 44 61 74 61 4c 6f 61 64 | 50 74 72 2d 3e 74 68 65 |DataLoad|Ptr->the|
|00005350| 42 75 66 66 65 72 53 69 | 7a 65 3b 0d 09 09 73 68 |BufferSi|ze;...sh|
|00005360| 6f 72 74 20 74 68 65 52 | 65 66 4e 75 6d 20 3d 20 |ort theR|efNum = |
|00005370| 74 68 65 44 61 74 61 4c | 6f 61 64 50 74 72 2d 3e |theDataL|oadPtr->|
|00005380| 74 68 65 52 65 66 4e 75 | 6d 3b 0d 09 09 09 09 0d |theRefNu|m;......|
|00005390| 09 09 2f 2f 20 63 61 6c | 63 75 6c 61 74 65 20 74 |..// cal|culate t|
|000053a0| 68 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 62 79 74 |he numbe|r of byt|
|000053b0| 65 73 20 6c 65 66 74 20 | 69 6e 20 6f 75 72 20 65 |es left |in our e|
|000053c0| 78 69 73 74 69 6e 67 20 | 64 61 74 61 20 62 75 66 |xisting |data buf|
|000053d0| 66 65 72 2e 20 54 68 69 | 73 20 69 73 0d 09 09 2f |fer. Thi|s is.../|
|000053e0| 2f 20 74 68 65 20 73 69 | 7a 65 20 6f 66 20 74 68 |/ the si|ze of th|
|000053f0| 65 20 62 75 66 66 65 72 | 20 69 74 73 65 6c 66 20 |e buffer| itself |
|00005400| 6d 69 6e 75 73 20 74 68 | 65 20 64 69 73 74 61 6e |minus th|e distan|
|00005410| 63 65 20 77 65 20 61 72 | 65 20 66 72 6f 6d 20 74 |ce we ar|e from t|
|00005420| 68 65 20 73 74 61 72 74 | 0d 09 09 2f 2f 20 6f 66 |he start|...// of|
|00005430| 20 74 68 65 20 62 75 66 | 66 65 72 2e 0d 0d 09 09 | the buf|fer.....|
|00005440| 6c 6f 6e 67 20 62 79 74 | 65 73 41 76 61 69 6c 20 |long byt|esAvail |
|00005450| 3d 20 74 68 65 42 75 66 | 66 65 72 53 69 7a 65 20 |= theBuf|ferSize |
|00005460| 2d 20 28 2a 64 61 74 61 | 50 20 2d 20 74 68 65 44 |- (*data|P - theD|
|00005470| 61 74 61 42 75 66 66 65 | 72 50 29 3b 0d 09 09 0d |ataBuffe|rP);....|
|00005480| 09 09 2f 2f 20 64 6f 20 | 77 65 20 61 6c 72 65 61 |..// do |we alrea|
|00005490| 64 79 20 68 61 76 65 20 | 65 6e 6f 75 67 68 20 62 |dy have |enough b|
|000054a0| 79 74 65 73 20 69 6e 20 | 6f 75 72 20 62 75 66 66 |ytes in |our buff|
|000054b0| 65 72 20 66 6f 72 20 74 | 68 69 73 20 63 61 6c 6c |er for t|his call|
|000054c0| 20 74 6f 20 6f 75 72 20 | 64 61 74 61 20 6c 6f 61 | to our |data loa|
|000054d0| 64 69 6e 67 0d 09 09 2f | 2f 20 70 72 6f 63 65 64 |ding.../|/ proced|
|000054e0| 75 72 65 3f 20 49 66 20 | 73 6f 20 77 65 20 64 6f |ure? If |so we do|
|000054f0| 6e 27 74 20 6e 65 65 64 | 20 74 6f 20 72 65 61 64 |n't need| to read|
|00005500| 20 61 6e 79 20 61 64 64 | 69 74 69 6f 6e 61 6c 20 | any add|itional |
|00005510| 64 61 74 61 2e 0d 09 09 | 69 66 28 62 79 74 65 73 |data....|if(bytes|
|00005520| 4e 65 65 64 65 64 20 3e | 20 62 79 74 65 73 41 76 |Needed >| bytesAv|
|00005530| 61 69 6c 29 7b 0d 09 09 | 0d 09 09 09 2f 2f 20 77 |ail){...|....// w|
|00005540| 65 20 63 6f 6d 65 20 68 | 65 72 65 20 69 66 20 77 |e come h|ere if w|
|00005550| 65 20 64 6f 6e 27 74 20 | 68 61 76 65 20 65 6e 6f |e don't |have eno|
|00005560| 75 67 68 20 62 79 74 65 | 73 20 6f 66 20 64 61 74 |ugh byte|s of dat|
|00005570| 61 20 69 6e 20 6f 75 72 | 20 62 75 66 66 65 72 2e |a in our| buffer.|
|00005580| 20 46 69 72 73 74 0d 09 | 09 09 2f 2f 20 66 69 67 | First..|..// fig|
|00005590| 75 72 65 20 6f 75 74 20 | 68 6f 77 20 6d 61 6e 79 |ure out |how many|
|000055a0| 20 62 79 74 65 73 20 77 | 65 20 73 68 6f 75 6c 64 | bytes w|e should|
|000055b0| 20 72 65 61 64 20 74 6f | 20 72 65 66 69 6c 6c 20 | read to| refill |
|000055c0| 75 70 20 74 68 65 20 62 | 75 66 66 65 72 2e 0d 09 |up the b|uffer...|
|000055d0| 09 09 6c 6f 6e 67 20 62 | 79 74 65 73 54 6f 52 65 |..long b|ytesToRe|
|000055e0| 61 64 20 3d 20 74 68 65 | 42 75 66 66 65 72 53 69 |ad = the|BufferSi|
|000055f0| 7a 65 20 2d 20 62 79 74 | 65 73 41 76 61 69 6c 3b |ze - byt|esAvail;|
|00005600| 0d 0d 09 09 09 2f 2f 20 | 69 66 20 74 68 65 72 65 |.....// |if there|
|00005610| 20 61 72 65 20 62 79 74 | 65 73 20 61 76 61 69 6c | are byt|es avail|
|00005620| 61 62 6c 65 20 61 74 20 | 74 68 65 20 65 6e 64 20 |able at |the end |
|00005630| 6f 66 20 6f 75 72 20 62 | 75 66 66 65 72 20 74 68 |of our b|uffer th|
|00005640| 65 6e 20 6d 6f 76 65 20 | 74 68 65 6d 0d 09 09 09 |en move |them....|
|00005650| 2f 2f 20 74 6f 20 74 68 | 65 20 62 65 67 69 6e 6e |// to th|e beginn|
|00005660| 69 6e 67 20 6f 66 20 74 | 68 65 20 62 75 66 66 65 |ing of t|he buffe|
|00005670| 72 20 0d 09 09 09 69 66 | 28 62 79 74 65 73 41 76 |r ....if|(bytesAv|
|00005680| 61 69 6c 29 20 42 6c 6f | 63 6b 4d 6f 76 65 28 2a |ail) Blo|ckMove(*|
|00005690| 64 61 74 61 50 2c 74 68 | 65 44 61 74 61 42 75 66 |dataP,th|eDataBuf|
|000056a0| 66 65 72 50 2c 20 62 79 | 74 65 73 41 76 61 69 6c |ferP, by|tesAvail|
|000056b0| 29 3b 0d 09 09 09 0d 09 | 09 09 2f 2f 20 6e 6f 77 |);......|..// now|
|000056c0| 20 67 6f 20 61 68 65 61 | 64 20 61 6e 64 20 66 69 | go ahea|d and fi|
|000056d0| 6c 6c 20 75 70 20 74 68 | 65 20 72 65 6d 61 69 6e |ll up th|e remain|
|000056e0| 64 65 72 20 6f 66 20 74 | 68 65 20 62 75 66 66 65 |der of t|he buffe|
|000056f0| 72 2c 20 73 74 61 72 74 | 69 6e 67 20 61 74 20 74 |r, start|ing at t|
|00005700| 68 65 0d 09 09 09 2f 2f | 20 6c 6f 63 61 74 69 6f |he....//| locatio|
|00005710| 6e 20 6a 75 73 74 20 61 | 66 74 65 72 20 74 68 65 |n just a|fter the|
|00005720| 20 6c 61 73 74 20 76 61 | 6c 69 64 20 62 79 74 65 | last va|lid byte|
|00005730| 20 69 6e 20 74 68 65 20 | 62 75 66 66 65 72 0d 09 | in the |buffer..|
|00005740| 09 09 74 68 65 45 72 72 | 20 3d 20 46 53 52 65 61 |..theErr| = FSRea|
|00005750| 64 28 74 68 65 52 65 66 | 4e 75 6d 2c 20 26 62 79 |d(theRef|Num, &by|
|00005760| 74 65 73 54 6f 52 65 61 | 64 2c 20 74 68 65 44 61 |tesToRea|d, theDa|
|00005770| 74 61 42 75 66 66 65 72 | 50 20 2b 20 62 79 74 65 |taBuffer|P + byte|
|00005780| 73 41 76 61 69 6c 29 3b | 0d 09 09 09 0d 09 09 09 |sAvail);|........|
|00005790| 2f 2f 20 69 67 6e 6f 72 | 65 20 65 6e 64 20 6f 66 |// ignor|e end of|
|000057a0| 20 66 69 6c 65 20 65 72 | 72 6f 72 73 0d 09 09 09 | file er|rors....|
|000057b0| 69 66 28 74 68 65 45 72 | 72 20 3d 3d 20 65 6f 66 |if(theEr|r == eof|
|000057c0| 45 72 72 29 74 68 65 45 | 72 72 20 3d 20 6e 6f 45 |Err)theE|rr = noE|
|000057d0| 72 72 3b 0d 09 09 09 0d | 09 09 09 2f 2f 20 77 65 |rr;.....|...// we|
|000057e0| 20 72 65 73 65 74 20 74 | 68 65 20 64 61 74 61 20 | reset t|he data |
|000057f0| 70 6f 69 6e 74 65 72 20 | 75 73 65 64 20 62 79 20 |pointer |used by |
|00005800| 74 68 65 20 63 61 6c 6c | 65 72 20 6f 66 20 74 68 |the call|er of th|
|00005810| 65 20 64 61 74 61 20 6c | 6f 61 64 69 6e 67 20 66 |e data l|oading f|
|00005820| 75 6e 63 74 69 6f 6e 0d | 09 09 09 2f 2f 20 73 6f |unction.|...// so|
|00005830| 20 74 68 61 74 20 69 74 | 20 70 6f 69 6e 74 73 20 | that it| points |
|00005840| 74 6f 20 74 68 65 20 66 | 69 72 73 74 20 62 79 74 |to the f|irst byt|
|00005850| 65 20 6f 66 20 76 61 6c | 69 64 20 64 61 74 61 2c |e of val|id data,|
|00005860| 20 77 68 69 63 68 20 69 | 73 20 74 68 65 20 62 65 | which i|s the be|
|00005870| 67 69 6e 6e 69 6e 67 20 | 6f 66 20 6f 75 72 20 62 |ginning |of our b|
|00005880| 75 66 66 65 72 2e 0d 09 | 09 09 2a 64 61 74 61 50 |uffer...|..*dataP|
|00005890| 20 3d 20 74 68 65 44 61 | 74 61 42 75 66 66 65 72 | = theDa|taBuffer|
|000058a0| 50 3b 0d 09 09 7d 0d 09 | 7d 65 6c 73 65 7b 0d 09 |P;...}..|}else{..|
|000058b0| 09 2f 2f 20 43 6f 6d 65 | 20 68 65 72 65 20 66 6f |.// Come| here fo|
|000058c0| 72 20 74 68 65 20 64 61 | 74 61 20 6d 61 72 6b 20 |r the da|ta mark |
|000058d0| 72 65 73 65 74 20 63 61 | 73 65 2e 20 54 68 65 20 |reset ca|se. The |
|000058e0| 69 6d 70 6c 65 6d 65 6e | 74 61 74 69 6f 6e 20 77 |implemen|tation w|
|000058f0| 65 20 61 72 65 20 70 72 | 6f 76 69 64 69 6e 67 20 |e are pr|oviding |
|00005900| 68 65 72 65 0d 09 09 2f | 2f 20 64 6f 65 73 6e 27 |here.../|/ doesn'|
|00005910| 74 20 6b 6e 6f 77 20 68 | 6f 77 20 74 6f 20 72 65 |t know h|ow to re|
|00005920| 73 65 74 20 74 68 65 20 | 73 74 72 65 61 6d 20 73 |set the |stream s|
|00005930| 6f 20 77 65 20 72 65 74 | 75 72 6e 20 61 6e 20 65 |o we ret|urn an e|
|00005940| 72 72 6f 72 2e 20 49 20 | 68 61 76 65 6e 27 74 20 |rror. I |haven't |
|00005950| 73 65 65 6e 0d 09 09 2f | 2f 20 61 20 64 61 74 61 |seen.../|/ a data|
|00005960| 20 6d 61 72 6b 20 72 65 | 73 65 74 20 61 73 20 70 | mark re|set as p|
|00005970| 61 72 74 20 6f 66 20 4a | 50 45 47 20 64 65 63 6f |art of J|PEG deco|
|00005980| 64 69 6e 67 2e 0d 09 09 | 0d 09 09 2f 2f 20 4e 6f |ding....|...// No|
|00005990| 74 20 68 61 6e 64 6c 69 | 6e 67 20 74 68 65 20 64 |t handli|ng the d|
|000059a0| 61 74 61 20 6d 61 72 6b | 20 72 65 73 65 74 20 63 |ata mark| reset c|
|000059b0| 61 73 65 20 73 6c 6f 77 | 73 20 64 6f 77 6e 20 50 |ase slow|s down P|
|000059c0| 68 6f 74 6f 43 44 20 73 | 69 67 6e 69 66 69 63 61 |hotoCD s|ignifica|
|000059d0| 6e 74 6c 79 2e 0d 09 09 | 2f 2f 20 44 65 6d 6f 6e |ntly....|// Demon|
|000059e0| 73 74 72 61 74 69 6e 67 | 20 68 6f 77 20 74 6f 20 |strating| how to |
|000059f0| 64 6f 20 74 68 69 73 20 | 62 65 74 74 65 72 20 77 |do this |better w|
|00005a00| 69 6c 6c 20 68 61 76 65 | 20 74 6f 20 77 61 69 74 |ill have| to wait|
|00005a10| 20 66 6f 72 20 61 6e 6f | 74 68 65 72 20 61 72 74 | for ano|ther art|
|00005a20| 69 63 6c 65 2e 0d 09 09 | 74 68 65 45 72 72 20 3d |icle....|theErr =|
|00005a30| 20 2d 31 3b 0d 09 7d 0d | 09 72 65 74 75 72 6e 20 | -1;..}.|.return |
|00005a40| 74 68 65 45 72 72 3b 0d | 7d 0d 0d 0d 2f 2f 20 53 |theErr;.|}...// S|
|00005a50| 65 74 4a 50 45 47 42 6f | 75 6e 64 73 20 73 65 74 |etJPEGBo|unds set|
|00005a60| 73 20 27 74 68 65 42 6f | 75 6e 64 73 27 20 66 69 |s 'theBo|unds' fi|
|00005a70| 65 6c 64 20 6f 66 20 74 | 68 65 20 4a 50 45 47 20 |eld of t|he JPEG |
|00005a80| 64 61 74 61 20 73 74 72 | 75 63 74 75 72 65 2e 20 |data str|ucture. |
|00005a90| 54 68 69 73 20 72 65 6c | 69 65 73 20 6f 6e 20 74 |This rel|ies on t|
|00005aa0| 68 65 0d 2f 2f 20 49 6d | 61 67 65 44 65 73 63 72 |he.// Im|ageDescr|
|00005ab0| 69 70 74 69 6f 6e 20 66 | 69 65 6c 64 20 68 61 76 |iption f|ield hav|
|00005ac0| 69 6e 67 20 61 6c 72 65 | 61 64 79 20 62 65 65 6e |ing alre|ady been|
|00005ad0| 20 66 69 6c 6c 65 64 20 | 69 6e 2e 0d 73 74 61 74 | filled |in..stat|
|00005ae0| 69 63 20 20 4f 53 45 72 | 72 20 53 65 74 4a 50 45 |ic OSEr|r SetJPE|
|00005af0| 47 42 6f 75 6e 64 73 28 | 4a 50 45 47 49 6d 61 67 |GBounds(|JPEGImag|
|00005b00| 65 20 2a 74 68 65 4a 50 | 45 47 49 6d 61 67 65 29 |e *theJP|EGImage)|
|00005b10| 0d 7b 0d 09 52 65 63 74 | 20 2a 74 68 65 42 6f 75 |.{..Rect| *theBou|
|00005b20| 6e 64 73 20 3d 20 26 28 | 2a 74 68 65 4a 50 45 47 |nds = &(|*theJPEG|
|00005b30| 49 6d 61 67 65 29 2e 74 | 68 65 42 6f 75 6e 64 73 |Image).t|heBounds|
|00005b40| 3b 0d 09 49 6d 61 67 65 | 44 65 73 63 72 69 70 74 |;..Image|Descript|
|00005b50| 69 6f 6e 48 61 6e 64 6c | 65 20 74 68 65 44 65 73 |ionHandl|e theDes|
|00005b60| 63 20 3d 20 28 2a 74 68 | 65 4a 50 45 47 49 6d 61 |c = (*th|eJPEGIma|
|00005b70| 67 65 29 2e 74 68 65 44 | 65 73 63 3b 0d 09 0d 09 |ge).theD|esc;....|
|00005b80| 69 66 28 74 68 65 44 65 | 73 63 20 3d 3d 20 4e 55 |if(theDe|sc == NU|
|00005b90| 4c 4c 29 72 65 74 75 72 | 6e 20 6b 41 70 70 45 72 |LL)retur|n kAppEr|
|00005ba0| 72 6f 72 3b 0d 09 0d 09 | 74 68 65 42 6f 75 6e 64 |ror;....|theBound|
|00005bb0| 73 2d 3e 74 6f 70 20 3d | 20 74 68 65 42 6f 75 6e |s->top =| theBoun|
|00005bc0| 64 73 2d 3e 6c 65 66 74 | 20 3d 20 30 3b 0d 09 0d |ds->left| = 0;...|
|00005bd0| 09 74 68 65 42 6f 75 6e | 64 73 2d 3e 72 69 67 68 |.theBoun|ds->righ|
|00005be0| 74 20 3d 20 20 28 2a 74 | 68 65 44 65 73 63 29 2d |t = (*t|heDesc)-|
|00005bf0| 3e 77 69 64 74 68 3b 0d | 09 74 68 65 42 6f 75 6e |>width;.|.theBoun|
|00005c00| 64 73 2d 3e 62 6f 74 74 | 6f 6d 20 3d 20 28 2a 74 |ds->bott|om = (*t|
|00005c10| 68 65 44 65 73 63 29 2d | 3e 68 65 69 67 68 74 3b |heDesc)-|>height;|
|00005c20| 0d 09 72 65 74 75 72 6e | 20 6e 6f 45 72 72 3b 0d |..return| noErr;.|
|00005c30| 7d 09 2f 2a 20 53 65 74 | 4a 50 45 47 42 6f 75 6e |}./* Set|JPEGBoun|
|00005c40| 64 73 20 2a 2f 0d 0d 2f | 2f 20 4d 61 6b 65 4a 50 |ds */../|/ MakeJP|
|00005c50| 45 47 49 6d 61 67 65 44 | 65 73 63 72 69 70 74 69 |EGImageD|escripti|
|00005c60| 6f 6e 20 63 72 65 61 74 | 65 73 20 61 20 51 75 69 |on creat|es a Qui|
|00005c70| 63 6b 54 69 6d 65 20 69 | 6d 61 67 65 20 64 65 73 |ckTime i|mage des|
|00005c80| 63 72 69 70 74 69 6f 6e | 20 72 65 63 6f 72 64 20 |cription| record |
|00005c90| 62 61 73 65 64 20 6f 6e | 20 74 68 65 20 4a 50 45 |based on| the JPE|
|00005ca0| 47 20 64 61 74 61 2e 0d | 73 74 61 74 69 63 20 20 |G data..|static |
|00005cb0| 4f 53 45 72 72 20 4d 61 | 6b 65 4a 50 45 47 49 6d |OSErr Ma|keJPEGIm|
|00005cc0| 61 67 65 44 65 73 63 72 | 69 70 74 69 6f 6e 28 4a |ageDescr|iption(J|
|00005cd0| 50 45 47 49 6d 61 67 65 | 20 2a 74 68 65 4a 50 45 |PEGImage| *theJPE|
|00005ce0| 47 49 6d 61 67 65 29 20 | 0d 7b 0d 09 4f 53 45 72 |GImage) |.{..OSEr|
|00005cf0| 72 20 74 68 65 45 72 72 | 20 3d 20 6e 6f 45 72 72 |r theErr| = noErr|
|00005d00| 3b 0d 09 43 6f 64 65 63 | 49 6e 66 6f 20 74 68 65 |;..Codec|Info the|
|00005d10| 49 6e 66 6f 3b 0d 09 73 | 68 6f 72 74 20 77 69 64 |Info;..s|hort wid|
|00005d20| 74 68 2c 68 65 69 67 68 | 74 3b 0d 09 49 6d 61 67 |th,heigh|t;..Imag|
|00005d30| 65 44 65 73 63 72 69 70 | 74 69 6f 6e 48 61 6e 64 |eDescrip|tionHand|
|00005d40| 6c 65 20 64 65 73 63 3b | 0d 09 63 68 61 72 09 2a |le desc;|..char.*|
|00005d50| 73 63 61 6e 44 61 74 61 | 3b 0d 09 6c 6f 6e 67 09 |scanData|;..long.|
|00005d60| 68 52 65 73 20 3d 20 37 | 32 4c 3c 3c 31 36 20 2c |hRes = 7|2L<<16 ,|
|00005d70| 20 76 52 65 73 20 3d 20 | 37 32 4c 3c 3c 31 36 3b | vRes = |72L<<16;|
|00005d80| 0d 09 73 68 6f 72 74 09 | 64 65 70 74 68 20 3d 20 |..short.|depth = |
|00005d90| 33 32 3b 0d 0d 09 6c 6f | 6e 67 09 64 61 74 61 41 |32;...lo|ng.dataA|
|00005da0| 6d 74 54 6f 52 65 61 64 | 2c 66 69 6c 65 73 69 7a |mtToRead|,filesiz|
|00005db0| 65 3b 0d 09 48 61 6e 64 | 6c 65 20 74 68 65 44 61 |e;..Hand|le theDa|
|00005dc0| 74 61 42 75 66 66 65 72 | 48 20 3d 28 28 44 61 74 |taBuffer|H =((Dat|
|00005dd0| 61 4c 6f 61 64 50 74 72 | 29 67 54 68 65 49 43 4d |aLoadPtr|)gTheICM|
|00005de0| 44 61 74 61 50 72 6f 63 | 52 65 63 6f 72 64 2e 64 |DataProc|Record.d|
|00005df0| 61 74 61 52 65 66 43 6f | 6e 29 2d 3e 74 68 65 44 |ataRefCo|n)->theD|
|00005e00| 61 74 61 42 75 66 66 65 | 72 48 3b 0d 09 50 74 72 |ataBuffe|rH;..Ptr|
|00005e10| 20 74 68 65 44 61 74 61 | 50 74 72 3b 0d 09 0d 09 | theData|Ptr;....|
|00005e20| 69 66 28 28 2a 74 68 65 | 4a 50 45 47 49 6d 61 67 |if((*the|JPEGImag|
|00005e30| 65 29 2e 74 68 65 44 65 | 73 63 20 3d 3d 20 4e 55 |e).theDe|sc == NU|
|00005e40| 4c 4c 29 7b 0d 09 09 28 | 2a 74 68 65 4a 50 45 47 |LL){...(|*theJPEG|
|00005e50| 49 6d 61 67 65 29 2e 74 | 68 65 44 65 73 63 20 3d |Image).t|heDesc =|
|00005e60| 20 28 49 6d 61 67 65 44 | 65 73 63 72 69 70 74 69 | (ImageD|escripti|
|00005e70| 6f 6e 48 61 6e 64 6c 65 | 29 4e 65 77 48 61 6e 64 |onHandle|)NewHand|
|00005e80| 6c 65 28 73 69 7a 65 6f | 66 28 49 6d 61 67 65 44 |le(sizeo|f(ImageD|
|00005e90| 65 73 63 72 69 70 74 69 | 6f 6e 29 29 3b 0d 09 09 |escripti|on));...|
|00005ea0| 69 66 28 28 2a 74 68 65 | 4a 50 45 47 49 6d 61 67 |if((*the|JPEGImag|
|00005eb0| 65 29 2e 74 68 65 44 65 | 73 63 20 3d 3d 20 4e 55 |e).theDe|sc == NU|
|00005ec0| 4c 4c 20 7c 7c 20 28 4d | 65 6d 45 72 72 6f 72 28 |LL || (M|emError(|
|00005ed0| 29 20 21 3d 20 6e 6f 45 | 72 72 29 29 7b 0d 09 09 |) != noE|rr)){...|
|00005ee0| 09 74 68 65 45 72 72 20 | 3d 20 69 4d 65 6d 46 75 |.theErr |= iMemFu|
|00005ef0| 6c 6c 45 72 72 3b 0d 09 | 09 09 72 65 74 75 72 6e |llErr;..|..return|
|00005f00| 20 74 68 65 45 72 72 3b | 0d 09 09 7d 0d 09 7d 0d | theErr;|...}..}.|
|00005f10| 09 0d 09 48 4c 6f 63 6b | 28 74 68 65 44 61 74 61 |...HLock|(theData|
|00005f20| 42 75 66 66 65 72 48 29 | 3b 0d 09 74 68 65 44 61 |BufferH)|;..theDa|
|00005f30| 74 61 50 74 72 20 3d 20 | 53 74 72 69 70 41 64 64 |taPtr = |StripAdd|
|00005f40| 72 65 73 73 28 2a 74 68 | 65 44 61 74 61 42 75 66 |ress(*th|eDataBuf|
|00005f50| 66 65 72 48 29 3b 0d 09 | 0d 09 2f 2f 20 6d 61 6b |ferH);..|..// mak|
|00005f60| 65 20 73 75 72 65 20 77 | 65 20 61 72 65 20 70 6f |e sure w|e are po|
|00005f70| 69 6e 74 65 64 20 74 6f | 20 74 68 65 20 62 65 67 |inted to| the beg|
|00005f80| 69 6e 6e 69 6e 67 20 6f | 66 20 74 68 65 20 66 69 |inning o|f the fi|
|00005f90| 6c 65 20 74 6f 20 72 65 | 61 64 2e 09 0d 09 74 68 |le to re|ad....th|
|00005fa0| 65 45 72 72 20 3d 20 53 | 65 74 46 50 6f 73 28 74 |eErr = S|etFPos(t|
|00005fb0| 68 65 4a 50 45 47 49 6d | 61 67 65 2d 3e 74 68 65 |heJPEGIm|age->the|
|00005fc0| 52 65 66 4e 75 6d 2c 20 | 66 73 46 72 6f 6d 53 74 |RefNum, |fsFromSt|
|00005fd0| 61 72 74 2c 20 30 29 3b | 0d 09 0d 09 2f 2f 20 67 |art, 0);|....// g|
|00005fe0| 65 74 20 74 68 65 20 73 | 69 7a 65 20 6f 66 20 74 |et the s|ize of t|
|00005ff0| 68 65 20 66 69 6c 65 0d | 09 69 66 28 74 68 65 45 |he file.|.if(theE|
|00006000| 72 72 20 3d 3d 20 6e 6f | 45 72 72 29 74 68 65 45 |rr == no|Err)theE|
|00006010| 72 72 20 3d 20 47 65 74 | 45 4f 46 28 74 68 65 4a |rr = Get|EOF(theJ|
|00006020| 50 45 47 49 6d 61 67 65 | 2d 3e 74 68 65 52 65 66 |PEGImage|->theRef|
|00006030| 4e 75 6d 2c 20 26 66 69 | 6c 65 73 69 7a 65 29 3b |Num, &fi|lesize);|
|00006040| 09 09 0d 09 0d 09 2f 2f | 20 61 67 61 69 6e 2c 20 |......//| again, |
|00006050| 6d 61 6b 65 20 73 75 72 | 65 20 77 65 20 61 72 65 |make sur|e we are|
|00006060| 20 70 6f 69 6e 74 65 64 | 20 74 6f 20 74 68 65 20 | pointed| to the |
|00006070| 62 65 67 69 6e 6e 69 6e | 67 20 6f 66 20 74 68 65 |beginnin|g of the|
|00006080| 20 66 69 6c 65 20 74 6f | 20 72 65 61 64 2e 09 0d | file to| read...|
|00006090| 09 69 66 28 74 68 65 45 | 72 72 20 3d 3d 20 6e 6f |.if(theE|rr == no|
|000060a0| 45 72 72 29 74 68 65 45 | 72 72 20 3d 20 53 65 74 |Err)theE|rr = Set|
|000060b0| 46 50 6f 73 28 74 68 65 | 4a 50 45 47 49 6d 61 67 |FPos(the|JPEGImag|
|000060c0| 65 2d 3e 74 68 65 52 65 | 66 4e 75 6d 2c 20 66 73 |e->theRe|fNum, fs|
|000060d0| 46 72 6f 6d 53 74 61 72 | 74 2c 20 30 29 3b 0d 0d |FromStar|t, 0);..|
|000060e0| 09 2f 2f 20 77 65 20 65 | 69 74 68 65 72 20 72 65 |.// we e|ither re|
|000060f0| 61 64 20 61 6c 6c 20 74 | 68 65 20 64 61 74 61 20 |ad all t|he data |
|00006100| 6f 72 20 61 20 77 68 6f | 6c 65 20 62 75 66 66 65 |or a who|le buffe|
|00006110| 72 20 66 75 6c 6c 2c 20 | 64 65 70 65 6e 64 69 6e |r full, |dependin|
|00006120| 67 20 6f 6e 20 77 68 65 | 74 68 65 72 20 69 74 20 |g on whe|ther it |
|00006130| 66 69 74 73 20 69 6e 20 | 6f 75 72 20 62 75 66 66 |fits in |our buff|
|00006140| 65 72 2e 0d 09 64 61 74 | 61 41 6d 74 54 6f 52 65 |er...dat|aAmtToRe|
|00006150| 61 64 20 3d 20 4d 49 4e | 28 66 69 6c 65 73 69 7a |ad = MIN|(filesiz|
|00006160| 65 2c 28 28 44 61 74 61 | 4c 6f 61 64 50 74 72 29 |e,((Data|LoadPtr)|
|00006170| 67 54 68 65 49 43 4d 44 | 61 74 61 50 72 6f 63 52 |gTheICMD|ataProcR|
|00006180| 65 63 6f 72 64 2e 64 61 | 74 61 52 65 66 43 6f 6e |ecord.da|taRefCon|
|00006190| 29 2d 3e 74 68 65 42 75 | 66 66 65 72 53 69 7a 65 |)->theBu|fferSize|
|000061a0| 29 3b 0d 0d 09 2f 2f 20 | 67 6f 20 61 68 65 61 64 |);...// |go ahead|
|000061b0| 20 61 6e 64 20 72 65 61 | 64 20 74 68 65 20 64 61 | and rea|d the da|
|000061c0| 74 61 2e 0d 09 69 66 28 | 74 68 65 45 72 72 20 3d |ta...if(|theErr =|
|000061d0| 3d 20 6e 6f 45 72 72 29 | 74 68 65 45 72 72 20 3d |= noErr)|theErr =|
|000061e0| 20 46 53 52 65 61 64 28 | 74 68 65 4a 50 45 47 49 | FSRead(|theJPEGI|
|000061f0| 6d 61 67 65 2d 3e 74 68 | 65 52 65 66 4e 75 6d 2c |mage->th|eRefNum,|
|00006200| 20 26 64 61 74 61 41 6d | 74 54 6f 52 65 61 64 2c | &dataAm|tToRead,|
|00006210| 74 68 65 44 61 74 61 50 | 74 72 29 3b 0d 09 09 0d |theDataP|tr);....|
|00006220| 09 2f 2f 20 53 63 61 6e | 20 74 68 65 20 4a 50 45 |.// Scan| the JPE|
|00006230| 47 20 69 6d 61 67 65 20 | 64 61 74 61 20 61 6e 64 |G image |data and|
|00006240| 20 66 69 6e 64 20 74 68 | 65 20 77 69 64 74 68 2c | find th|e width,|
|00006250| 20 68 65 69 67 68 74 2c | 20 72 65 73 6f 6c 75 74 | height,| resolut|
|00006260| 69 6f 6e 2c 20 61 6e 64 | 20 64 65 70 74 68 20 6f |ion, and| depth o|
|00006270| 66 20 74 68 65 20 69 6d | 61 67 65 2e 0d 09 0d 09 |f the im|age.....|
|00006280| 2f 2f 20 4e 6f 74 65 20 | 74 68 61 74 20 4d 61 72 |// Note |that Mar|
|00006290| 6b 65 72 44 65 74 65 63 | 74 20 77 61 73 20 77 72 |kerDetec|t was wr|
|000062a0| 69 74 74 65 6e 20 74 6f | 20 65 78 70 65 63 74 20 |itten to| expect |
|000062b0| 74 68 61 74 20 74 68 65 | 20 70 6f 69 6e 74 65 72 |that the| pointer|
|000062c0| 20 74 6f 20 74 68 65 20 | 62 75 66 66 65 72 20 70 | to the |buffer p|
|000062d0| 61 73 73 65 64 20 69 6e | 20 70 6f 69 6e 74 73 20 |assed in| points |
|000062e0| 74 6f 0d 09 2f 2f 20 20 | 61 20 62 75 66 66 65 72 |to..// |a buffer|
|000062f0| 20 77 69 74 68 20 61 6c | 6c 20 74 68 65 20 4a 50 | with al|l the JP|
|00006300| 45 47 20 64 61 74 61 2e | 20 48 65 72 65 20 77 65 |EG data.| Here we|
|00006310| 20 6f 6e 6c 79 20 68 61 | 76 65 20 31 20 64 61 74 | only ha|ve 1 dat|
|00006320| 61 20 62 75 66 66 65 72 | 27 73 20 77 6f 72 74 68 |a buffer|'s worth|
|00006330| 2e 20 54 68 69 73 20 69 | 73 6e 27 74 20 61 20 70 |. This i|sn't a p|
|00006340| 72 6f 62 6c 65 6d 20 68 | 65 72 65 0d 09 2f 2f 20 |roblem h|ere..// |
|00006350| 73 69 6e 63 65 20 33 32 | 6b 20 28 6f 75 72 20 6d |since 32|k (our m|
|00006360| 69 6e 69 6d 75 6d 20 62 | 75 66 66 65 72 20 73 69 |inimum b|uffer si|
|00006370| 7a 65 29 20 73 68 6f 75 | 6c 64 20 63 6f 6e 74 61 |ze) shou|ld conta|
|00006380| 69 6e 20 61 6c 6c 20 74 | 68 65 20 69 6e 66 6f 72 |in all t|he infor|
|00006390| 6d 61 74 69 6f 6e 20 77 | 65 20 61 72 65 20 73 63 |mation w|e are sc|
|000063a0| 61 6e 6e 69 6e 67 20 66 | 6f 72 2e 0d 0d 09 2f 2f |anning f|or....//|
|000063b0| 20 54 68 65 20 63 6f 6d | 6d 65 6e 74 20 69 6e 20 | The com|ment in |
|000063c0| 4d 61 72 6b 65 72 44 65 | 74 65 63 74 20 74 68 61 |MarkerDe|tect tha|
|000063d0| 74 20 69 74 20 72 65 74 | 75 72 6e 73 20 61 20 70 |t it ret|urns a p|
|000063e0| 6f 69 6e 74 65 72 20 74 | 6f 20 74 68 65 20 62 65 |ointer t|o the be|
|000063f0| 67 69 6e 6e 69 6e 67 20 | 6f 66 20 74 68 65 20 69 |ginning |of the i|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.