develop-29 9703 March 1997
From the originals
13 scansMachine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.
These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.
Image 1
Sending PostScript Files to a LaserWriter • User Interactions and Apple Events develop The Apple Technical Journal Issue 29 March 1997 Easy 3D With the QuickDraw 3D Viewer Gearing Up for Asia With the Text Services Manager and TSMTE High-Performance ACGIs in C Using Newton Internet Enabler to Create a Web Server Making the Most of Memory in OpenDoc $10.00
A magazine cover with a green top banner, a black script 'develop' masthead with an Apple logo, and a left column of article titles above an illustration of pastel teapots, teacups, saucers and sugar cubes floating over a wavy tan background with arrows.
Reading notes: Headline is the largest green title; article list items are in black and may be read as subheads rather than headline. The masthead 'develop' is in stylized script and transcribed as printed. Last title 'Making the Most of Memory in OpenDoc' is cut off at the right edge of the column as 'OpenDoc'.
- Printed product names
- develop · The Apple Technical Journal
- Printed prices
- $10.00
- Printed dates
- March 1997 · Issue 29
- Languages
- English
PDF page 1
Sending PostScript Files to a LaserWriter • User Interactions and Apple Events develop The Apple Technical Journal Issue 29 March 1997 Easy 3D With the QuickDraw 3D Viewer Gearing Up for Asia With the Text Services Manager and TSMTE High-Performance ACGIs in C Using Newton Internet Enabler to Create a Web Server Making the Most of Memory in OpenDoc $10.00
A colorful illustration of floating teacups, saucers, teapot, and sugar cubes over a wavy tan background, with dotted motion arrows, beside a green banner strip at top and cover text listing article titles on the left.
Reading notes: Article titles on the left are cropped at the right edge (e.g., 'Asia', 'OpenDoc' appear cut off), so 'Making the Most of Memory in OpenDoc' may be truncated in the scan. The masthead script 'develop' and the Apple logo are graphic elements; the word 'develop' is read from stylized handwriting.
- Printed product names
- develop · QuickDraw 3D Viewer
- Printed prices
- $10.00
- Printed dates
- March 1997 · Issue 29
- Languages
- English
PDF page 2
develop EDITORIAL STAFF Editor-in-Cheek Caroline Rose Managing Editor Stacy Fields Technical Buckstopper Dave Johnson Our Boss John Gorham His Boss Garry Hornbuckle Bookmark CD Leader Meredith Best Review Board Brian Bechtel, Dave Radcliffe, Quinn "The Eskimo!", Jim Reekes, Bryan K. "Beaker" Ressler, Larry Rosenstein, Nick Thompson Contributing Editors Lorraine Anderson, Linda Fogel, Toni Haskell, Cheryl Potter, Erik Sea, George Truett Indexer Marc Savage ART & PRODUCTION Art Direction Lisa Ferdinandsen Technical Illustration John Ryan Formatting Forbes Mill Press Production Diane Wilcox Photography Sharon Beals, Lisa Ferdinandsen, Patrice Lefebvre, Rosanne Russillo Cover Illustration Peter Simpson Cook ISSN #1047-0735. © 1997 Apple Computer, Inc. All rights reserved. No part of this journal may be reproduced or transmitted in any form, by any means, without the prior written permission of Apple Computer, Inc. Apple, the Apple logo, AppleScript, AppleTalk, ColorSync, HyperCard, LaserWriter, Mac, MacApp, Macintosh, MacTCP, MessagePad, MPW, Newton, OpenDoc, PhotoFlash, Power Macintosh, PowerTalk, QuickTime, TrueType, and WorldScript are trademarks of Apple Computer, Inc., registered in the U.S. and other countries. AOCE, A/ROSE, develop, eMate, Finder, NewtonScript, QuickDraw, and Sound Manager are trademarks of Apple Computer, Inc. PostScript is a trademark of Adobe Systems Incorporated or its subsidiaries and may be registered in certain jurisdictions. PowerPC is a trademark of International Business Machines Corporation, used under license therefrom. Netscape Navigator is a trademark of Netscape Communications Corporation. Java is a trademark of Sun Microsystems, Inc. UNIX is a registered trademark in the United States and other countries, licensed exclusively through X/Open Company, Ltd. All other trademarks are the property of their respective owners. Printed on recycled paper by Stream International, USA THINGS TO KNOW develop, The Apple Technical Journal, a quarterly publication of the Apple Developer Relations group, is published in March, June, September, and December. It provides developers of Apple-platform products with technical articles and code that have been reviewed for robustness by Apple engineers. All issues of develop, along with the code they describe, can be found on the develop Bookmark CD, the Reference Library edition of the Developer CD Series, and the Internet. The code is updated regularly, so always use the latest version. This issue's CD. Subscription issues of develop are accompanied by the develop Bookmark CD. This CD contains a subset of the materials on the Developer CD Series, which is part of the Apple Developer Mailing available through the Apple Developer Catalog. The CD also contains Technotes, sample code, and other documentation and tools (these contents are subject to change). Items referred to as being on "this issue's CD" are located either on the Bookmark CD or on the Reference Library or Tool Chest edition of the Developer CD Series. Subscriptions and back issues. You can subscribe to develop through the Apple Developer Catalog (see below, or use the subscription card in this issue). Back issues, in addition to being available electronically, can also be ordered through the catalog. The one-year U.S. subscription price is $30 (for four issues and four develop Bookmark CDs), or $50 U.S. in other countries. Back issues are $13 each. These prices include shipping and handling. For Canadian orders, the subscription price includes GST (R100236199). WHERE TO FIND US What / Who/where develop on the Web and ftp / http://www.devworld.apple.com/develop/ ftp://ftpdev.info.apple.com/Developer_Services/Periodicals/develop/ Bookmark CD contents / http://www.devworld.apple.com/ ftp://ftpdev.info.apple.com/Developer_Services/ Technotes on the Web / http://www.devworld.apple.com/dev/technotes.shtml Editorial comments or suggestions / Caroline Rose, crose@apple.com, (408)974-0544 fax Technical questions about develop / Dave Johnson, dkj@apple.com, (408)974-0544 fax Article submissions / develop@apple.com (ask for our Author's Kit) Apple Developer Catalog (develop subscription, back issues, or other products) / http://www.devcatalog.apple.com order.adc@apple.com 1-800-282-2732 U.S., 1-800-637-0029 Canada, (716)871-6555 internationally, (716)871-6511 fax Apple Developer Catalog, Apple Computer, Inc., P.O. Box 319, Buffalo, NY 14207-0319 Subscription changes or queries / order.adc@apple.com Please be sure to include your name, address, and account number as they appear on your mailing label.
A printed journal masthead and information page with a handwritten-style 'develop' logo with arrow at top, two columns of small serif text under bold letterspaced section headings, and a 'WHERE TO FIND US' table with a recycling symbol at bottom left.
Reading notes: Italic small print in the copyright and trademark block is slightly soft but legible. Two-column table in 'WHERE TO FIND US' is transcribed row by row; cell pairing is inferred from layout. Canadian GST number and phone numbers are small but appear legible.
- Printed product names
- develop · develop Bookmark CD · Developer CD Series · Apple Developer Catalog
- Printed prices
- $30 · $50 U.S. · $13
- Printed dates
- 1997 · March · June · September · December
- Languages
- English
PDF page 3
Contents
Issue 29 March 1997 ARTICLES 4 Easy 3D With the QuickDraw 3D Viewer by Nick Thompson The QuickDraw 3D Viewer will allow users to view and manipulate 3D objects in your application with a standard, intuitive interface. Implementing the Viewer, which has been enhanced in QuickDraw 3D 1.5, requires only a few extra calls. 32 Gearing Up for Asia With the Text Services Manager and TSMTE by Tague Griffith Supporting the Text Services Manager (TSM) allows your application to transparently make use of the wide variety of text input methods required by 2-byte languages like Chinese, Japanese, and Korean. And TSMTE makes support of TSM a simple matter. 51 High-Performance ACGIs in C by Ken Urquhart Most simple ACGI (Asynchronous Common Gateway Interface) programs are written in AppleScript, but for greater speed or for handling more than one request at a time, a high-level language like C is more suitable. This article presents a C shell that you can use to build your own high-performance ACGIs. 81 Using Newton Internet Enabler to Create a Web Server by Ray Rischpater The Newton Internet Enabler (NIE) lets loose a flood of possible applications by bringing the industry-standard TCP/IP protocol stack to the Newton platform. A working Web server illustrates the details of using NIE. COLUMNS 27 THE OPENDOC ROAD Making the Most of Memory in OpenDoc by Troy Gaul and Vincent Lo It isn't always obvious how to make efficient use of memory in the OpenDoc environment; these basic guidelines will help. 48 PRINT HINTS Sending PostScript Files to a LaserWriter by Dave Polaschek Lots of applications send PostScript files directly to LaserWriters, but many of them do it the wrong way. Here's the right way. 74 ACCORDING TO SCRIPT User Interactions in Apple Event-Driven Applications by Cal Simone Cal is back, this time with advice on how and when to interact with the user in response to Apple events. 101 NEWTON Q & A: ASK THE LLAMA Answers to Newton-related development queries. Send in your own for a chance at a T-shirt. 104 THE VETERAN NEOPHYTE Digital Karma by Joe Williams An attempt to make an online society self-moderating raises some interesting questions and leads to some unexpected twists. Even Elvis enters into the picture. 107 MACINTOSH Q & A Apple's Developer Support Center answers queries about Macintosh product development. You'll find Q&As on Open Transport, QuickTime, the Drag Manager, and more. 115 KON & BAL'S PUZZLE PAGE AppendDITL Apoplexy by Martin-Gilles Lavoie and Bo3b Johnson Our guest puzzlers take on a problem that, while innocuous on the surface, proves to be deep and dastardly. It involves dialog boxes. Need we say more? 2 EDITOR'S NOTE 123 INDEX CONTENTS 1
A magazine contents page with bold black and green section numbers and headings in two columns, with faint background text from an editor's note and a small image at upper right.
Reading notes: Faint background text behind the contents list, including the editor's note and a small photo caption, is largely illegible and was not transcribed. Fine print near the bottom left and right edges is too faint to read reliably. The Newton Q & A entry and the Editor's Note entry are separated by layout; reading order follows the printed page order.
- Printed dates
- March 1997 · 1997
- Languages
- English
PDF page 4
EDITOR'S NOTE The nerd market has been saturated — you all have computers — but what about the "home market"? I'm no expert on this, but now that I've taken on the persona of home user myself, I feel better qualified to say why normal people would rather use calculators and play board games. I recently upgraded to a Power Mac 8500 so that I could work at home and also to be able to enjoy some fun software like the newly released electronic version of my favorite board game. Rather than just download software from an Apple server to use for work, I was going to buy something to play with to help justify my new expensive hardware purchase — just like any Mom, Pop, or kid might do. I took a trip — several, actually — to a barn-like emporium that is Nerd Central in my neighborhood but a singularly unpleasant place for non-geeks. (The clerks seem to know that if you have to ask for what you need, you don't belong there, so they ignore you.) The first few times, I was dismayed to find that the game I wanted had been released only for Windows and not yet for Macintosh. Finally, when I looked more closely at the product in the Windows software section, I saw the small print on it that said "Windows and Mac." Then all I had to do was wait a half hour in line to buy it. Remember the big furor over wasteful packaging when CDs started replacing record albums in audio stores? Before long the shelves were redesigned and the extra packaging eliminated. What did I find in this big box containing a software product for which I had shelled out 50-plus dollars? Nothing but a CD in its case and a huge piece of molded black plastic cleverly designed to take up all the rest of the space in the box. I wondered how much that extra packaging had cost me, but decided to get on with it and chill out over a good game. I'll run out of space before I can get through all the other problems I encountered. Suffice it to say I was dissatisfied with the product, to the point where I would not have purchased it had I known of its shortcomings ahead of time. It paled in comparison to a similar shareware game I'd been using (for which, needless to say, I didn't have to drive to a store, search for the product, wait in line, spend a lot of money, and throw away most of the package). The home market won't really take off until the experience of purchasing software becomes more pleasurable and foolproof. This could mean something more like buying audio CDs, where you go to a cool store organized by content type and not hardware type, where you can easily return the product within a short time for any reason, and where you can even try out the disc before buying it. Or it may mean waiting till the practice of buying software off the Web has taken hold — especially inexpensive shareware, so that satisfaction is guaranteed in advance. Only solutions like these will roust the home market. Otherwise it's just too much of a pain. Caroline Rose Editor CAROLINE ROSE (crose@apple.com) isn't a typical home user, since she was one of the first people to use a Macintosh and she cut her teeth before that on a timesharing system. But that was all in the line of duty, whereas at leisure she uses computers as little as possible. She's even been known to handwrite letters to friends. Speaking of which, Caroline has received so little mail from develop readers lately that this issue is missing a Letters section and she's missing hearing from you. What's on your mind about develop? Please take a moment to let Caroline know. 2 develop Issue 29 March 1997
A black-and-white portrait of a smiling woman with curly hair above a signature and text in a magazine editor's note page with a green-accented name and a page footer.
Reading notes: Faint bleed-through text from the reverse side appears behind the main body text and was not transcribed. The signature 'Chose' reads as a stylized signature of Caroline Rose and was not transcribed as body copy beyond the printed name. Some right-column fine print in the bottom section and the faded text near the margins may be partially obscured.
- Printed product names
- Power Mac 8500 · Macintosh · Windows · Mac
- Printed prices
- 50-plus dollars
- Printed dates
- March 1997 · Issue 29
- Languages
- English
PDF page 5
Looking to complete the set? If you're looking for a complete develop collection, full-color, bound copies are available for $13 per issue, including shipping and handling. (Back issues are also on the develop Bookmark CD and the Developer CD Series Reference Library edition, as well as on the Internet.) For more information about how to order printed back issues (and where to find them online), see the inside front cover of this issue. Supplies are limited. Please allow 4 to 6 weeks for delivery. Issue 1 Color; Palette Manager; Offscreen Worlds; PostScript; System 7; Debugging Declaration ROMs Issue 2 C++ (Objects; Style Guide); Object Pascal; Memory Manager; MacApp; Object-Based Design Issue 3 ISO 9660 and High Sierra; Accessing CD Audio Tracks; Comm Toolbox; 8•24 GC Card; PrGeneral Issue 4 Device Driver in C++; Polymorphism in C++; A/ROSE; PostScript; Apple IIGS Printer Driver Issue 5 (Volume 2, Issue 1) Asynchronous Background Networking; Palette Manager; Macintosh Common Lisp Issue 6 Threads; CopyBits; MacTCP Cookbook Issue 7 QuickTime 1.0; TrueType; Threads and Futures; C++ Objects in a World of Exceptions Issue 8 Curves in QuickDraw; Date and Time Entry in MacApp; Debugging; Hybrid Applications for A/UX Issue 9 Color on 1-Bit Devices; TextBox You've Always Wanted; Sound; Terminal Manager; Debugging Drivers Issue 10 Apple Event Objects; Enhancements for the LaserWriter Font Utility; GWorlds; The Optimal Palette Issue 11 Asynchronous Sound; Multibuffering Sounds; Exceptions; NetWork: Distributed Computing Issue 12 Components; Time Bases; Apple Event Coding Through Objects; Globals in Standalone Code Issue 13 Asynchronous Routines; QuickTime and Components; Debugging; Color Printing; DeviceLoop Issue 14 Localizable Applications; 3-D Rotation; QuickTime (Video Digitizing; Making Better Movies) Issue 15 QuickDraw GX; Component Registration; Floating Windows; Working in the Third Dimension Issue 16 Making the Leap to PowerPC; PowerTalk; Drag and Drop From the Finder; Color Matching With QuickDraw GX; International Number Formatting Issue 17 Newton Proto Templates; PowerPC (Standalone Code; Debugging); Thread Manager; Window Zooming Issue 18 Apple Guide; Open Scripting Architecture; Graphics Speed on the Power Macintosh; Displaying Hierarchical Lists; Preferences Files Issue 19 OpenDoc Part Handlers; PowerPC Memory Usage; Designing for the Power Macintosh; QuickDraw GX (Printing; Bitmaps); Inheritance in Scripts Issue 20 AOCE; Make Your Own Sound Components; Scripting the Finder; NetWare on PowerPC Issue 21 OpenDoc Graphics; Designing a Scripting Implementation; Dylan; Object-Oriented Hierarchical Lists Issue 22 QuickDraw 3D; Copland; PCI Device Drivers; Custom Color Search Procedures; The OpenDoc User Experience; Futures Issue 23 QuickTime Music Architecture; QuickDraw 3D Geometries; Internet Config; Multipane Dialogs; Document Synchronization; ColorSync 2.0 Issue 24 Speeding Up whose Clause Resolution; OpenDoc Storage; Sound; Alert Guidelines; Printing Faster With Data Compression; The New Device Drivers Issue 25 QuickTime VR Movies From QuickDraw 3D; Flicker-Free Drawing With QuickDraw GX; NURB Curves; C++ Exceptions in C; Localized Strings for Newton Issue 26 Mac OS 8; QuickTime Conferencing; OpenDoc and SOM Dynamic Inheritance; Adding Custom Data to QuickDraw 3D Objects; 64-Bit Integer Math on 680x0 Issue 27 Speech Recognition Manager; OpenDoc Part Kinds; Apple Guide 2.1 With OpenDoc; Mac OS 8 Assistants; Game Controls for QuickDraw 3D Issue 28 Coding Your Object Model for Advanced Scriptability; New QuickDraw 3D Geometries; QuickDraw GX Line Layout: Bending the Rules; MacApp Debugging Aids; Chiropractic for Your Misaligned Data
A boxed page with a bold serif headline above a magnifying-glass illustration labeled develop, followed by a paragraph and a two-column list of numbered magazine issues and their topics.
Reading notes: The magnifying-glass sidebar text is partially obscured and cut off, so its wording was not transcribed. The faint background text behind the boxed content is not transcribed. Issue 24 reads 'Speeding Up whose Clause Resolution' with 'whose' in bold as printed.
- Printed product names
- develop · develop Bookmark · Developer CD Series Reference Library
- Printed prices
- $13
- Printed dates
- Issue 1 · Issue 28
- Languages
- English
PDF page 6
Easy 3D With the QuickDraw 3D Viewer Ever since QuickDraw 3D shipped in 1995, the QuickDraw 3D Viewer has made adding 3D support to your application easy. With QuickDraw 3D version 1.5 we've enhanced the Viewer to make it even easier to use. We've improved the user interface, added support for Undo, and rolled in some new API calls. Here you'll learn how to implement the Viewer to provide simple yet powerful 3D capabilities in your products. The QuickDraw 3D Viewer provides a way for you to add 3D support to your application without having to come to grips with the complexity of the whole QuickDraw 3D programming API. As described in "QuickDraw 3D: A New Dimension for Macintosh Graphics" in develop Issue 22, full use of QuickDraw 3D requires you to understand many things before you can get started; for example, you need to be able to set up data structures to hold not only the geometries being modeled but also the other elements of a scene, including the lighting, the camera, and the draw context. But sometimes you just want to be able to display some 3D data in your application without having to write five pages of setup code. If this situation sounds familiar to you, the Viewer is tailor-made for your application. You'll learn all you need to know to be able to use it from reading this article and examining the accompanying sample applications. Still, you might want to read the article in Issue 22 as background and to get a sense of how you can use the Viewer in conjunction with the QuickDraw 3D shared library. ABOUT THE VIEWER The QuickDraw 3D Viewer is a high-level shared library, available in both Macintosh and Windows versions, that's separate from the QuickDraw 3D shared library. With fewer calls than the full QuickDraw 3D API, the Viewer is a great place to start exploring QuickDraw 3D. By implementing the Viewer, you can enable users to view and have a basic level of interaction with 3D data in your application without having to call any QuickDraw 3D functions. When you need more power, you can always mix QuickDraw 3D calls with Viewer calls. The Viewer is ideal for applications that might be described as traditional 2D applications, such as image database and page layout applications. For example, the NICK THOMPSON (nickt@apple.com) went last summer to New Orleans, a city with a great public aquarium, with the rest of the QuickDraw 3D team. He spent a lot of time looking at totally awesome products from other vendors and drooling over the SGI Onyx Infinite Reality demo. He also spent time at the aquarium, feeding his fascination with the ocean and its life forms, and brought two fish tanks back with him — one for his home and another for his office. This way, if he can't be in the surf, he at least has props for his fantasies about being there. 4 develop Issue 29 March 1997
A magazine article page with a large bold black headline, a black-and-white portrait photo of smiling Nick Thompson in a patterned shirt with a green name caption, italic introductory text, body columns, and a two-column footer bio separated by a rule, with faint background text from another page visible.
Reading notes: Background ghosted text from a facing page is faint and was not transcribed. The body text is cut off mid-sentence at 'For example, the' where the column continues on a faint overlay, so reading order near that point is uncertain. The 'develop' and 'Issue 22' references are italicized in the scan; the italic styling is not reproduced in plain text. Issue 22 and version 1.5 appear as printed numbers and were transcribed as shown.
- Printed dates
- 1995 · 1997 · Issue 29 March 1997
- Languages
- English
PDF page 7
image database Cumulus (from the German developer Canto Software GmbH) is a traditional 2D application that implements the Viewer to enable users to manipulate objects in 3D (see Figure 1). File Edit Database Record Keywords Find Windows Scripts Red Hatchback • 100 Red Hatchback File Red Hatchback On QuickDraw GX: EDF QuickDraw 3D FINA...: Viewpoint Datalabs Intl.: Program SimpleText Type 3DMF Color Mode Color File Size 530.3 KB Resolution 72 dpi Created 10/11/95 Height 0 pix Modified 10/11/95 Width 0 pix Record Don't Change Cataloged 11/30/95 Status Don't Delete Modified 2/17/96 Image Name Cataloged by Red Hatchback KISTA Notes Keywords Model from Viewpoint DataLabs Figure 1. An example of Viewer use in the Cumulus image database The Viewer gives your application considerable functionality for free. For example, the Macintosh version of the Viewer supports drag and drop of 3D data. And the Viewer allows access to the view object (described in detail in the article in develop Issue 22) so that you can add to your application the capability of changing the lighting, the camera angles and position, and other things such as the type of renderer being used. Implementing the Viewer in your application is simple. After going over a few preliminaries, we'll look in detail at two sample applications — one just a bare-bones framework for using the Viewer, and the second a more elaborate application that implements a fuller set of Viewer features. The source code for both programs accompanies this article on this issue's CD and develop's Web site. CHECKING THAT THE VIEWER IS INSTALLED Before you can use the Viewer, you need to make sure that it's installed. There are two ways to do this on the Macintosh: you can use Gestalt on System 7 or you can weak-link against the library and check to see if one of the Viewer routines has been declared when you launch your application. You need to call Gestalt with the constant gestaltQD3DViewer, as shown in Listing 1. The routine IsQD3DViewerInstalled returns a Boolean indicating whether the Viewer QuickDraw 3D Plastic Bottle Big Ben QuickDraw 3D.3DMF EASY 3D WITH THE QUICKDRAW 3D VIEWER 5
A magazine page with a black-and-white Macintosh screenshot of the Cumulus database showing 3D car and object models in windows, with body text above and a section heading and body paragraphs below.
Reading notes: Faint ghosted background text from the reverse side of the page was not transcribed. Small UI text in the screenshot (menu items, field values, and window labels) may be slightly inaccurate. The text 'Viewpoint Datalabs Intl.' and 'Model from Viewpoint DataLabs' capitalization differs in the scan and was transcribed as printed. The 'Red Hatchback' window title and some labels in the dialog are partially obscured by overlapping windows. Reading order of the screenshot labels is approximate.
- Printed product names
- Cumulus · QuickDraw 3D · QuickDraw GX · SimpleText · Viewpoint DataLabs
- Printed dates
- 10/11/95 · 11/30/95 · 2/17/96
- Languages
- English
PDF page 8
has been installed correctly. The bit selector gestaltQD3DViewerAvailable can be used to test the appropriate bit of the response from Gestalt. Listing 1. Checking for the Viewer with Gestalt Boolean IsQD3DViewerInstalled() { OSErr theErr; long gesResponse; if (Gestalt(gestaltQD3DViewer, &gesResponse) != noErr) return false; else return (gesResponse == gestaltQD3DViewerAvailable); } The other method is to weak-link against the Viewer library and check the value of one of the Viewer routines against the constant kUnresolvedCFragSymbolAddress (defined in CodeFragments.h): if ((long)Q3ViewerNew != kUnresolvedCFragSymbolAddress) { ... /* Call Viewer routines. */ } For more information on weak linking (also called soft importing), consult the documentation that came with your development system. If you use this method, you'll also need to include the file CodeFragments.h. DETERMINING THE VIEWER VERSION Version 1.5 of the Viewer introduces several new API features not found in previous versions of the Viewer. If you want your application to be compatible with previous versions of the Viewer, you need to check the version by calling the new routine Q3ViewerGetVersion. Of course, before you can call this routine, you'll need to test whether it's been loaded along with the Viewer shared library by checking its address against the symbol kUnresolvedCFragSymbolAddress. If it hasn't been loaded, you can safely assume that the Viewer version is 1.0. Alternatively, you can check the address of each function you need to use against kUnresolvedCFragSymbolAddress. Listing 2 shows a routine to determine the Viewer version; this routine works with all versions of the Viewer library. A BARE-BONES FRAMEWORK FOR USING THE VIEWER Now let's take a look at one of the simplest possible applications we might write to enable someone to open and view QuickDraw 3D metafiles (files containing 3DMF data). Of course, this isn't a real Macintosh program — it opens only one document, it doesn't respond to Apple events, it doesn't present a menu bar, and the user can't save changes made in the window. But it does demonstrate that with just five calls to the Viewer library you can provide good support for 3DMF data in your application. We're not going to cover anything but the QuickDraw 3D part of this application in any detail, but the source code is commented well enough so that it should be clear how it works. 6 develop Issue 29 March 1997
A text-heavy magazine page with a green rule at top, a boxed code listing titled Listing 1, several body paragraphs, bold section headings, and a green-and-black page footer, with faint background imagery of a figure behind the text.
Reading notes: Faint background imagery and ghosted text from the reverse side or adjacent layout show through and were not transcribed. The headline is printed in the middle of the page as a section heading; 'DETERMINING THE VIEWER VERSION' is a subheading and was included in transcript only. Printed number 'Issue 29' and 'March 1997' appear in the footer; the '1.5' and '1.0' values are version numbers rather than dates.
- Printed dates
- March 1997 · 1.5 · 1.0
- Languages
- English
PDF page 9
Listing 2. Checking the Viewer version number OSErr GetViewerVersion(unsigned long *major, unsigned long *minor) { /* Version 1.0 of the QuickDraw 3D Viewer had no get version call, so see if the symbol for the API routine descriptor is loaded. */ if ((Boolean)Q3ViewerGetVersion == kUnresolvedCFragSymbolAddress) { *major = 1; *minor = 0; return noErr; } else return Q3ViewerGetVersion(major, minor); } THE WINDOW Figure 2 shows the window from our simple application, called BareBones3DApp. An instance of the Viewer — a viewer object — can occupy an entire window or it can occupy some smaller portion of a window. In the case of BareBones3DApp, the viewer object entirely fills the window. The viewer object consists of a controller strip and a content area outlined with a drag border. Teapot Content area Drag border Controller strip Active button Figure 2. Window from BareBones3DApp • The controller strip contains a number of buttons for manipulating the user's point of view (that is, the view's camera). Each of the buttons either performs a specific function, such as setting a particular camera for the view, or sets a mode that determines how user interactions are handled. The controller strip can also be hidden; in this case, a visual element known as a badge takes its place to indicate to the user that the image in the window represents a 3D model. The user can click on the badge to make the controller strip appear. • The content area (called the picture area in earlier documentation) is where the 3DMF data is drawn. Users can interact with the object drawn in the content EASY 3D WITH THE QUICKDRAW 3D VIEWER 7
A textbook page with a gray-bordered code listing at top, a body text section with a black-and-white rendered teapot in a Mac-style window labeled with callouts for content area, drag border, controller strip, and active button, and a green rule across the top.
Reading notes: This is a technical manual page rather than an advertisement; no advertised products, prices, or dates are visible. Faint ghosted background text from adjacent content (bleed-through of the facing page) is largely illegible and was omitted. The Figure 3 caption and the lower-right paragraph fragments are faint and only partially legible; they were not transcribed. Reading order follows the listing, then the section heading, body text, figure callouts, and bullet points.
- Languages
- English
PDF page 10
area in one of several modes, the modes being selected by clicking one of the buttons in the controller strip. In the default mode that the window opens up in, users can change the camera angle by dragging across the object. • The "OpenDoc-style" drag border indicates that the viewer content area can initiate drags of 3DMF data. By dragging on this border the user can drag the object displayed in the content area. If dragging into and out of the content area is enabled (as it is by default), the border will be highlighted when a drag is initiated to indicate that the content area can receive drops as well. The part of the window that contains the content area and the controller strip (if present) is the viewer pane. As an alternative to having the viewer pane entirely fill the window, you can place the viewer pane in just part of the window, as shown in Figure 3. This is useful for embedding a 3D picture in a document window. ActiveArt™ Funky Radio.3DMF Figure 3. The viewer pane as part of a window In the controller strip, the active button is drawn to look as if it's been pressed. The buttons shown in Figures 2 and 3 are the default ones; you can hide those you don't want, or make visible the one additional button that's hidden by default, by setting flags that will be discussed shortly. You can also hide or show the entire controller strip; you'll see how to do this later. The full set of available controller buttons is shown in Figure 4. Let's look at each in turn. The camera viewpoint button (called the camera angle button in earlier documentation) enables the user to view the displayed object from a different camera angle. Holding down the button causes a pop-up menu to appear, listing the predefined direction cameras as well as any 8 develop Issue 29 March 1997
A magazine page with body text, a bulleted paragraph, a Mac-style window screenshot showing a grey 3D radio object in a viewer pane with a controller button strip, and a figure caption, with faint ghosted text from the adjacent page in the background.
Reading notes: The window title bar text 'ActiveArt™ Funky Radio.3DMF' is rendered in a stylized pixel font and transcribed from the screenshot; the trailing 'Radio.3DMF' spelling was read as printed. Faint background text from the reverse or adjacent page is ghosted and was not transcribed. The bottom fine print on the lower right edge is cut off and was not transcribed.
- Printed dates
- March 1997 · 29
- Languages
- English
PDF page 11
Camera viewpoint Rotate Move Distance Zoom Reset Figure 4. The full set of available controller buttons perspective (view angle aspect) cameras stored in the view hints of the 3DMF data. If any such cameras have name attributes associated with them in the data, the names are displayed in the pop-up menu; otherwise, the cameras are listed as "Camera #1," and so on. (The predefined direction cameras are calculated based on the front and top custom attributes if present in the 3DMF view hints; otherwise, they're calculated from the displayed object's coordinate space.) The distance button lets the user move the displayed object closer or farther away. Clicking the distance button and then dragging downward in the content area moves the object closer. Dragging upward in the content area moves the object farther away. The Down Arrow and Up Arrow keys also move the object closer or farther away, respectively. The rotate button enables rotating an object. Clicking this button and then dragging in the content area rotates the displayed object in the direction of the drag. The arrow keys rotate the object in the direction of the arrow. With version 1.5 of the Viewer library, you can use the Shift key to constrain the motion of the object as you rotate it. The zoom button enables the user to alter the field of view of the current camera, thereby zooming in or out on the displayed object. After the zoom button is clicked, pressing the Up Arrow and Down Arrow keys zooms the object out and in. By default, this button isn't displayed. The move button lets the user move an object. Clicking this button and then dragging in the content area moves the object to a new location. The arrow keys move the object in the direction of the arrow. The reset button resets the camera angle and position to their initial settings. THE BASIC CALLS As mentioned earlier, you can add support for 3DMF data with calls to just five routines in the Viewer shared library. These routines, described below, are the ones we use in BareBones3DApp. For more details on these calls, see the book 3D Graphics Programming With QuickDraw 3D. Q3ViewerNew — Creates a viewer object and attaches it to a previously created window, then returns a reference to the viewer object. You need to pass this reference to other Viewer routines. Q3ViewerDispose — Disposes of the viewer object and associated storage. You'll probably want to do this just before closing and disposing of the window. EASY 3D WITH THE QUICKDRAW 3D VIEWER 9
A printed book page with a row of six controller button icons at top labeled Camera viewpoint, Rotate, Move, Distance, Zoom, and Reset, followed by body text and small button icons beside descriptive paragraphs, with a green rule across the top and a page footer.
Reading notes: Faint background text on the right margin and the lower-right area is ghosted and was not transcribed Top-right margin text under the green rule is too faint to read reliably Button icons' captions are placed around the icon row and reading order is approximate Text on the upper-right column faded and partly illegible; omitted rather than inferred
- Printed product names
- QuickDraw 3D · BareBones3DApp · 3DMF
- Printed dates
- 1.5
- Languages
- English