TweetFollow Us on Twitter

GXGraphic Extension

Volume Number: 13 (1997)
Issue Number: 10
Column Tag: develop

Using the GXGraphics Extension

by Ingrid Kelly and Robin Mikawa, Apple Developer Technical Support

Using The GXGraphics Extension

Starting with Mac OS 8.0, the QuickDraw GX environment no longer supports the GX Printing Manager API. Although this decision will require significant changes to existing system software and applications, it will allow us to transition to a unified printing architecture that will improve the compatibility of QuickDraw GX software in the classic QuickDraw environment. Mac OS 8.0 includes the GXGraphics 1.1.6 extension, which provides the advanced Graphics and Typography capabilities of QuickDraw GX, a QuickDraw GX codec in the QuickTime 2.5 extension, and a fully integrated version of the Collection Manager. This article includes:

  • The changes needed for an application (GX aware, GX savvy, and GX dependent) to support GX Printing on Mac OS 8.0.
  • Where to get the current version of the GXGraphics extension (1.1.3) and a description of any differences with GXGraphics 1.1.6 included with Mac OS 8.0.
  • Any known incompatibilities or limitations of the GXGraphics extension, as well as known solutions to these problems. This Article is intended to help developers who wish to transition their GX products to support QuickDraw GX on Mac OS 8.0.

Note: Throughout this Article, the term, "classic printing architecture," refers to the Macintosh Printing Manager described in Chapter 9 of Inside Macintosh: Imaging With QuickDraw. "QuickDraw GX" refers to the full GX environment (i.e., Graphics, Typography, and Printing) and "GXGraphics" refers to the partial GX implementation provided by the GXGraphics extension (i.e., Graphics and Typography).

Features Not Supported in Mac OS 8.0

Following is a list of key features that are currently available in QuickDraw GX 1.1.3/1.1.5 that will no longer be available to developers under the GXGraphics 1.1.6 strategy:

  • GX Printer Driver APIs: GX Printer drivers will no longer be supported. All developers need to have a classic printer driver for their device.
  • GX Printing Extensions: GX Extensions will no longer be supported. Some developers may be able to roll their GX extension functionality into their application or driver.
  • Custom page formatting (the ability to arbitrarily specify page formatting within a single document): This feature will no longer be available. This feature could be implemented using the extended print record architecture added with LaserWriter version 8.4. See develop Journal Issue 27: 'The All-New LaserWriter Driver Version 8.4' for more information on the extended print record.
  • Portable Digital Document authoring: Developers will no longer be able to author PDDs via the GX Printing APIs. Also, SimpleText will not display PDDs under QuickDraw GX 1.1.6. You should convert PDD files to a different format, such as Adobe Acrobat PDF files, before attempting to use them with Mac OS 8 or QuickDraw GX 1.1.6
  • Vector Print Driver API: Under the new GX model, there will no longer be a custom API for vector printer driver developers. Vector printer drivers will have to be written with the classic printing architecture.

Overview of the GXGraphics Extension

The GXGraphics extension is a system extension that adds powerful graphics and typographic capabilities to your user's Macintosh without requiring the full QuickDraw GX package to be installed on your user's machine. The extension that we are currently licensing and distributing, GXGraphics 1.1.3, covers all QuickDraw GX graphics and typography functionality up to and including QuickDraw GX version 1.1.3.

GXGraphics 1.1.3

The GXGraphics 1.1.3 extension contains GX graphics and typography, but does not contain GX Printing. There are stubs for the GX Printing calls in QuickDrawGXLib/GXGraphics 1.1.3 but they do not work. This extension has been released and tested on 7.5.1 through 7.6. See Table 1 for more specific details.

GXGraphics 1.1.6

The GXGraphics 1.1.6 release contains GX graphics and typography, but will no longer have the printing stubs available. This extension has been tested and released for Mac OS 8.0. See Table 1 for more specific details.

NameVersionComponent Gestalt Selector
QuickDraw GX1.1.3, 1.1.5QuickDraw GX* qdgx (obsolete)
GX Printing* pmgr
GX Graphics* grfx
Collections Mgr* cltn
GXGraphics1.1.3GX Printing**
GXGraphics* grfx
Collections Mgr**
GXGraphics1.1.6GXGraphics* grfx

* APIs are exported and available
** APIs are exported but not available; you should use the gestalt selector on application launch to verify whether or not the functions are implemented.

Table 1. Differences in the QuickDraw GX Releases.

Note: With Mac OS 8.0, the Collections Manager APIs have been rolled out of QuickDraw GX and into the system.

Application Changes

Since the GX printing architecture will no longer be supported for Mac OS, any software that does not already have a solution using classic QuickDraw printing will need to be updated. For the majority of applications, the recommended solution for Mac OS 8.0 is to use the QuickTime compression/decompression mechanism for imaging QuickDraw GX data. The basic technique is to encapsulate the QuickDraw GX image in a compressed data format using the object flattening functions from QuickDraw GX. Once the compressed image data is created, it may be passed to the QuickDraw GX codec and drawn using the QuickTime image compression functions or embedded within a QuickDraw picture and drawn using the DrawPicture function. In either case, the compressed data is passed to the the low-level QuickDraw drawing routines through the StdPix bottleneck routine. StdPix decompresses the data using the QuickDraw GX codec and passes the decompressed data to the bitsProc bottleneck routine when rendering the image.

LaserWriter drivers starting with version 8.3 recognize compressed data that may be drawn using QuickTime, like QuickDraw GX flattened objects. For Mac OS 8.0, the LaserWriter driver has been modified to render the QuickDraw GX data at the device resolution of the printer. When despooling, the printer driver changes the resolution of the offscreen drawing port and uses the QuicDraw GX codec to rasterize the compressed data. The QuickDraw printer drivers from Apple render the compressed data during spooling and use the resolution of the active graphics port. Application developers may wish to use the device resolution commands of the PrGeneral routine to improve the quality of their printed images as described in "Meet PrGeneral, the Trap That Makes the Most of the Printing Manager," in develop 3.

General Changes For All Applications

The sample code for this Article includes updated versions of three QuickDraw GX user libraries, CodecLibrary, PrintingLibrary, and StorageLibrary, that may be used to simplify the conversion of your software. The TwoFace sample application supports the basic job, format, dialog, and spooling functions of the QuickDraw GX Printing Manager. It uses an abstraction layer provided by the PrintingLibrary to handle printing through the QuickDraw GX and classic QuickDraw printing architectures, depending on which environment is available when the application is launched. All the changes described in this section are handled automatically by the user libraries if you simply convert any references to the QuickDraw GX Printing Manager, including the gxJob and gxFormat data types, to the equivalent functions and data types of the PrintingLibrary.

1) Check the correct gestalt selector. Use the individual grfx and pmgr gestalt selectors rather than the obsolete qdgx gestalt selector.

Boolean gPrintingArchitecture = false;
long theFeature;

if ( Gestalt(gestaltGraphicsVersion, &theFeature) != noErr )
		return;

if ( Gestalt(gestaltGXPrintingMgrVersion, &theFeature)!= noErr )
	gPrintingArchitecture = kQDPrArch;
else
	gPrintingArchitecture = kGXPrArch;

2) For 68000 applications that use A-trap addresses to determine which parts of the GX environment are installed, use the individual gestalt selectors instead. This technique is not recommended but has been used by some applications in the past. If this is the case for your application, verify that you are checking the correct A-trap addresses:

Trap Address Technology
ABFEGX Printing
A832GX Graphics
ABF6Collections Manager

3) During initialization of a PowerPC application, check if the QuickDraw GX Printing library is installed. If the application is "weak" linked to the library, the Process Manager will launch it even if the library is missing, although the Code Fragment Manager will not resolve the addresses of the functions in the library. If the application calls any of these functions, it will crash. Your application should check if any of the Printing Manager functions cannot be resolved and exit gracefully if the library is missing. Note that the check could be performed against any function you call in the library. GXInitPrinting is often the first function that is called from the Printing Manager, so it is convenient.

if ( (UInt32)GXInitPrinting == UnresolvedCFragSymbolAddress )
	gPrintingArchitecture = kQDPrArch;

4) During printing, create a single picture shape for the contents of each page in the document. The PrintingLibrary includes a sample viewport filter function that handles this task from within the printing loop.

5) Use GXFlattenShape to create the compressed data for the QuickDraw GX codec. GXFlattenShape is described in detail in Inside Macintosh: QuickDraw GX Objects 2-88 to 2-89.

6) Use DecompressImage as described in "Printing Images Faster With Data Compression", in develop 24 (December 1995) to create the QuickDraw picture with the embedded QuickDraw GX data. When the application calls the standard DrawPicture function to display the image containing the compressed QuickDraw GX data, the StdPix function decompresses the image by invoking the Image Compression Manager. The CodecLibrary implements a function, GXCdShapeToPicture, that encodes the QuickDraw GX data as QuickTime compressed data and creates a PicHandle; an application may use this routine to create a QuickDraw picture prior to entering the printing loop or to convert a QuickDraw GX document to the QuickDraw PICT file format. DecompressImage is described in detail in Inside Macintosh: QuickTime, pages 3-78 to 3-79.

7) An alternative to Step 6 is to pass the flattened QuickDraw GX data directly to the custom StdPix bottleneck installed by the printer driver during printing. The CodecLibrary implements a function, GXCdDrawShape, that converts the QuickDraw GX data to a QuickTime encoded PixMap data structure, which it passes to the QuickDraw GX codec from within the printing loop. StdPix is described in detail in Inside Macintosh: QuickTime, pages 3-138 to 3-139.

Specific Changes Required Based on Level of Support

Here is an outline of the changes GX applications will need to make. They are outlined according to the level of GX support.

GX Unaware (no knowledge of GX)

  • No changes are needed

GX Aware (implements core GX Printing features)

  • Classic Printing code should be added using the new printing user library. (Step 1-7)

GX Savvy (implements support for Graphics, Typography and Printing)

  • Classic Printing code should be added using the new printing user library. (Step 1-7)

GX Dependent (requires GX to be installed to function)

  • Classic Printing code should be added using the new printing user library. (Step 1-7)

Additional Changes

Custom Page formatting

  • Currently, applications that wish to implement custom page formatting will have to spool multiple jobs per document. One job for each change in the page formatting.

It is important to note, that even today -- on System 7.5.x -- it is possible for an application using GXGraphics 1.1.x to print using the classic printing mechanism described above.

GX Printing Extension Changes

Printing extensions have been used for a wide variety of things in the history of GXPrinting. However, despite their potential for optimizing printing from certain kinds of applications, they have never been developed or used to their full potential by many developers. Unfortunately, under the new GX model , GX extensions are no longer available. Some of the functionality that developers have used GX extensions for can be rolled into classic applications or drivers, but that will have to be determined by the developer on a case-by-case basis.

GX Printer Driver Changes

Under the new GX model, GX printer drivers will no longer be supported. There is no transition plan for these drivers.

Classic Printer Driver Changes

  • In the world of GXGraphics 1.1.6 it will be desirable to print GX objects to classic printer drivers.

Raster

  • For raster printer drivers, the output from an updated GX application should match the high quality output today from GX drivers.

PostScript

For PostScript printer drivers however, there will be some changes required to add support for printing high-quality GX objects. We are currently working on determining what the best delivery mechanism for these changes will be (a library, an new API, atc.). As soon as we have a better idea of how to do this, we will update this Article to reflect the necessary changes.

PDD Changes

Under the new GX architecture, there is no way to author PDD documents. Also, SimpleText will not display PDD's under QuickDraw GX 1.1.6. You should convert PDD files to a different format, such as Adobe Acrobat PDF files, before attempting to use them with Mac OS 8 or QuickDraw GX 1.1.6.

Incompatibilities and Limitations

This section describes the known incompatibilities and limitations, and their solutions for the GXGraphics 1.1.6 extension:

  • Current versions of printer drivers may generate large spool files and take a long time to print when printing documents containing QuickDraw GX data. In addition, QuickDraw GX data printed to the Apple Color LaserWriter may be printed at less than full printer resolution. These problems will be addressed in future versions of printer drivers from Apple and other vendors.
  • With ATM 4.0.2, some PDF documents that use ATM substitution fonts may not print correctly using the LaserWriter 8 driver. This problem will be fixed in a future version of LaserWriter 8 which will be available in late summer 1997.
  • ATM 3.8.3 and 4.0 do not currently recognize that QuickDraw GX is installed when the GXGraphics extension is in your user's system. This causes problems with Type-1 enabled fonts. This problem has been fixed with the 4.0.2 release of ATM by Adobe Systems. Check with Adobe for a newer version of ATM Deluxe.
  • Some older QuickDraw pictures with embedded QuickDraw GX data may print with random noise in the background of the picture. This problem will be fixed in a future version of QuickTime.
  • Some QuickDraw GX data may print incorrectly in low memory conditions. You may notice that parts of the image repeat rather than the entire image printing correctly. This problem is in the QuickDraw GX QuickTime Codec and will be fixed in a future version of QuickTime.

Where To Get GXGraphics 1.1.6 And How To License It

The GXGraphics 1.1.6 extension

  • GXGraphics 1.1.6 is only available as part of the Mac OS 8.0 package. It is equivalent to the GXGraphics 1.1.3 release with a new installer and PPC library changes.

Software Licensing

  • For developers who wish to ship the GXGraphics extension with their product, you must contact Software Licensing at sw.license@apple.com or call them at 512-919-2645. Reference the QuickDraw GX software license to make sure you get the appropriate licensing agreement.

Conclusion

By simply following the above steps, you should easily be able to convert your GX applications into a viewable applications that your users will be able to use without having the complete GX extension installed.

Further References

  • Inside Macintosh: Imaging With QuickDraw
  • Inside Macintosh: QuickDraw GX Graphics
  • Inside Macintosh: QuickDraw GX Objects
  • Inside Macintosh: QuickTime
  • "The All-New LaserWriter Driver Version 8.4", in develop 27 by Dave Polaschek.
  • "Printing Images Faster With Data Compression", in develop 24 by David Gelphman.
  • "Meet PrGeneral, the Trap That Makes the Most of the Printing Manager", in develop issue 3 by Pete Alexander.
  • "A Print Loop That Cares--The Sequel", Technote 1092 by Ingrid Kelly.
  • "Adding Items to the Printing Manager's Dialogs", Technote 1080 by Ingrid Kelly and Dave Polaschek.

Acknowledgments

Thanks to Paul Danbold, David Goldsmith, David Hayward, Dan Lipton, and Dave Opstad.


Ingrid Kelly works in Apple's Developer Technical Support group answering questions about graphics, color and printing on the Mac OS. In a previous life, she worked at NASA in the Human Factors Research branch studying aircraft pilots, but she finds that studying people at Apple is much more interesting!

Robin Mikawa has recently returned to her first love as a graphics engineer on the QuickDraw GX project. A three-year stint on the WordScript engineering team has instilled her a love for typographical truffles, multilingual system software, and noodle-based dishes from all parts of the world.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Fresh From the Land Down Under – The Tou...
After a two week hiatus, we are back with another episode of The TouchArcade Show. Eli is fresh off his trip to Australia, which according to him is very similar to America but more upside down. Also kangaroos all over. Other topics this week... | Read more »
TouchArcade Game of the Week: ‘Dungeon T...
I’m a little conflicted on this week’s pick. Pretty much everyone knows the legend of Dungeon Raid, the match-3 RPG hybrid that took the world by storm way back in 2011. Everyone at the time was obsessed with it, but for whatever reason the... | Read more »
SwitchArcade Round-Up: Reviews Featuring...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for July 19th, 2024. In today’s article, we finish up the week with the unusual appearance of a review. I’ve spent my time with Hot Lap Racing, and I’m ready to give my verdict. After... | Read more »
Draknek Interview: Alan Hazelden on Thin...
Ever since I played my first release from Draknek & Friends years ago, I knew I wanted to sit down with Alan Hazelden and chat about the team, puzzle games, and much more. | Read more »
The Latest ‘Marvel Snap’ OTA Update Buff...
I don’t know about all of you, my fellow Marvel Snap (Free) players, but these days when I see a balance update I find myself clenching my… teeth and bracing for the impact to my decks. They’ve been pretty spicy of late, after all. How will the... | Read more »
‘Honkai Star Rail’ Version 2.4 “Finest D...
HoYoverse just announced the Honkai Star Rail (Free) version 2.4 “Finest Duel Under the Pristine Blue" update alongside a surprising collaboration. Honkai Star Rail 2.4 follows the 2.3 “Farewell, Penacony" update. Read about that here. | Read more »
‘Vampire Survivors+’ on Apple Arcade Wil...
Earlier this month, Apple revealed that poncle’s excellent Vampire Survivors+ () would be heading to Apple Arcade as a new App Store Great. I reached out to poncle to check in on the DLC for Vampire Survivors+ because only the first two DLCs were... | Read more »
Homerun Clash 2: Legends Derby opens for...
Since launching in 2018, Homerun Clash has performed admirably for HAEGIN, racking up 12 million players all eager to prove they could be the next baseball champions. Well, the title will soon be up for grabs again, as Homerun Clash 2: Legends... | Read more »
‘Neverness to Everness’ Is a Free To Pla...
Perfect World Games and Hotta Studio (Tower of Fantasy) announced a new free to play open world RPG in the form of Neverness to Everness a few days ago (via Gematsu). Neverness to Everness has an urban setting, and the two reveal trailers for it... | Read more »
Meditative Puzzler ‘Ouros’ Coming to iOS...
Ouros is a mediative puzzle game from developer Michael Kamm that launched on PC just a couple of months back, and today it has been revealed that the title is now heading to iOS and Android devices next month. Which is good news I say because this... | Read more »

Price Scanner via MacPrices.net

Amazon is still selling 16-inch MacBook Pros...
Prime Day in July is over, but Amazon is still selling 16-inch Apple MacBook Pros for $500-$600 off MSRP. Shipping is free. These are the lowest prices available this weekend for new 16″ Apple... Read more
Walmart continues to sell clearance 13-inch M...
Walmart continues to offer clearance, but new, Apple 13″ M1 MacBook Airs (8GB RAM, 256GB SSD) online for $699, $300 off original MSRP, in Space Gray, Silver, and Gold colors. These are new MacBooks... Read more
Apple is offering steep discounts, up to $600...
Apple has standard-configuration 16″ M3 Max MacBook Pros available, Certified Refurbished, starting at $2969 and ranging up to $600 off MSRP. Each model features a new outer case, shipping is free,... Read more
Save up to $480 with these 14-inch M3 Pro/M3...
Apple has 14″ M3 Pro and M3 Max MacBook Pros in stock today and available, Certified Refurbished, starting at $1699 and ranging up to $480 off MSRP. Each model features a new outer case, shipping is... Read more
Amazon has clearance 9th-generation WiFi iPad...
Amazon has Apple’s 9th generation 10.2″ WiFi iPads on sale for $80-$100 off MSRP, starting only $249. Their prices are the lowest available for new iPads anywhere: – 10″ 64GB WiFi iPad (Space Gray or... Read more
Apple is offering a $50 discount on 2nd-gener...
Apple has Certified Refurbished White and Midnight HomePods available for $249, Certified Refurbished. That’s $50 off MSRP and the lowest price currently available for a full-size Apple HomePod today... Read more
The latest MacBook Pro sale at Amazon: 16-inc...
Amazon is offering instant discounts on 16″ M3 Pro and 16″ M3 Max MacBook Pros ranging up to $400 off MSRP as part of their early July 4th sale. Shipping is free. These are the lowest prices... Read more
14-inch M3 Pro MacBook Pros with 36GB of RAM...
B&H Photo has 14″ M3 Pro MacBook Pros with 36GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 Pro MacBook Pro (... Read more
14-inch M3 MacBook Pros with 16GB of RAM on s...
B&H Photo has 14″ M3 MacBook Pros with 16GB of RAM and 512GB or 1TB SSDs in stock today and on sale for $150-$200 off Apple’s MSRP, each including free 1-2 day shipping: – 14″ M3 MacBook Pro (... Read more
Amazon is offering $170-$200 discounts on new...
Amazon is offering a $170-$200 discount on every configuration and color of Apple’s M3-powered 15″ MacBook Airs. Prices start at $1129 for models with 8GB of RAM and 256GB of storage: – 15″ M3... Read more

Jobs Board

*Apple* Systems Engineer - Chenega Corporati...
…LLC,** a **Chenega Professional Services** ' company, is looking for a ** Apple Systems Engineer** to support the Information Technology Operations and Maintenance Read more
Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
*Apple* / Mac Administrator - JAMF Pro - Ame...
Amentum is seeking an ** Apple / Mac Administrator - JAMF Pro** to provide support with the Apple Ecosystem to include hardware and software to join our team and Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.