home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / csmpdigest / csmp-digest-v3-042 < prev    next >
Text File  |  2010-09-21  |  67KB  |  1,850 lines

  1. Received-Date: Tue, 5 Jul 1994 14:50:40 +0200
  2. From: pottier@clipper.ens.fr (Francois Pottier)
  3. Subject: csmp-digest-v3-042
  4. To: csmp-digest@ens.fr
  5. Date: Tue, 5 Jul 1994 14:50:36 +0200 (MET DST)
  6. X-Mailer: ELM [version 2.4 PL23]
  7. Mime-Version: 1.0
  8. Content-Type: text/plain; charset=ISO-8859-1
  9. Content-Transfer-Encoding: 8bit
  10. Errors-To: listman@ens.fr
  11. Reply-To: pottier@clipper.ens.fr
  12. X-Sequence: 45
  13.  
  14. C.S.M.P. Digest             Tue, 05 Jul 94       Volume 3 : Issue 42
  15.  
  16. Today's Topics:
  17.  
  18.         **Novice Question on saving files**
  19.         CODE Resources
  20.         Code Resources with CodeWarrior
  21.         MacTCP DNR for PowerPC?
  22.         Major bug with Symantec CDK *Please Read*
  23.         Perspective in GX (was Re: can toolbox draw text at an angle?)
  24.         Still trouble finding floating windows code.
  25.         _vSyncWait infinite loop?
  26.         can toolbox draw text at an angle?
  27.  
  28.  
  29.  
  30. The Comp.Sys.Mac.Programmer Digest is moderated by Francois Pottier
  31. (pottier@clipper.ens.fr).
  32.  
  33. The digest is a collection of article threads from the internet newsgroup
  34. comp.sys.mac.programmer.  It is designed for people who read c.s.m.p. semi-
  35. regularly and want an archive of the discussions.  If you don't know what a
  36. newsgroup is, you probably don't have access to it.  Ask your systems
  37. administrator(s) for details.  If you don't have access to news, you may
  38. still be able to post messages to the group by using a mail server like
  39. anon.penet.fi (mail help@anon.penet.fi for more information).
  40.  
  41. Each issue of the digest contains one or more sets of articles (called
  42. threads), with each set corresponding to a 'discussion' of a particular
  43. subject.  The articles are not edited; all articles included in this digest
  44. are in their original posted form (as received by our news server at
  45. nef.ens.fr).  Article threads are not added to the digest until the last
  46. article added to the thread is at least two weeks old (this is to ensure that
  47. the thread is dead before adding it to the digest).  Article threads that
  48. consist of only one message are generally not included in the digest.
  49.  
  50. The digest is officially distributed by two means, by email and ftp.
  51.  
  52. If you want to receive the digest by mail, send email to listserv@ens.fr
  53. with no subject and one of the following commands as body:
  54.     help                        Sends you a summary of commands
  55.     subscribe csmp-digest Your Name    Adds you to the mailing list
  56.     signoff csmp-digest            Removes you from the list
  57. Once you have subscribed, you will automatically receive each new
  58. issue as it is created.
  59.  
  60. The official ftp info is //ftp.dartmouth.edu/pub/csmp-digest.
  61. Questions related to the ftp site should be directed to
  62. scott.silver@dartmouth.edu. Currently no previous volumes of the CSMP
  63. digest are available there.
  64.  
  65. Also, the digests are available to WAIS users.  To search back issues
  66. with WAIS, use comp.sys.mac.programmer.src. With Mosaic, use
  67. http://www.wais.com/wais-dbs/comp.sys.mac.programmer.html.
  68.  
  69.  
  70. -------------------------------------------------------
  71.  
  72. >From ftrogers@eos.ncsu.edu (FRANKLIN TAREK ROGERS)
  73. Subject: **Novice Question on saving files**
  74. Date: 21 Jun 1994 13:21:32 GMT
  75. Organization: North Carolina State University, Project Eos
  76.  
  77.  
  78.  
  79.  
  80. I'm trying to save data into a file, and am having trouble understanding
  81. the underlying concepts.  Inside Macintosh "Files"  gives a verty detailed
  82. discussion on the subject, but all example deal only with TextEdit.
  83.   The FSWrite command takes a pointer to a data buffer:
  84.     What is a data buffer?  Just any allocated block of memory?
  85.  
  86. The data I wish to save is all contained within one data structure,
  87. (memory allocated with NewPointer).  Basically what I've got is:
  88.     typedef struct myStruct
  89.     {
  90.         StringPtr aString1, aString2...
  91.     }
  92.  
  93. Is a data struct of strings considered a data buffer my the OS or do I need
  94. to cram my info into some particular form.  Also, how would I find the
  95. size of the data buffer when not TextEdit?
  96.  
  97. Thanks,
  98. F. Tarek Rogers
  99. ftrogers@eos.ncsu.edu
  100.  
  101. +++++++++++++++++++++++++++
  102.  
  103. >From Rick_Holzgrafe@taligent.com (Rick Holzgrafe)
  104. Date: Tue, 21 Jun 1994 18:38:58 GMT
  105. Organization: Semicolon Software
  106.  
  107. In article <2u6pgs$k9c@taco.cc.ncsu.edu>, ftrogers@eos.ncsu.edu (FRANKLIN
  108. TAREK ROGERS) wrote:
  109.  
  110. > I'm trying to save data into a file, and am having trouble understanding
  111. > the underlying concepts.  Inside Macintosh "Files"  gives a verty detailed
  112. > discussion on the subject, but all example deal only with TextEdit.
  113. >   The FSWrite command takes a pointer to a data buffer:
  114. >     What is a data buffer?  Just any allocated block of memory?
  115.  
  116. Right. The pointer can in fact point to any memory you please, even to a
  117. local variable if that's what you want to write out.
  118.  
  119. > The data I wish to save is all contained within one data structure,
  120. > (memory allocated with NewPointer).  Basically what I've got is:
  121. >     typedef struct myStruct
  122. >     {
  123. >         StringPtr aString1, aString2...
  124. >     }
  125.  
  126. You could write out the entire struct by passing a pointer to it to
  127. FSWrite, getting its size from 'sizeof myStruct'. However, that's not what
  128. you want to do, because your structure contains only the pointers to the
  129. strings, and not the strings' contents. To write out the strings, call
  130. FSWrite once for each string, like this:
  131.  
  132.    long dataLength = (((long)myStruct.aString1[0]) & 0xff) + 1;
  133.    FSWrite (refNum, &dataLength, (ptr)myStruct.aString1);
  134.  
  135. The example assumes that your strings are in Pascal format, so that the
  136. first byte of the string gives the string's length. The part about '&0xff'
  137. ensures that you don't get a negative length for strings that have the high
  138. bit set in their length byte; it isn't always necessary but better safe
  139. than sorry.
  140.  
  141. The example also writes each string out with its proper length: no disk
  142. space is wasted. This means that when you read the strings back in, you'll
  143. have to read the length byte first to see how long the string actually is.
  144. An alternative is to always write out 256 bytes for each string (or perhaps
  145. some shorter length guaranteed to be long enough for your purposes). This
  146. wastes some space but ensures a simpler and easier-to-read file format.
  147. Normally I wouldn't recommend wantonly wasting space but if it's just a few
  148. strings the wastage may not be significant.
  149.  
  150. > how would I find the
  151. > size of the data buffer when not TextEdit?
  152.  
  153. That entirely depends on the nature and source of the data. The solution
  154. for Pascal strings is shown above.
  155.  
  156. > F. Tarek Rogers
  157. > ftrogers@eos.ncsu.edu
  158.  
  159. -- Rick Holzgrafe, a member of the Taligentsia
  160.    Rick_Holzgrafe@taligent.com
  161.    rmh@taligent.com
  162.  
  163. ---------------------------
  164.  
  165. >From Bill McCloskey <billm@interaccess.com>
  166. Subject: CODE Resources
  167. Date: 19 Jun 1994 01:14:55 GMT
  168. Organization: ???
  169.  
  170. If I was going to write a 'CODE' resource in Think C, how could I execute
  171. it in my program? Also, are there any examples for this anywhere?
  172.  
  173. Thanks for any help,
  174. -Bill
  175.  
  176. +++++++++++++++++++++++++++
  177.  
  178. >From Mark Hanrek <hanrek@cts.com>
  179. Date: Sun, 19 Jun 1994 05:08:25 GMT
  180. Organization: The Information Workshop
  181.  
  182. In article <2u066f$avl@mailhost.interaccess.com> Bill McCloskey,
  183. billm@interaccess.com writes:
  184.  
  185. > If I was going to write a 'CODE' resource in Think C, how could I
  186. > execute it in my program? Also, are there any examples for this
  187. > anywhere?
  188.  
  189. You would certainly want to copy the way it is done in some example
  190. source code.  I prepared an ansewr to a question like yours before, so
  191. I've attached it below.  It is ready to be pasted in and compiled.
  192.  
  193. Also, in your questions, you could have meant >> 'CODE' << literally or
  194. figuratively.  Just in case, I wanted to mention that resources of type
  195. 'CODE' should remain reserved for the traditional way applications are
  196. constructed, so I figure you are asking how you wuld create a custom code
  197. resource with a resource type of, say, 'CoDe', or XCMD, or 'bill' or
  198. whatever. :)
  199.  
  200. There are examples around. Be sure to look in the source code folder
  201. under "dev" in sumex and elsewhere.
  202.  
  203. Hope this helps.
  204.  
  205. Mark Hanrek
  206.  
  207.  
  208. ===================================================================
  209. Calling a Code Resource from an Application
  210.  
  211.  
  212. //
  213. //  First, determine and define the interface you would like. 
  214. //  For instance...
  215. //
  216.  
  217. typedef pascal OSErr (*CodeResourceProcPtr)( long param1, short param2 );
  218.  
  219.  
  220. //
  221. //  Here's a function in your application that will load and call that
  222. //  kind of code resource, which you've compiled separately.
  223. //
  224.  
  225.  
  226. OSErr CallCodeResource( long param1, short param2 )
  227. {
  228.   Handle               theCodeResource;
  229.   CodeResourceProcPtr  theEntryPoint;
  230.   OSErr                err;
  231.  
  232.   // Get it
  233.  
  234.   theCodeResource = GetResource( 'bill', 128 );
  235.   if ( err = ResError())
  236.      return( err );
  237.  
  238.   // Position it
  239.  
  240.   DetachResource( theCodeResource );
  241.   MoveHHi( theCodeResource );
  242.   HLock( theCodeResource );
  243.    
  244.   // Locate it and Strip it
  245.  
  246.   theEntryPoint = (CodeResourceProcPtr) StripAddress( *theCodeResource );
  247.  
  248.   // Jump into it
  249.  
  250.   err = (*theEntryPoint)( param1, param2 ); 
  251.  
  252.   // Dispose of it
  253.  
  254.   HUnlock( theCodeResource );
  255.   DisposeHandle( theCodeResource );
  256.  
  257.   return( err );
  258. }
  259.  
  260.  
  261.  
  262. - ----------------------------------------------------------
  263. The Code Resource Itself
  264.  
  265.  
  266. // Your code resource, compiled separately, would start
  267. // life like this...
  268.  
  269.  
  270. #include <SetUpA4.h>
  271.  
  272. pascal OSErr main( long param1, short param2 );
  273.  
  274. pascal OSErr main( long param1, short param2 )
  275. {
  276.     RememberA0();
  277.     SetUpA4();
  278.  
  279.  
  280.     // bla bla bla
  281.  
  282.  
  283.     RestoreA4();
  284.     return( err );
  285. }
  286.  
  287.  
  288.  
  289. - ----------------------------------------------------------
  290. Setup for Separately Compiled Code Resources
  291.  
  292.  
  293. In the "Set Project Type..." dialog, type "bill" into 
  294. the code resource type, do NOT check custom header,
  295. make sure "purgeable" is checked, and give it any name
  296. or id you like.
  297.  
  298. The ID can be important.  If you check "multi-segment" code
  299. resource, you have to be sure your code resource's id
  300. is less that 64, and it does the numbering so that the
  301. resource manager can determine at runtime which segments
  302. belong to this code resource.  There is no other "contect"
  303. to worry about or set up to worry about.
  304.  
  305. There are other resource numbering rules, but it I think
  306. the important thing is to not every use 'CODE'.
  307.  
  308.  
  309. - ----------------------------------------------------------
  310. Other Notes
  311.  
  312.  
  313. Think C provides a nice way of dealing with the interface 
  314. to code resources.  All you'll have to do to the above is
  315. change 'bill' to whatever you want, change the data type
  316. and number of parameters you'll be needing, and the data
  317. type of the return value, ( or void ).  That's it!
  318.  
  319. Intead of using DetachResource / DisposeHandle, you could 
  320. also just ReleaseResource it when you are done with it,
  321. which will save on disk thrashing if you will be accessing
  322. it a number of times.
  323.  
  324. And don't forget the keyword 'pascal' in the typedef!  You
  325. could look at your code all day long and not catch that one!
  326.  
  327. :) :)   Have fun.  
  328.  
  329.  
  330. Mark Hanrek
  331. The Information Workshop
  332.  
  333. +++++++++++++++++++++++++++
  334.  
  335. >From oster@netcom.com (David Phillip Oster)
  336. Date: Mon, 20 Jun 1994 15:52:59 GMT
  337. Organization: Netcom Online Communications Services (408-241-9760 login: guest)
  338.  
  339.  
  340. Mark Hanrek <hanrek@cts.com> posted a code example of calling a code resource.
  341. It contained some errors:
  342. 1.) it called DetachResource at the beginning and DisposHandle at the end.
  343. It is often better to omit these two steps, and just do a HGetState() at
  344. the beginning and an HSetState() at the end.
  345.  
  346. 2.) It assumes that both the calling C program and the code resource are
  347. either both 680x0 code or both PowerPC code. If there is a chance that they
  348. might be mixed, you need to call the code resource slightly differently.
  349. This is fully documented in the PowerPC volume of InsideMac. You also might
  350. want to consider creating a "fat" code resource, chich contains both 680x0
  351. and PowerPC instructions so it it will run at top speed no matter who calls
  352.  
  353. +++++++++++++++++++++++++++
  354.  
  355. >From Kevin.R.Boyce@gsfc.nasa.gov (Kevin R. Boyce)
  356. Date: Mon, 20 Jun 1994 12:38:47 -0400
  357. Organization: NASA/GSFC
  358.  
  359. Mark Hanrek <hanrek@cts.com> wrote:
  360.  
  361. > In article <2u066f$avl@mailhost.interaccess.com> Bill McCloskey,
  362. > billm@interaccess.com writes:
  363. > > If I was going to write a 'CODE' resource in Think C, how could I
  364. > > execute it in my program? Also, are there any examples for this
  365. > > anywhere?
  366. > You would certainly want to copy the way it is done in some example
  367. > source code.  I prepared an ansewr to a question like yours before, so
  368. > I've attached it below.  It is ready to be pasted in and compiled.
  369.  
  370. [Sample code that is almost identical to my own stock answer deleted.]
  371.  
  372. There is one other thing you need to be aware of, if you are using any
  373. system callbacks in your code resource.  (System callbacks are things like
  374. dialog filters, that get called from within an OS/Toolbox routine that you
  375. call.)  The problem is that the system may have messed with A4 before
  376. calling your callback routine, so you have to set it up within the
  377. callback.  
  378.  
  379. Here is the second half of my stock answer, where I discuss this in detail:
  380.  
  381. And one final (very important) point is that the A4 routines are static
  382. (they only apply to the file in which they appear).  So if you need to
  383. use SetUpA4() in a file other than the one which called RememberA0(),
  384. you need to call RememberA4() (NOT RememberA0()) from within that file,
  385. sometime before the call to SetUpA4().  Uh, maybe an example would
  386. help (this also demonstrates how to return the value of a global)...
  387.  
  388. - - file MainCode.c ---
  389. #include <SetUpA4.h>
  390. char    aGlobal;
  391.  
  392. char main(long foo)        /* Wants to return value of aGlobal */
  393. {
  394.     char    retVal;
  395.     
  396.     RememberA0();
  397.     SetUpA4();
  398.     ...
  399.     DoSomeDialog();
  400.     ...
  401.     retVal = aGlobal;    /* Have to do this while A4 is still valid! */
  402.     RestoreA4();        /* A4 no longer points to our global area */
  403.     return retVal;        /* But local (automatic) variables are still ok */
  404. }
  405.  
  406.  
  407. - - file MyDialogs.c ---
  408.  
  409. #include <SetUpA4.h>
  410. extern short    aGlobal;
  411.  
  412. void DoSomeDialog()
  413. {
  414.     DialogPtr    theDialog;
  415.     short        itemHit;
  416.     
  417.     RememberA4();        /* Save A4 for functions in this file. */
  418.     theDialog = GetNewDialog( dlgRsrcID, nil, (WindowPtr)-1 );
  419.     ModalDialog( myFilter, &itemHit );
  420.     ...
  421.     return;
  422. }
  423.  
  424. pascal Boolean MyFilter(DialogPtr theDlg, EventRecord *theEvent, short
  425. *itemHit )
  426. {
  427.     Boolean    status;
  428.     
  429.     SetUpA4();
  430.     
  431.     if ( theEvent->what == keyDown ) {
  432.         aGlobal = (theEvent->message) & charCodeMask;
  433.         *itemHit = ok;
  434.         status = TRUE;
  435.     } else {
  436.         status = FALSE;
  437.     }
  438.     RestoreA4();
  439.     return status;
  440. }
  441.  
  442.  
  443. -- 
  444. Kevin      Kevin.R.Boyce@gsfc.nasa.gov
  445. I then suspended the assembly by the edges of the CD, and began filling
  446. the box with Inside Macintosh volumes. --Kevin Bell
  447.  
  448. +++++++++++++++++++++++++++
  449.  
  450. >From Mark Hanrek <hanrek@cts.com>
  451. Date: Tue, 21 Jun 1994 08:45:55 GMT
  452. Organization: The Information Workshop
  453.  
  454. In article <osterCrpDGC.7K4@netcom.com> David Phillip Oster,
  455. oster@netcom.com writes:
  456.  
  457. >It contained some errors:
  458. >1.) it called DetachResource at the beginning and DisposHandle at the
  459. end.
  460. >It is often better to omit these two steps, and just do a HGetState() at
  461. >the beginning and an HSetState() at the end.
  462. >
  463. >2.) It assumes that both the calling C program and the code resource are
  464. >either both 680x0 code or both PowerPC code. If there is a chance that
  465. they
  466. >might be mixed, you need to call the code resource slightly differently.
  467. >This is fully documented in the PowerPC volume of InsideMac. You also
  468. might
  469. >want to consider creating a "fat" code resource, chich contains both
  470. 680x0
  471. >and PowerPC instructions so it it will run at top speed no matter who
  472. calls
  473.  
  474. David,
  475.  
  476. Neither are errors.  Errors are where you do something wrong.
  477.  
  478. The first is a situational kind of thing.
  479.  
  480. As for the PowerPC concerns, that is not appropriate here, because the
  481. Bill asked how to call a code resource, and he was given just what he
  482. needs to be successful.
  483.  
  484. The objective in answering questions is to hopefully make it so the
  485. answer makes whatever it is seem like a piece of cake.
  486.  
  487. My DetachResource approach isolates him from Resource Manager concerns so
  488. this does not foul up his first experiences.  Moving the handle high also
  489. eliminates memory fragmentation concerns. By and by, he will know as much
  490. about it as you or I and be answering questions himself. :)
  491.  
  492. Not only that, if he wanted to take advantage of what you mentioned, how
  493. would he do that?  All you did was mention that there was a concern, and
  494. a reference to HGetState.
  495.  
  496. Kevin on the other hand, rather than simply mentioning that there are
  497. concerns with dialog callbacks, laid it all out in black and white, and
  498. very clearly.  A piece of cake. :)
  499.  
  500.  
  501. Mark Hanrek
  502.  
  503. P.S. There were, though, tons of editing errors in my post. Something
  504. must have gone wrong with the editor.  ( yeah, right :)
  505.  
  506. ---------------------------
  507.  
  508. >From will@cs.su.oz.au (William Uther)
  509. Subject: Code Resources with CodeWarrior
  510. Date: 20 Jun 1994 16:16:24 +1000
  511. Organization: Basser Dept of Computer Sciece, Uni of Sydney, Australia
  512.  
  513. Hi,
  514.   I've just been trying to covert a THINK C 6.0 Code Resource to CodeWarrior.
  515. I'm using the 68k DR3.  I've set the prefs up to produce a code resource and
  516. included all the files.
  517.   When I test the code resource it doesn't work.  The A4 world is set up by the
  518. program calling the code resource.  And seems to be correct.  One of the first
  519. things the code resource does is call TextBox to display a debug string.
  520. The call is in the assembler - but it doesn't come up.  I have no idea
  521. wot's wrong.  There are NO compile or link errors.
  522.  
  523. Are there any bugs in DR3 with code resources, or is there some strange thing I
  524. have to set - I've RTFM'd but there really isn't much there.
  525.  
  526. \x/ill            :-}
  527.  
  528.  
  529. +++++++++++++++++++++++++++
  530.  
  531. >From rang@winternet.com (Anton Rang)
  532. Date: 20 Jun 1994 12:27:49 GMT
  533. Organization: Minnesota Angsters
  534.  
  535. In article <2u3c7o$6sh@staff.cs.su.oz.au> will@cs.su.oz.au (William Uther) writes:
  536. >When I test the code resource it doesn't work.  The A4 world is set
  537. >up by the program calling the code resource.  And seems to be
  538. >correct.
  539.  
  540.   You say the A4 world is set up by the *caller*?  Are you following
  541. the CodeWarrior rules on this?  (They're different from THINK.)  In
  542. THINK C, the A4 register needs to point to the beginning of the code
  543. resource.  I don't recall the CW rules for sure, but it's definitely
  544. different, more along the lines of 'A4 = the end plus $8000'.  (Run
  545. one of the examples that uses A4, or write a quick one, and pop into
  546. the debugger to check for sure.)
  547. --
  548. Anton Rang (rang@winternet.com)
  549.  
  550. +++++++++++++++++++++++++++
  551.  
  552. >From will@cs.su.oz.au (William Uther)
  553. Date: 20 Jun 1994 22:43:21 +1000
  554. Organization: Basser Dept of Computer Sciece, Uni of Sydney, Australia
  555.  
  556. Hello again,
  557.   Fixed the problem - I was assuming that CW used a similar A4 world to THINK
  558. and MPW - A4 was being set wrong and yet it wasn't crashing.  It would be nice
  559. if this were mentioned in the manuals (I eventaully found it, well documented,
  560. in a code example).
  561.  
  562. \x/ill       :-}
  563.  
  564. P.S.  Aside from the odd conversion problem from THINK C, CW is very good - I
  565. am in the process of converting everything.
  566.  
  567.  
  568. ---------------------------
  569.  
  570. >From Frank Price <wprice@netcom.com>
  571. Subject: MacTCP DNR for PowerPC?
  572. Date: Tue, 21 Jun 1994 03:16:28 GMT
  573. Organization: Netcom
  574.  
  575. I noticed that the DNR.c file on the CodeWarrior DR3 CD and the MacOnRISC
  576. release CD is basically bogus when it actually gets compiled.  It is far
  577. from a complete conversion to native code...at least as far as
  578. CodeWarrior is concerned.  After making many small changes that were
  579. obvious, the functions still "don't match prototypes."  Anyway, I'd
  580. rather not muck with this file if there is an official or correctly
  581. updated version out there.  Anyone know what the story is or want to send
  582. me an updated file?
  583.  
  584. Thanks!
  585. Frank
  586.  
  587. +++++++++++++++++++++++++++
  588.  
  589. >From scouten@maroon.tc.umn.edu (Eric Scouten)
  590. Date: Tue, 21 Jun 1994 14:29:56 GMT
  591. Organization: University of Minnesota, Student Affairs
  592.  
  593. In article <netnewsCrq93H.JBq@netcom.com>, Frank Price <wprice@netcom.com>
  594. wrote:
  595.  
  596. > I noticed that the DNR.c file on the CodeWarrior DR3 CD and the MacOnRISC
  597. > release CD is basically bogus when it actually gets compiled.  It is far
  598. > from a complete conversion to native code...at least as far as
  599. > CodeWarrior is concerned.  After making many small changes that were
  600. > obvious, the functions still "don't match prototypes."  Anyway, I'd
  601. > rather not muck with this file if there is an official or correctly
  602. > updated version out there.  Anyone know what the story is or want to send
  603. > me an updated file?
  604.  
  605. Sorry. You'll have to rewrite DNR.c.
  606.  
  607. Apple did a pretty poor job of creating a universal header for this file.
  608. You will have to change all of the typedefs and the ProcInfo definitions.
  609. The following is an excerpt from some of my own TCP code that shows the
  610. corrected values.
  611.  
  612. - -------
  613.  
  614. // NOTE: The dnr.c file created for universal headers contained an error.
  615. All
  616. // of the selectors are treated by the DNR as long values, not short. This
  617. has
  618. // been corrected in TurboTCP.
  619.  
  620. extern "C" {
  621.  
  622. typedef OSErr (*OpenResolverProcPtr)(long selector, char* fileName);
  623.                    //                ^^^^ this was "short" in dnr.c
  624. typedef OSErr (*CloseResolverProcPtr)(long selector);
  625. typedef OSErr (*StrToAddrProcPtr)(long selector, char* hostName,
  626.         struct hostInfo* rtnStruct, long resultProc, char* userData);
  627. typedef OSErr (*AddrToStrProcPtr)(long selector, long address, char*
  628. hostName);
  629. typedef OSErr (*AddrToNameProcPtr)(long selector, unsigned long addr,
  630.         struct hostInfo* rtnStruct, long resultProc, char* userData);
  631. typedef OSErr (*HInfoProcPtr)(long selector, char* hostName,
  632.         struct returnRec* returnRecPtr, long resultProc, char* userData);
  633. typedef OSErr (*MXInfoProcPtr)(long selector, char* hostName,
  634.         struct returnRec* returnRecPtr, long resultProc, char* userData);
  635.  
  636. };
  637.  
  638. #if USESROUTINEDESCRIPTORS
  639.  
  640. enum {
  641.     uppOpenResolverProcInfo = kCStackBased
  642.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  643.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  644.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(char*)))
  645. };
  646.  
  647. // etc.
  648.  
  649. //
  650. // change parameter 1 of all ProcInfos to (sizeof(long))
  651. //
  652.  
  653. - -------
  654.  
  655. Hope this was helpful.
  656.  
  657. -Eric
  658.  
  659.  
  660. -- 
  661. Eric Scouten  *  U of MN  *  scouten@maroon.tc.umn.edu  *  +1 612 626 0746
  662.   ** MS Computer Science student, Univ of Illinois, starting Aug '94 **
  663.  
  664. Maps tell the truth, the whole truth, and anything but the truth.
  665.  
  666. ---------------------------
  667.  
  668. >From kerr@math.ohio-state.edu (Kerr Gibson)
  669. Subject: Major bug with Symantec CDK *Please Read*
  670. Date: 21 Jun 1994 19:13:36 -0400
  671. Organization: Department of Mathematics, The Ohio State University
  672.  
  673.  
  674. Thought I would write this to spare you some of the headaches I went
  675. through in linking a Symantec PPC project.
  676.  
  677.  
  678. My original problem was that I had ported an old project to a new Virtual
  679. Architect PPC project.  The project linked via the ToolServer and produced
  680. an application which inexplicably would not run.  All it would do was produce
  681. an error and quit.
  682.  
  683. The actual bug has to do with Quicktime and the makefile for the ToolServer. 
  684. My original project uses Quicktime and the QuickTime xcoff library is not
  685. included in the VA PPC starter project. "Uh Oh.", I think, "I had better make
  686. sure the Quicktime lib is included in the linker script for the ToolServer.  
  687. So I open the PPCBuild.ts file and find the following:
  688.  
  689. ...
  690. MakePEF {XCOFFname} -o {AppName} 6
  691.    -l "AppleScriptLib.xcoff.o=AppleScriptLib" 6
  692.    -l "InterfaceLib.xcoff.o=InterfaceLib" 6
  693.    -l "MathLib.xcoff.o=MathLib" 6
  694.    -l "ObjectSupportLib.xcoff.o=ObjectSupportLib" 6
  695.    -l "QuickTimeLib.xcoff.o=InterfaceLib" 6
  696.    -l "StdCLib.xcoff.o=StdCLib" 6
  697.    -ft 'APPL' -fc "{Creator}"
  698.  
  699. Lo and behold, it is already there. "Ok Cool", I say to myself, "I just won't
  700. change the file." So I leave it alone and then I spend the next week trying to
  701. figure out why my program links but wont run.  The astute observer of course
  702. will see what I failed to notice:
  703.  
  704. -l "QuickTimeLib.xcoff.o=InterfaceLib" 6
  705.                          ^^^^^^^^^^^^
  706.       Its the wrong d*mn library name!
  707.  
  708. This explains the issue. The linker did not report an error because the library
  709. really was loaded.  Unfortunately it was loaded right over top of the previous
  710. InterfaceLib PEF file!  The reason this bug was never found is because if there
  711. is no Quicktime lib in the project, it is ignored by this script.  I imagine
  712. that this little diddy wreaked hell with the code fragment, hence, it was 
  713. unable to run.
  714. I had been duped by a simple copy/paste error (see 3 lines above it).  Now 
  715. I don't have a problem with copy/paste errors, God knows I make them all the 
  716. time.  But I'm a little miffed that certain libraries were never tested with 
  717. the final out-the-door product.
  718.  
  719. Anyway, if you want to use QuickTime with the CDK, this is your warning.
  720.  
  721. --Kerr Gibson
  722.  
  723. P.S. I'm also pissed that the Finder did not give me an error code- all
  724. it said was "The Application xxx could not be launched because an error
  725. ocurred."  What gives?
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734. ---------------------------
  735.  
  736. >From ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  737. Subject: Perspective in GX (was Re: can toolbox draw text at an angle?)
  738. Date: 21 Jun 94 14:06:37 +1200
  739. Organization: University of Waikato, Hamilton, New Zealand
  740.  
  741. In article <3624861694.8241498@tempest.tempest.net.hk>, johnb@tempest.net.hk (John W. Blackburne) writes:
  742. > Jens Alfke (jens_alfke@powertalk.apple.com) wrote:
  743. >
  744. >> Why yes -- QuickDraw GX supports arbitrary transformations of text,
  745. > including
  746. >> skew and perspective in addition to rotation. Anything you can describe in
  747. > a
  748. >> 3x3 matrix. Not only that, but you can allow the user to edit the
  749. > transformed
  750. >> text (typing into perspective text is pretty trippy.) You can also fit text
  751. >> to a curve, but it's not directly editable after that.
  752. >
  753. > Can someone please explain to me how this works. If you are using a 3 x 3
  754. > matrix (on an anything x anything matrix) for transformations you get
  755. > linear transformations, which include scaling, rotating, reflecting and
  756. > skewing but NOT transforming the perspective of a shape, at least not when
  757. > operating on the real two-dimensional space QD GX works in.
  758.  
  759. Yes, you can. Remember, these are 3 x 3 matrices, not 2 x 2. Also,
  760. perspective is very much a linear transformation, since it maps straight lines
  761. to straight lines, after all.
  762.  
  763. Here's how it works: for transformations other than perspective, you work
  764. in homogeneous coordinates, which normally look like this:
  765.  
  766.     [x y 1] [a b 0] = [x' y' 1]
  767.         [c d 0]
  768.         [e f 1]
  769.  
  770. Perspective transforms work like this:
  771.  
  772.     [x y 1] [1 0 u] = [x y (xu + yv + 1)]
  773.         [0 1 v]
  774.         [0 0 1]
  775.  
  776. The matrix doesn't quite fit into the usual normalized form, but QuickDraw GX
  777. supports it just fine. And when you normalize the result vector, you end up with
  778.  
  779.     x' = x / (xu + yv + 1)
  780.     y' = y / (xu + yv + 1)
  781.  
  782. et voila! A perspective transformation. Of course, you can combine these
  783. with other linear transformations in the usual way.
  784.  
  785. Now the big mystery: with all the other convenience routines that they bothered
  786. to put into the QuickDraw GX API, why didn't they include one to build
  787. perpective transformations?
  788.  
  789. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  790. Info & Tech Services Division              fax: +64-7-838-4066
  791. University of Waikato            electric mail: ldo@waikato.ac.nz
  792. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
  793. "If you want competence, you must read everything. But, if you want
  794. originality, you must not."                    -- Edward de Bono
  795.  
  796. +++++++++++++++++++++++++++
  797.  
  798. >From turk@apple.com (Ken Turkowski)
  799. Date: Tue, 21 Jun 1994 21:56:40 GMT
  800. Organization: Apple Computer, Inc.
  801.  
  802. In article <1994Jun21.140637.29986@waikato.ac.nz>, ldo@waikato.ac.nz
  803. (Lawrence D'Oliveiro, Waikato University) wrote:
  804.  
  805. > Now the big mystery: with all the other convenience routines that they bothered
  806. > to put into the QuickDraw GX API, why didn't they include one to build
  807. > perpective transformations?
  808.  
  809. Try Quad2D2Quad2D(), given below. This works if you know the projective
  810. transformations of 4 points.
  811.  
  812. Are there any other specifications you'd be interested in?
  813.  
  814. /* Original code due to Paul Heckbert.
  815.  * Recoded by Ken Turkowski.
  816.  * AS IS. No guarantees.
  817.  */
  818.  
  819.  
  820.  
  821. #define MAXDIM 32
  822.  
  823. #define kFudge            1e-16
  824. #define kBadMap            0
  825. #define kProjectiveMap    1
  826. #define kAffineMap        2
  827.  
  828. #include <math.h>
  829.  
  830. #define ConcatMap(map1Type, map2Type) ((map1Type < map2Type) ? map1Type :
  831. map2Type)
  832.  
  833. typedef struct TPoint2D        { float x, y; }            TPoint2D;
  834. typedef struct TPoint3D        { float x, y, z; }        TPoint3D;
  835. typedef struct TVector4D    { float x, y, z, w; }    TVector4D;
  836.  
  837. typedef FLOAT vec3[3];
  838.  
  839. void
  840. MLAdjointMatrix3x3(float *M)
  841. {
  842.     float t[3][3];
  843.     struct MX { float m[3][3]; };
  844.     register vec3* m = (vec3*)M;
  845.     
  846.     t[0][0] =   m[1][1] * m[2][2] - m[1][2] * m[2][1];    /* t(0,0) */
  847.     t[0][1] = - m[0][1] * m[2][2] + m[0][2] * m[2][1];    /* t(0,1) */
  848.     t[0][2] =   m[0][1] * m[1][2] - m[0][2] * m[1][1];    /* t(0,2) */
  849.     t[1][0] = - m[1][0] * m[2][2] + m[1][2] * m[2][0];    /* t(1,0) */
  850.     t[1][1] =   m[0][0] * m[2][2] - m[0][2] * m[2][0];    /* t(1,1) */
  851.     t[1][2] = - m[0][0] * m[1][2] + m[0][2] * m[1][0];    /* t(1,2) */
  852.     t[2][0] =   m[1][0] * m[2][1] - m[1][1] * m[2][0];    /* t(2,0) */
  853.     t[2][1] = - m[0][0] * m[2][1] + m[0][1] * m[2][0];    /* t(2,1) */
  854.     t[2][2] =   m[0][0] * m[1][1] - m[0][1] * m[1][0];    /* t(2,2) */
  855.     
  856.     *((struct MX*)(&m[0][0])) = *((struct MX*)(&t[0][0]));
  857. }
  858.  
  859.  
  860. /****************************************************************
  861.  * Linear transformations, for transforming vectors and matrices.
  862.  * This works for row vectors and column vectors alike.
  863.  *    L[nRows][lCol]    - input (left) matrix
  864.  *    rg[lCol][rCol]    - transformation (right) matrix
  865.  *    P[nRows][rCol]    - output (product) matrix
  866.  *
  867.  * Examples:
  868.  * v[3] * M[3][3] -> w[3] :            LinearTransform(&v[0], &M[0][0], &w[0], 1, 3,
  869. 3);
  870.  * M[3][3] * v[3] -> w[3] :            LinearTransform(&M[0][0], &v[0], &w[0], 3, 3,
  871. 1);
  872.  * M[4][4] * N[4][4] -> P[4][4]:    LinearTransform(&M[0][0], &N[0][0],
  873. &P[0][0], 4, 4, 4);
  874.  * v[4] * M[4][3] -> w[3]:            LinearTransform(&v[0], &M[0][0], &w[0], 1, 4,
  875. 3);
  876.  * v[3] tensor w[3] -> T[3][3]:        LinearTransform(&v[0], &w[0], T[3][3], 3,
  877. 1, 3);
  878.  ****************************************************************/
  879.  
  880. void
  881. LinearTransform(
  882.     const float *L,        /* The left matrix */
  883.     const float *R,        /* The right matrix */
  884.     register float *P,    /* The resultant matrix */
  885.     long nRows,            /* The number of rows of the left and resultant matrices */
  886.     long lCol,            /* The number of columns in the left matrix */
  887.     long rCol            /* The number of columns in the resultant matrix */
  888. )
  889. {
  890.     register const float *lp;        /* Left matrix pointer for dot product */
  891.     register const char *rp;        /* Right matrix pointer for dot product */
  892.     register long k;                    /* Loop counter */
  893.     register long double sum;        /* Extended precision for intermediate results
  894. */
  895.     register long rRowBytes = rCol * sizeof(float);
  896.     register long j, i;                /* Loop counters */
  897.     register long lRowBytes = lCol * sizeof(float);
  898.     const char *lb = (const char*)L;
  899.  
  900.     for (i = nRows; i--; lb += lRowBytes) {    /* Each row in L */
  901.         for (j = 0; j < rCol; j++) {    /* Each column in R */
  902.             lp = (const float *)lb;        /* Left of ith row of L */
  903.             rp = (const char *)(R + j);    /* Top of jth column of R */
  904.             sum = 0;
  905.             for (k = lCol; k--; rp += rRowBytes)
  906.                 sum += *lp++ * (*((const float*)rp));    /* *P += L[i'][k'] * R[k'][j] */
  907.             *P++ = sum;
  908.         }
  909.     }
  910. }
  911.  
  912.  
  913. /****************************************************************
  914.  ****************************************************************
  915.  ****************************************************************
  916.  ***    2D Projective Mappings
  917.  ****************************************************************
  918.  ****************************************************************
  919.  ****************************************************************/
  920.  
  921.  
  922. #define DET2(a,b, c,d) ((a)*(d) - (b)*(c))
  923.  
  924.  
  925. /****************************************************************
  926.  * UnitSquare2Quad2D()
  927.  *
  928.  * compute the TDMatrix3x3 M such that
  929.  *    [x y w] = [u v 1] M
  930.  * where the points
  931.  *    (0,0), (0,1), (1,1), (1,0)
  932.  * map into the points
  933.  *    p[0], p[1], p[2], p[3].
  934.  ****************************************************************/
  935. int
  936. UnitSquare2Quad2D(register const TPoint2D *p, float M[3][3])
  937. {
  938.     double px, py;
  939.     double dx12, dx32, dy12, dy32;
  940.     double d, g, h;
  941.  
  942.     px = p[0].x - p[1].x + p[2].x - p[3].x;
  943.     py = p[0].y - p[1].y + p[2].y - p[3].y;
  944.     
  945.     if ((fabs(px) < kFudge) && (fabs(py) < kFudge)) {    /* Affine */
  946.         M[0][0] = p[1].x-p[0].x;    M[0][1] = p[1].y-p[0].y;    M[0][2] = 0;    /* New
  947. x-axis */
  948.         M[1][0] = p[3].x-p[0].x;    M[1][1] = p[3].y-p[0].y;    M[1][2] = 0;    /*
  949. New y-axis */
  950.         M[2][0] = p[0].x;            M[2][1] = p[0].y;            M[2][2] = 1;    /* New origin
  951. */
  952.         return(kAffineMap);
  953.     }
  954.     
  955.  
  956.     /* Projective mapping */
  957.     dx12 = p[1].x - p[2].x;
  958.     dx32 = p[3].x - p[2].x;
  959.     dy12 = p[1].y - p[2].y;
  960.     dy32 = p[3].y - p[2].y;
  961.     d = DET2(dx12,dx32, dy12,dy32);    /* Discriminant */
  962.     g = DET2(px,dx32, py,dy32);        /* X-keystoning */
  963.     h = DET2(dx12,px, dy12,py);        /* Y-Keystoning */
  964.     
  965.     if (d != 0) {
  966.         g /= d;    /* Normalize these to get a matrix in standard form */
  967.         h /= d;
  968.     
  969.         M[0][0] = p[1].x-p[0].x+g*p[1].x;    M[0][1] =
  970. p[1].y-p[0].y+g*p[1].y;    M[0][2] = g;
  971.         M[1][0] = p[3].x-p[0].x+h*p[3].x;    M[1][1] =
  972. p[3].y-p[0].y+h*p[3].y;    M[1][2] = h;
  973.         M[2][0] = p[0].x;                    M[2][1] = p[0].y;                    M[2][2] = 1;
  974.     
  975.         return(kProjectiveMap);
  976.     }
  977.     else {
  978.         return(kBadMap);
  979.     }
  980.  
  981. }
  982.  
  983.  
  984. /****************************************************************
  985.  * Rect2Projective()
  986.  *
  987.  * compute the matrix M[3][3] such that
  988.  *    [x y w] = [u v 1] M
  989.  * where the points
  990.  *    q[0], q[1], q[2], q[3]
  991.  * map into the points
  992.  *    p[0], p[1], p[2], p[3].
  993.  * If the inverse flag is set, it map xy->uv instead of ux->xy
  994.  ****************************************************************/
  995. int
  996. Rect2Quad2D(double u0, double v0, double u1, double v1, const TPoint2D* p,
  997. float M[3][3], int inverse)
  998. {
  999.     double du = u1 - u0;
  1000.     double dv = v1 - v0;
  1001.     int mapType;
  1002.  
  1003.     if (du == 0 || dv == 0)
  1004.         return(0);    /* Degenerate rectangle */
  1005.     
  1006.     if ((mapType = UnitSquare2Quad2D(p, M)) == kBadMap)
  1007.         return(kBadMap);    /* Bad perspectivity */
  1008.     
  1009.     /* Apply rectangular stretching and translation */
  1010.     M[0][0] /= du;                        M[0][1] /= du;                        M[0][2] /= du;
  1011.     M[1][0] /= dv;                        M[1][1] /= dv;                        M[1][2] /= dv;
  1012.     M[2][0] -= M[0][0]*u0+M[1][0]*v0;    M[2][1] -=
  1013. M[0][1]*u0+M[1][1]*v0;    M[2][2] -= M[0][2]*u0+M[1][2]*v0;
  1014.  
  1015.     if (inverse)    /* Do we want uv->xy or xy->uv? */
  1016.         AdjointMatrix3x3(M[0]);    /* xy->uv! */
  1017.     
  1018.     return(mapType);
  1019. }
  1020.  
  1021.  
  1022. /****************************************************************
  1023.  * Quad2D2Quad2D()
  1024.  *
  1025.  * compute the matrix M[3][3] such that
  1026.  *    [x y w] = [u v 1] M
  1027.  * where the points
  1028.  *    q[0], q[1], q[2], q[3]
  1029.  * map into the points
  1030.  *    p[0], p[1], p[2], p[3].
  1031.  ****************************************************************/
  1032. int
  1033. Quad2D2Quad2D(register const TPoint2D* q, const TPoint2D* p, float M[3][3])
  1034. {
  1035.     if (q[0].x==q[3].x && q[1].x==q[2].x &&    /* vertical   edges 3-0 and 1-2 */
  1036.         q[0].y==q[1].y && q[2].y==q[3].y    /* horizontal edges 0-1 and 2-3 */
  1037.     ) {
  1038.         return(Rect2Quad2D(q[0].x, q[0].y, q[2].x, q[2].y, p, M, 0));
  1039.     }
  1040.     
  1041.     else if (q[0].x==q[1].x && q[2].x==q[3].x &&
  1042.              q[1].y==q[2].y && q[3].y==q[0].y
  1043.     ) {
  1044.         TPoint2D prot[4];
  1045.         prot[0]=p[1]; prot[1]=p[2]; prot[2]=p[3]; prot[3]=p[0];    /* cycle points
  1046. */
  1047.         return(Rect2Quad2D(q[1].x, q[1].y, q[3].x, q[3].y, prot, M, 0));
  1048.     }
  1049.  
  1050.     else {
  1051.         float L[3][3], R[3][3];
  1052.         int map1Type, map2Type;
  1053.         
  1054.         /* Calculate mapping from quad q to unit square */
  1055.         if ((map1Type = UnitSquare2Quad2D(q, L)) == kBadMap)    /* unit square to
  1056. quad q */
  1057.             return(kBadMap);
  1058.         AdjointMatrix3x3(L[0]);
  1059.         
  1060.         /* Calculate mapping from unit square to quad p */
  1061.         if ((map2Type = UnitSquare2Quad2D(p, R)) == kBadMap)    /* unit square to
  1062. quad p */
  1063.             return(kBadMap);
  1064.         
  1065.         /* Concatenate the two transformations */
  1066.         LinearTransform(L[0], R[0], M[0], 3, 3, 3);
  1067.  
  1068.         return(ConcatMap(map1Type, map2Type));
  1069.     }
  1070. }
  1071.  
  1072.  
  1073. //Ken Turkowski; Apple Computer, Inc.; 1 Infinite Loop; Cupertino, CA 95014
  1074. //turk@apple.com
  1075.  
  1076. ---------------------------
  1077.  
  1078. >From gilem@litecdev.eng.rpi.edu (Michael R. Gile)
  1079. Subject: Still trouble finding floating windows code.
  1080. Date: 14 Jun 1994 18:36:13 GMT
  1081. Organization: Rensselaer Polytechnic Institute, Troy NY
  1082.  
  1083. I am still looking for some code which implements floating windows on the mac,
  1084. which will compile using either think C or metrowerks C.  I have tried 
  1085. compiling yu's code from d e v e l o p issue 15 using both of these
  1086. compilers, with absolutely no success. The code compiles, but then crashes 
  1087. hard as soon as any events are sent to the handlers.  Does anyone
  1088. have any suggestions?  I don't have MPW, so that doesn't help.
  1089.  
  1090. thanks
  1091. Mike
  1092. -- 
  1093. Michael Gile                        |               Graduate Assistant
  1094. gilem@rpi.edu                       |   Computer & Systems Engineering
  1095. "Don't Blame Me, I voted for Perot!"| Rensselaer Polytechnic Institute
  1096.  
  1097. +++++++++++++++++++++++++++
  1098.  
  1099. >From egurney@vcd.hp.com (Eddy J. Gurney)
  1100. Date: Wed, 15 Jun 1994 01:01:35 GMT
  1101. Organization: Hewlett-Packard VCD
  1102.  
  1103. Michael R. Gile (gilem@litecdev.eng.rpi.edu) wrote:
  1104. >I am still looking for some code which implements floating windows on
  1105. >the mac, which will compile using either think C or metrowerks C. I
  1106. >have tried compiling yu's code from d e v e l o p issue 15 using both
  1107. >of these compilers, with absolutely no success. The code compiles, but
  1108. >then crashes hard as soon as any events are sent to the handlers. Does
  1109. >anyone have any suggestions? I don't have MPW, so that doesn't help.
  1110.  
  1111. Well, there are some bugs in the code, even with the latest version on
  1112. the Bookmark 18 CD. But it may work for your application. (I sent mail
  1113. to Dean Yu on them and did not get a response.)
  1114.  
  1115. Your problem most likely has to do with the fact that the code is
  1116. written for MPW and *not* THINK C, which use different methods to access
  1117. low-memory globals (unless you have compiled MacHeaders to use SysEqu.h
  1118. instead of LoMem.h, not likely for the average joe.)
  1119.  
  1120. Anyway, the solution is to look at the two functions GetWindowList() and
  1121. SetWindowList() and change them to
  1122.  
  1123. return (WindowRef)WindowList;
  1124.  
  1125. and 
  1126.  
  1127. WindowList = (WindowPeek)windowReference;
  1128.  
  1129. respectively.
  1130.  
  1131. A more robust solution would be to #ifdef THINKC (or whatever the
  1132. compiler-set define is) around these changes, but I digress...
  1133.  
  1134. --
  1135. Eddy J. Gurney N8FPW   Hewlett-Packard Company, Vancouver (USA!) Division
  1136. egurney@vcd.hp.com                       #include <standard-disclaimer.h>
  1137. "Failures are divided into two classes-- those who thought and never did,
  1138.       and those who did and never thought."     John Charles Salak
  1139.  
  1140. +++++++++++++++++++++++++++
  1141.  
  1142. >From kenlong@netcom.com (Ken Long)
  1143. Date: Wed, 15 Jun 1994 05:43:20 GMT
  1144. Organization: NETCOM On-line Communication Services (408 261-4700 guest)
  1145.  
  1146. There are floating window sources available on the net.  Some even have 
  1147. the word "float" or "floating" in the filename.  What I'd recommend is 
  1148. connecting to the major Mac source sites and getting all sources with 
  1149. window, WDEF and floating in the filename.  Better yet, connect and get 
  1150. any description indexes for the site, and target your files you want to 
  1151. get before you connect for the files.
  1152.  
  1153. "Nifty" has floaters, Infinity Windoid (an excellent one), an old file 
  1154. called "floating" does, too.  As I recall, buried down in the TCL folder, 
  1155. in a subfolder, that came with Think C there is a windoid source.
  1156.  
  1157. These sources may or may not have routines which result in the window 
  1158. staying in front no matter what (maybe bar dialogs), but there was a 
  1159. lengthy thread on this not to long ago.  Maybe someone saved the thread 
  1160. and would send it to you, as well.
  1161.  
  1162. -Ken-
  1163.  
  1164.  
  1165.  
  1166. +++++++++++++++++++++++++++
  1167.  
  1168. >From Mark Hanrek <hanrek@cts.com>
  1169. Date: Wed, 15 Jun 1994 08:10:29 GMT
  1170. Organization: The Information Workshop
  1171.  
  1172. In article <2tktau$asu@usenet.rpi.edu> Michael R. Gile,
  1173. gilem@litecdev.eng.rpi.edu writes:
  1174.  
  1175. > I am still looking for some code which implements floating windows on
  1176. the mac,
  1177. > which will compile using either think C or metrowerks C. 
  1178.  
  1179. Besides what was just mentioned, I know there is an example called
  1180. "Floating Windows 1.3" floating around. ( Sorry :)
  1181.  
  1182. But, the best floating windows C example source code, integrated with the
  1183. best windowing I have ever seen, is available as part of DTS.Lib, written
  1184. by Eric Soldan. This is THE reference for any kind of windowing on the
  1185. Mac, and it is excellent.
  1186.  
  1187. You can find it at ftp.apple.com.
  1188.  
  1189. Hope this helps.
  1190.  
  1191. Mark Hanrek
  1192.  
  1193. +++++++++++++++++++++++++++
  1194.  
  1195. >From jc@vivitech.com (John Cooper)
  1196. Date: Fri, 17 Jun 1994 20:13:42 GMT
  1197. Organization: Vivid Technologies Inc.
  1198.  
  1199.    I see a lot of people ask for code that implements floating windows. One
  1200. common suggestion is to use Yu's code from _develop_, but everyone knows
  1201. that that code is buggy. The follow-up suggestion is usually of the form:
  1202.  
  1203.    "The code in _develop_ still has bugs. Just go to an archive site and
  1204.     grab Infinity Windoid or ... "
  1205.  
  1206.    But is this all they really have to do? Just go get someone's WDEF, make
  1207. a NewWindow with it and, voila!, instant floating windows?
  1208.  
  1209.    Now please forgive my ignorance; I've never written a WDEF before. Could
  1210. someone explain to me how a WDEF alone achieves "floating" behavior in the
  1211. Macintosh environment? How can a WDEF itself control the BringToFront behavior
  1212. of all the other windows in an application (including doing the right thing
  1213. with dialog boxes)? Doesn't an application have to manage all the layering
  1214. itself even if a "windoid" WDEF is available? Doesn't the Infinity Windoid--
  1215. to use one example--only determine the windoid's appearance, and not it's
  1216. "floating" properties?
  1217.  
  1218.    Telling someone who is trying to get floating palettes working to go
  1219. get the Infinity Windoid is not enough, is it? Sure, that person will have
  1220. pretty windoids, but they won't float all by themselves, will they?
  1221.  
  1222. -John
  1223.  
  1224. +--------------------------+------------------------------------------+
  1225. | John R. Cooper           | Internet: jc@vivitech.com,               |
  1226. | Vivid Technologies, Inc. |           jcooper@world.std.com          |
  1227. | Waltham, MA 02154        | AOL:      JRCooper (jrcooper@aol.com)    |
  1228. +--------------------------+------------------------------------------+
  1229. | "God split himself into a myriad parts that he might have friends." |
  1230. | This may not be true, but it sounds good and is no sillier than any |
  1231. | other theology.                                                     |
  1232. |                        -- Long's Notes --                           |
  1233. +---------------------------------------------------------------------+
  1234.  
  1235. +++++++++++++++++++++++++++
  1236.  
  1237. >From tbrown@dorsai.org (Tommy Brown)
  1238. Date: Tue, 21 Jun 1994 20:46:07 GMT
  1239. Organization: The Dorsai Embassy, New York, NY
  1240.  
  1241. John Cooper (jc@vivitech.com) wrote:
  1242. :    I see a lot of people ask for code that implements floating windows. One
  1243. : common suggestion is to use Yu's code from _develop_, but everyone knows
  1244. : that that code is buggy. The follow-up suggestion is usually of the form:
  1245.  
  1246. :    "The code in _develop_ still has bugs. Just go to an archive site and
  1247. :     grab Infinity Windoid or ... "
  1248.  
  1249. :    But is this all they really have to do? Just go get someone's WDEF, make
  1250. : a NewWindow with it and, voila!, instant floating windows?
  1251.  
  1252. No. Although the code in develop has some bugs, as far as I know it is 
  1253. pretty much adequate. You will need to use the Infinity Windoid AND the 
  1254. code in develop to properly implement floating windows. The Infinity 
  1255. Windoid merely creates a window that looks like it should be floating. To 
  1256. make it actually float, you need to use modified code; the most recent 
  1257. code that I know of that will do the trick is what was found in develop.
  1258. -- 
  1259. Tommy Brown                 | Je suis tombe par terre, c'est la faute a
  1260. tbrown@dorsai.dorsai.org    | Voltaire. Le nez dans le ruisseau, c'est la
  1261. tommy6@aol.com              | faute a Rousseau. 
  1262. zipit@softlock.com          | - Gavroche
  1263.  
  1264. ---------------------------
  1265.  
  1266. >From damon@CS.ColoState.EDU (Yimmit)
  1267. Subject: _vSyncWait infinite loop?
  1268. Date: Thu, 16 Jun 1994 03:24:29 GMT
  1269. Organization: Imladris Occupants Inc.
  1270.  
  1271. OK.  So, I'm doing some communications with the serial ports, but every so often
  1272. I get stuck in _vSyncWait forever.  My question is: Why?  What are the reasons
  1273. for an infinite loop to occur in _vSyncWait?  This happens just after I do an
  1274. FSWrite to the serial port.  Has anyone had this problem?  ANY help would be
  1275. appreciated since I can find no documentation on this - anywhere.
  1276.  
  1277. Tim Damon
  1278.  
  1279.  
  1280. +++++++++++++++++++++++++++
  1281.  
  1282. >From resnick@uiuc.edu (Pete Resnick)
  1283. Date: Wed, 15 Jun 1994 23:05:25 -0500
  1284. Organization: University of Illinois at Urbana-Champaign
  1285.  
  1286. In article <CrH04t.zH0@yuma.ACNS.ColoState.EDU>, damon@CS.ColoState.EDU
  1287. (Yimmit) wrote:
  1288.  
  1289. >OK.  So, I'm doing some communications with the serial ports, but every
  1290. >so often I get stuck in _vSyncWait forever.  My question is: Why?  What
  1291. >are the reasons for an infinite loop to occur in _vSyncWait?  This happens
  1292. >just after I do an FSWrite to the serial port.
  1293.  
  1294. The _vSyncWait loop is where synchronous calls wait for the interrupt
  1295. telling them that the I/O routine has completed. Since FSWrite is simply a
  1296. synchronous PBWrite, that's what's going on. Two causes are either (a) you
  1297. called a synchronous routine like FSWrite at interrupt time and the
  1298. interrupt for completion is never coming through or (b) the routine is
  1299. never completing, which means that the data is never getting to the serial
  1300. port (which would be very wierd). I vote for (a). :-)
  1301.  
  1302. pr
  1303. -- 
  1304. Pete Resnick        (...so what is a mojo, and why would one be rising?)
  1305. Doctoral Student - Philosophy Department, Gregory Hall, UIUC
  1306. System manager - Cognitive Science Group, Beckman Institute, UIUC
  1307. Internet: resnick@uiuc.edu
  1308.  
  1309. +++++++++++++++++++++++++++
  1310.  
  1311. >From absurd@apple.com (Tim Dierks)
  1312. Date: Thu, 16 Jun 1994 07:24:30 GMT
  1313. Organization: Apple Computer, Inc.
  1314.  
  1315. In article <CrH04t.zH0@yuma.ACNS.ColoState.EDU>, damon@CS.ColoState.EDU
  1316. (Yimmit) wrote:
  1317.  
  1318. > OK.  So, I'm doing some communications with the serial ports, but every so often
  1319. > I get stuck in _vSyncWait forever.  My question is: Why?  What are the reasons
  1320. > for an infinite loop to occur in _vSyncWait?  This happens just after I do an
  1321. > FSWrite to the serial port.  Has anyone had this problem?  ANY help would be
  1322. > appreciated since I can find no documentation on this - anywhere.
  1323. > Tim Damon
  1324.  
  1325. It basically means your write isn't completing; you made a synchronous
  1326. write, so it won't return until all the bytes have been shoved through the
  1327. serial port.  When it can't shove all the characters through the serial
  1328. port, it waits until it can finish. Possibilities include:
  1329.  - Handshaking is on (hardware or software) and it's been told not to send.
  1330.  This is in particular a problem when writing code that runs on PowerBooks;
  1331. apparently, a desktop machine without its hardware handshaking line hooked
  1332. up will usually think it's OK to send, while a portable will usually think
  1333. that it's not OK to send; since hardware handshaking is on by default, this
  1334. can be a surprise the first time you run your program on a PowerBook with a
  1335. cable which doesn't have that pin hooked up.
  1336.  - You made a synchronous serial call from an interrupt level which doesn't
  1337. allow the serial port's interrupts to get through; in general, only make
  1338. asynchronous calls at interrupt time.
  1339.  - Something else is screwed up; however, the first two are most likely.
  1340.  
  1341. Best,
  1342.  - Tim
  1343.  
  1344. -- 
  1345. Tim Dierks
  1346. absurd@apple.com
  1347.  
  1348. +++++++++++++++++++++++++++
  1349.  
  1350. >From jvp@tools1.ee.iastate.edu (Jim Van Peursem)
  1351. Date: 16 Jun 94 16:26:56 GMT
  1352. Organization: Iowa State University, Ames, Iowa
  1353.  
  1354. In <resnick-1506942305250001@resnick1.isdn.uiuc.edu> resnick@uiuc.edu (Pete Resnick) writes:
  1355.  
  1356. >In article <CrH04t.zH0@yuma.ACNS.ColoState.EDU>, damon@CS.ColoState.EDU
  1357. >(Yimmit) wrote:
  1358.  
  1359. >>OK.  So, I'm doing some communications with the serial ports, but every
  1360. >>so often I get stuck in _vSyncWait forever.  My question is: Why?  What
  1361. >>are the reasons for an infinite loop to occur in _vSyncWait?  This happens
  1362. >>just after I do an FSWrite to the serial port.
  1363.  
  1364. >The _vSyncWait loop is where synchronous calls wait for the interrupt
  1365. >telling them that the I/O routine has completed. Since FSWrite is simply a
  1366. >synchronous PBWrite, that's what's going on. Two causes are either (a) you
  1367. >called a synchronous routine like FSWrite at interrupt time and the
  1368. >interrupt for completion is never coming through or (b) the routine is
  1369. >never completing, which means that the data is never getting to the serial
  1370. >port (which would be very wierd). I vote for (a). :-)
  1371.  
  1372.   Not wierd at all actually. The problem is most likely due to improper
  1373. initialization of serial handshaking options. Some machines default to
  1374. hardware handshaking, and their port defaults to the "wait" state when
  1375. no hardware handshaking lines are present. The fix is to call SerHShake()
  1376. or the preferred, Control(14?) to initialize the handshaking options.
  1377.  
  1378. +---------------------------------------------------------------+
  1379. | Jim Van Peursem - Ph.D. Candidate      (Ham Radio -> KE0PH)   |
  1380. | Department of Electrical Engineering and Computer Engineering |
  1381. | Iowa State University - Ames, IA 50011 : (515) 294-8339       |
  1382. | internet - jvp@iastate.edu  -or-  jvp@cpre1.ee.iastate.edu    |
  1383. +---------------------------------------------------------------+
  1384.  
  1385. +++++++++++++++++++++++++++
  1386.  
  1387. >From d88-jwa@mumrik.nada.kth.se (Jon Wdtte)
  1388. Date: 17 Jun 1994 20:55:20 GMT
  1389. Organization: The Royal Institute of Technology
  1390.  
  1391. In <CrH04t.zH0@yuma.ACNS.ColoState.EDU> damon@CS.ColoState.EDU (Yimmit) writes:
  1392.  
  1393. >OK.  So, I'm doing some communications with the serial ports, but every so often
  1394. >I get stuck in _vSyncWait forever.  My question is: Why?  What are the reasons
  1395.  
  1396. _vSyncWait is where your Mac spends most of its time.
  1397. It takes a parameter block as parameter, and waits until
  1398. ioResult isn't 1 anymore. I/O is usually done through
  1399. spawning off an interrupt task which sets ioResult to
  1400. the result code.
  1401.  
  1402. There's probably something keeping your Mac from sending
  1403. the data, like an XOFF or no CTS or something. You can
  1404. avoid such hangs by always writing in async mode (but that
  1405. brings about other problems) with PBWriteAsync.
  1406.  
  1407. Cheers,
  1408.  
  1409.                     / h+
  1410. -- 
  1411.  -- Jon W{tte, h+@nada.kth.se, Mac Software Engineer Deluxe --
  1412.  
  1413.  "My boss made me say it. He dares you to sue!"
  1414.  
  1415. +++++++++++++++++++++++++++
  1416.  
  1417. >From damon@CS.ColoState.EDU (Yimmit)
  1418. Date: Sat, 18 Jun 1994 01:28:09 GMT
  1419. Organization: Imladris Occupants Inc.
  1420.  
  1421. Thanks to all who replied to this problem.  Silly me, I forgot to prototype my
  1422. send function for a separate source file.  Therefore, my command parameter was
  1423. being trashed in the send function and I was accidentally sending some huge
  1424. amount of data!!  Oh well.  Thanks again!
  1425. -->Tim Damon
  1426.  
  1427.  
  1428. +++++++++++++++++++++++++++
  1429.  
  1430. >From Bruce@hoult.actrix.gen.nz (Bruce Hoult)
  1431. Date: Sun, 19 Jun 1994 12:41:39 +1200 (NZST)
  1432. Organization: (none)
  1433.  
  1434. damon@CS.ColoState.EDU (Yimmit) writes:
  1435. > OK.  So, I'm doing some communications with the serial ports, but every so often
  1436. > I get stuck in _vSyncWait forever.  My question is: Why?  What are the reasons
  1437. > for an infinite loop to occur in _vSyncWait?  This happens just after I do an
  1438. > FSWrite to the serial port.  Has anyone had this problem?  ANY help would be
  1439. > appreciated since I can find no documentation on this - anywhere.
  1440.  
  1441. Bet you're not calling SerHShake.
  1442.  
  1443. -- Bruce
  1444.  
  1445. ---------------------------
  1446.  
  1447. >From kelley@cs.dal.ca (Dan Kelley)
  1448. Subject: can toolbox draw text at an angle?
  1449. Date: Thu, 16 Jun 1994 13:04:12 GMT
  1450. Organization: Oceanography, Dalhousie University, Halifax, NS, Canada
  1451.  
  1452. Some years ago I did some Mac programming, and was disappointed to realize that
  1453. it could not easily draw text at an angle.
  1454.  
  1455. Is this still the case, or has system7/truefont/... made it possible to draw text
  1456. at an angle to the horizontal?
  1457.  
  1458. If you have information, I'd appreciate an email (since I presume, scanning the
  1459. group for the last few days, that others might not be interested).  Thanks.  Dan.
  1460.  
  1461.  
  1462. -- 
  1463. Dan Kelley                   | dan.kelley@dal.ca            (902)494-1694
  1464. Oceanography Department      |   ``We rise again,
  1465. Dalhousie University         |     in the faces of our children''
  1466. Halifax, NS, CANADA, B3H 4J1 |   The Rankin Family <North Country>
  1467.  
  1468. +++++++++++++++++++++++++++
  1469.  
  1470. >From andrewt@fluffy.cs.wisc.edu (Andrew Thomas-Cramer)
  1471. Date: 16 Jun 1994 16:39:46 GMT
  1472. Organization: University of WI, Madison -- Computer Sciences Dept.
  1473.  
  1474. kelley@cs.dal.ca (Dan Kelley) writes:
  1475.  
  1476. >Some years ago I did some Mac programming, and was disappointed to realize that
  1477. >it could not easily draw text at an angle.
  1478.  
  1479. >Is this still the case, or has system7/truefont/... made it possible to draw text
  1480. >at an angle to the horizontal?
  1481.  
  1482. >If you have information, I'd appreciate an email (since I presume, scanning the
  1483. >group for the last few days, that others might not be interested).  Thanks.  Dan.
  1484.  
  1485.     I'd be interested. Please post any responses.
  1486.     Clearly, it's possible -- composition and illustration software do it 
  1487. routinely. But how is it fastest done? A transformation of the bits generated
  1488. from Toolbox routines to a new rotation, or direct use of the font description?
  1489. Or has a Toolbox routine been added lately?
  1490.  
  1491.     andy thomas-cramer
  1492.  
  1493.  
  1494. +++++++++++++++++++++++++++
  1495.  
  1496. >From jwbaxter@olympus.net (John W. Baxter)
  1497. Date: Thu, 16 Jun 1994 15:00:05 -0700
  1498. Organization: Internet for the Olympic Peninsula
  1499.  
  1500. In article <CrHqz1.DIJ@cs.dal.ca>, kelley@cs.dal.ca (Dan Kelley) wrote:
  1501.  
  1502. > Some years ago I did some Mac programming, and was disappointed to realize that
  1503. > it could not easily draw text at an angle.
  1504. > Is this still the case, or has system7/truefont/... made it possible to draw text
  1505. > at an angle to the horizontal?
  1506.  
  1507. QuickDraw GX makes rotated text (or rotated anything, almost) trivial. 
  1508. Summer.
  1509.  
  1510. -- 
  1511. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  1512.    No hablo Intel.
  1513.    jwbaxter@pt.olympus.net
  1514.  
  1515. +++++++++++++++++++++++++++
  1516.  
  1517. >From gabe@shiva.com (Gabriel Lawrence)
  1518. Date: Thu, 16 Jun 94 21:59:02 GMT
  1519. Organization: Shiva Corporation
  1520.  
  1521. In Article <2tpv8i$4rn@spool.cs.wisc.edu>, andrewt@fluffy.cs.wisc.edu
  1522. (Andrew Thomas-Cramer) wrote:
  1523. >kelley@cs.dal.ca (Dan Kelley) writes:
  1524. >
  1525. >>Some years ago I did some Mac programming, and was disappointed to realize
  1526. >>that it could not easily draw text at an angle.
  1527. >>
  1528. >>Is this still the case, or has system7/truefont/... made it possible to draw
  1529. >>text at an angle to the horizontal?
  1530.  
  1531. Regular old QuickDraw never supported it but Adobe Type Manager did.  I
  1532. asked Apple a few years ago how to do it without ATM and was told that if I
  1533. used the same approach that ATM offered, they would produce a compatible
  1534. method.  They've finally offered a solution (though not really compatible)
  1535. in the form of QuickDraw GX.  The following is excerpted from "IM-QuickDraw
  1536. GX Typography"
  1537.  
  1538. "GXRotateShape:
  1539. Rotates the typographic shape. This function can affect the mapping of the
  1540. typographic shape's transform if the gxMapTransformShape attribute is set.
  1541. Otherwise, it converts a text shape to a glyph shape, and it changes the
  1542. values in the glyph shape's tangents array. You use the GXRotateShape
  1543. function to create vertical text. See the chapter "Typographic Styles" for
  1544. more information on vertical text."
  1545.  
  1546. You can also directly alter the glyph tangent array if you want to do
  1547. something like draw text along an arbitrary line.  In short, now you can
  1548. easily do amazing things to text including rotation, skews, and generic
  1549. transforms.
  1550.  
  1551. =Gabe=
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558. >        I'd be interested. Please post any responses.
  1559. >        Clearly, it's possible -- composition and illustration software do it 
  1560. >routinely. But how is it fastest done? A transformation of the bits generated
  1561. >from Toolbox routines to a new rotation, or direct use of the font description?
  1562. >Or has a Toolbox routine been added lately?
  1563. >
  1564. >        andy thomas-cramer
  1565. >
  1566.  
  1567. - ----------------------
  1568. Gabriel Lawrence                                               Shiva Corporation
  1569. Software Tool               "All Disclaimers Apply"             gabe@shiva.com  
  1570.  
  1571. +++++++++++++++++++++++++++
  1572.  
  1573. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  1574. Date: Thu, 16 Jun 1994 23:05:05 GMT
  1575. Organization: Apple Computer
  1576.  
  1577. In article <2tpv8i$4rn@spool.cs.wisc.edu> Andrew Thomas-Cramer,
  1578. andrewt@fluffy.cs.wisc.edu writes:
  1579. >     Clearly, it's possible -- composition and illustration software do it 
  1580. > routinely. But how is it fastest done? A transformation of the bits
  1581. generated
  1582. > from Toolbox routines to a new rotation, or direct use of the font
  1583. description?
  1584.  
  1585. I'd guess that most programs currently draw offscreen and transform the
  1586. bitmap. For details on bitmap transmogrification, see "Graphics Gems 3" from
  1587. Academic Press.
  1588.  
  1589. > Or has a Toolbox routine been added lately?
  1590.  
  1591. Why yes -- QuickDraw GX supports arbitrary transformations of text, including
  1592. skew and perspective in addition to rotation. Anything you can describe in a
  1593. 3x3 matrix. Not only that, but you can allow the user to edit the transformed
  1594. text (typing into perspective text is pretty trippy.) You can also fit text
  1595. to a curve, but it's not directly editable after that.
  1596.  
  1597. --Jens Alfke
  1598.   jens_alfke@powertalk              Rebel girl, rebel girl,
  1599.             .apple.com              Rebel girl you are the queen of my world
  1600.  
  1601. +++++++++++++++++++++++++++
  1602.  
  1603. >From Mark Hanrek <hanrek@cts.com>
  1604. Date: Fri, 17 Jun 1994 05:02:28 GMT
  1605. Organization: The Information Workshop
  1606.  
  1607. In article <jwbaxter-160694150005@ptpm010.olympus.net> John W. Baxter,
  1608. jwbaxter@olympus.net writes:
  1609.  
  1610. > QuickDraw GX makes rotated text (or rotated anything, almost) trivial. 
  1611.  
  1612.  
  1613. I heard a rumor that QuickTime 2.0 was going to have the stuff that
  1614. allows still pictures to be quickly rotated.
  1615.  
  1616. Then again, it does make sense for this kinda stuff to be in QuickDraw/GX.
  1617.  
  1618. Anyone know the skinny on this?
  1619.  
  1620. In particular, I am interested in rotating pixmaps an arbitrary number of
  1621. degrees, kinda thing.
  1622.  
  1623. Thanks.
  1624.  
  1625. Mark Hanrek
  1626.  
  1627. +++++++++++++++++++++++++++
  1628.  
  1629. >From jwbaxter@olympus.net (John W. Baxter)
  1630. Date: Fri, 17 Jun 1994 09:10:47 -0700
  1631. Organization: Internet for the Olympic Peninsula
  1632.  
  1633. In article <CrIzC4.9K0@crash.cts.com>, Mark Hanrek <hanrek@cts.com> wrote:
  1634.  
  1635. > In article <jwbaxter-160694150005@ptpm010.olympus.net> John W. Baxter,
  1636. > jwbaxter@olympus.net writes:
  1637. > > QuickDraw GX makes rotated text (or rotated anything, almost) trivial. 
  1638. ...
  1639. > In particular, I am interested in rotating pixmaps an arbitrary number of
  1640. > degrees, kinda thing.
  1641.  
  1642. QD GX does that, in two fundamentally different ways: (a) by shuffling the
  1643. pixels around in the actual bitmap geometry, or (b) by applying a rotation
  1644. transform during drawing.  (a) is often very bad, particularly if you are
  1645. going to rotate several times.  There's an example of the result of that in
  1646. the color plates at the front of Inside Mac:  QD GX Graphics.  [It starts
  1647. as a nice color ramp...it finishes as a Rorschach inkblot.]
  1648.  
  1649. -- 
  1650. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  1651.    No hablo Intel.
  1652.    jwbaxter@pt.olympus.net
  1653.  
  1654. +++++++++++++++++++++++++++
  1655.  
  1656. >From johnb@tempest.net.hk (John W. Blackburne)
  1657. Date: 18 Jun 1994 03:50:03 GMT
  1658. Organization: Tempest, Hong Kong
  1659.  
  1660. Jens Alfke (jens_alfke@powertalk.apple.com) wrote:
  1661.  
  1662. > Why yes -- QuickDraw GX supports arbitrary transformations of text,
  1663. including
  1664. > skew and perspective in addition to rotation. Anything you can describe in
  1665. a
  1666. > 3x3 matrix. Not only that, but you can allow the user to edit the
  1667. transformed
  1668. > text (typing into perspective text is pretty trippy.) You can also fit text
  1669. > to a curve, but it's not directly editable after that.
  1670.  
  1671. Can someone please explain to me how this works. If you are using a 3 x 3
  1672. matrix (on an anything x anything matrix) for transformations you get
  1673. linear transformations, which include scaling, rotating, reflecting and
  1674. skewing but NOT transforming the perspective of a shape, at least not when
  1675. operating on the real two-dimensional space QD GX works in.
  1676.  
  1677. John
  1678.  
  1679.                   Tempest, a FirstClass BBS, Hong Kong 802-7395
  1680.                               John W. Blackburne, administrator
  1681. - - When You're cruisin' in overdrive,
  1682.        Don' have to listen to no, run o' the mill talk jive ---
  1683.  
  1684. +++++++++++++++++++++++++++
  1685.  
  1686. >From Cary Clark <crclark@apple.com>
  1687. Date: Sun, 19 Jun 1994 22:04:31 GMT
  1688. Organization: Apple Computer, Inc.
  1689.  
  1690. In article <3624861694.8241498@tempest.tempest.net.hk> John W.
  1691. Blackburne, >>Jens Alfke (jens_alfke@powertalk.apple.com) wrote:
  1692. >> Why yes -- QuickDraw GX supports arbitrary transformations of text, 
  1693. >> including skew and perspective in addition to rotation. Anything you
  1694. >> can describe in a 3x3 matrix. Not only that, but you can allow the user
  1695. >> to edit the transformed text (typing into perspective text is pretty
  1696. >>  trippy.)
  1697.  
  1698. johnb@tempest.net.hk writes:
  1699. >Can someone please explain to me how this works. If you are using a 3 x 3
  1700. >matrix (on an anything x anything matrix) for transformations you get
  1701. >linear transformations, which include scaling, rotating, reflecting and
  1702. >skewing but NOT transforming the perspective of a shape, at least not
  1703. >when operating on the real two-dimensional space QD GX works in.
  1704.  
  1705. QuickDraw GX expresses all of its coordinates by the vector (x, y, 1).
  1706. Multiplying this by the 3x3 results in (x', y', z'). Viewing this back in
  1707. the destination space requires that z = 1, so this vector is normalized
  1708. as (x'/z', y'/z', 1). The extra divisions required by perspective
  1709. calculations are performed only when necessary, so that non-perspective
  1710. drawing isn't penalized.
  1711.  
  1712. Cary Clark
  1713. Apple Computer, Inc.
  1714.  
  1715. +++++++++++++++++++++++++++
  1716.  
  1717. >From kelley@cs.dal.ca (Dan Kelley)
  1718. Date: Mon, 20 Jun 1994 12:40:28 GMT
  1719. Organization: Oceanography, Dalhousie University, Halifax, NS, Canada
  1720.  
  1721. The answers to my question about rotated text have all mentioned GX.  I'm new
  1722. to the mac, and have 2 questions:
  1723.  
  1724. 1) is quickdraw gx available on all shipping platforms, or is it something new?
  1725.  
  1726. 2) is there a downloadable document on gx, or a book title I can look up?
  1727.  
  1728. Thanks very much to everyone who has been so helpful.
  1729. -- 
  1730. Dan Kelley                   | dan.kelley@dal.ca            (902)494-1694
  1731. Oceanography Department      |   ``We rise again,
  1732. Dalhousie University         |     in the faces of our children''
  1733. Halifax, NS, CANADA, B3H 4J1 |   The Rankin Family <North Country>
  1734.  
  1735. +++++++++++++++++++++++++++
  1736.  
  1737. >From jwbaxter@olympus.net (John W. Baxter)
  1738. Date: Mon, 20 Jun 1994 07:50:02 -0700
  1739. Organization: Internet for the Olympic Peninsula
  1740.  
  1741. In article <Crp4JI.JJK@cs.dal.ca>, kelley@cs.dal.ca (Dan Kelley) wrote:
  1742.  
  1743. > The answers to my question about rotated text have all mentioned GX.  I'm new
  1744. > to the mac, and have 2 questions:
  1745. > 1) is quickdraw gx available on all shipping platforms, or is it something new?
  1746.  
  1747. QuickDraw GX is just emerging into the post-beta world.  It is available
  1748. for license to distribute with applications which use it, and will be
  1749. shipped with System 7.5 (real soon now).
  1750.  
  1751. > 2) is there a downloadable document on gx, or a book title I can look up?
  1752. There is more than "a book".  There are 7 new volumes of Inside Macintosh,
  1753. 3 of which (at least) have hit the stores in paper form.  They are
  1754. available (except for the Overview document so far) on various Apple CD
  1755. ROMs.  Issue 18 of "develop" ($10 as a back issue...double check that the
  1756. back issue includes the same-numbered CD) is one source.  "develop" is
  1757. worth subscribing too regardless of the CD, IMHO.
  1758.  
  1759. It's been more years than it should have been since I have been in Halifax
  1760. (via cruise ship).
  1761. -- 
  1762. John Baxter    Port Ludlow, WA, USA  [West shore, Puget Sound]
  1763.    No hablo Intel.
  1764.    jwbaxter@pt.olympus.net
  1765.  
  1766. +++++++++++++++++++++++++++
  1767.  
  1768. >From bhorling@mail.trincoll.edu (Bryan Horling)
  1769. Date: Sun, 19 Jun 1994 20:55:49 -0500
  1770. Organization: Trinity College
  1771.  
  1772. In article <1994Jun19.220431.20334@gallant.apple.com>, Cary Clark
  1773. <crclark@apple.com> wrote:
  1774.  
  1775. > In article <3624861694.8241498@tempest.tempest.net.hk> John W.
  1776. > Blackburne, >>Jens Alfke (jens_alfke@powertalk.apple.com) wrote:
  1777. > >> Why yes -- QuickDraw GX supports arbitrary transformations of text, 
  1778. > >> including skew and perspective in addition to rotation. Anything you
  1779. > >> can describe in a 3x3 matrix. Not only that, but you can allow the user
  1780. > >> to edit the transformed text (typing into perspective text is pretty
  1781. > >>  trippy.)
  1782. > johnb@tempest.net.hk writes:
  1783. > >Can someone please explain to me how this works. If you are using a 3 x 3
  1784. > >matrix (on an anything x anything matrix) for transformations you get
  1785. > >linear transformations, which include scaling, rotating, reflecting and
  1786. > >skewing but NOT transforming the perspective of a shape, at least not
  1787. > >when operating on the real two-dimensional space QD GX works in.
  1788. > QuickDraw GX expresses all of its coordinates by the vector (x, y, 1).
  1789. > Multiplying this by the 3x3 results in (x', y', z'). Viewing this back in
  1790. > the destination space requires that z = 1, so this vector is normalized
  1791. > as (x'/z', y'/z', 1). The extra divisions required by perspective
  1792. > calculations are performed only when necessary, so that non-perspective
  1793. > drawing isn't penalized.
  1794. > Cary Clark
  1795. > Apple Computer, Inc.
  1796.  
  1797. Is there any easy way to do rotations without QuickDraw GX?  Say you wanted
  1798. to write in the y axis label on a graph or somthing like that (so that the
  1799. the bottom of the text was parallel with the axis), how could you go about
  1800. doing it?
  1801.  
  1802. -- 
  1803.  Bryan C.Horling       ||||     
  1804.  Trinity College        @@      bhorling@mail.cc.trincoll.edu  
  1805.   Hartford, CT          == 
  1806.  
  1807. +++++++++++++++++++++++++++
  1808.  
  1809. >From Jens Alfke <jens_alfke@powertalk.apple.com>
  1810. Date: Mon, 20 Jun 1994 20:58:11 GMT
  1811. Organization: Apple Computer
  1812.  
  1813. John W. Blackburne, johnb@tempest.net.hk writes:
  1814. > Can someone please explain to me how this works. If you are using a 3 x 3
  1815. > matrix (on an anything x anything matrix) for transformations you get
  1816. > linear transformations, which include scaling, rotating, reflecting and
  1817. > skewing but NOT transforming the perspective of a shape, at least not when
  1818. > operating on the real two-dimensional space QD GX works in.
  1819.  
  1820. 3x3 matrices, if you set the top-right and middle-right elements to be
  1821. nonzero, WILL produce perspective transforms that make it appear as though
  1822. the two-dimensional drawing plane has been rotated in 3space and projected
  1823. back onto the screen. You obviously can't draw stuff in real 3d this way,
  1824. since your input is only 2d points, but for mapping your drawing onto an
  1825. arbitrarily oriented surface in 3space it's ideal. Check out some of the
  1826. demos at the end of the SlideMaster GX demo -- there's one that does a flyby
  1827. of some 3d text, and another with a 3d rotating die. (I think for the die
  1828. they had to use a different transformation for each face.)
  1829.  
  1830. --Jens Alfke
  1831.   jens_alfke@powertalk              Rebel girl, rebel girl,
  1832.             .apple.com              Rebel girl you are the queen of my world
  1833.  
  1834. ---------------------------
  1835.  
  1836. End of C.S.M.P. Digest
  1837. **********************
  1838.  
  1839.  
  1840.