home *** CD-ROM | disk | FTP | other *** search
- {-------------------------------------------------------------
- #
- # Apple Macintosh Developer Technical Support
- #
- # MacApp Color QuickDraw Fractal Printing Sample Application
- #
- # FracApp300
- #
- # MFracApp300.p - Pascal Source
- #
- # Copyright ⌐ 1988 Apple Computer, Inc.
- # All rights reserved.
- #
- # Versions: 1.0 8/88
- #
- # Components: MFracApp300.p August 1, 1988
- # UFracApp300.p August 1, 1988
- # UFracApp300.inc1.p August 1, 1988
- # FracApp300.r August 1, 1988
- # FracApp300.make August 1, 1988
- #
- # The FracApp300 program is a version of the FracApp program that is
- # set up to be as compatible as possible. It uses the PrGeneral call
- # in order to print at high resolution. It demonstrates how to create
- # and save 300 dpi PICT files. It uses an offscreen port to calculate
- # the data, and CopyBits to update the window on the screen. When the
- # documents are written or read, the QuickDraw bottlenecks are used to
- # avoid having a huge memory hit during saving or opening. (800K of RAM
- # not needed, on a 640x480 screen, a big win.) The Palette Manager is
- # used very slightly, only to associate a small palette with only Black
- # and White with each window. This avoids needing the system palette
- # for each window, when no colors are used. Since we are printing to
- # normal printers, we only use B&W in this version.
- # Written in MacApp Object Pascal code.
- # Compatibility rating = 1. (The use of PrGeneral is slightly
- # out of the ordinary, although supported.)
- #
- # The program is a complete Macintosh application written in Object
- # Pascal using MacApp. It supports multiple windows, calculations in the
- # background under MultiFinder, use of the Palette Manager, reading and
- # writing of PICT files using the bottlenecks, and shows how to calculate
- # the Mandelbrot set.
- #
- # There is a resource file that is necessary as well, to define the Menus, Window,
- # Dialog, and Palette resources used in the program.
- -------------------------------------------------------------}
- {copyright 1988 by Bob. All rights reserved.
- February 1, 1988.
- Written by Bo3b Johnson of Developer Technical Support. }
-
- PROGRAM FracApp;
-
- USES
- {$LOAD MacIntf.LOAD}
- MemTypes, QuickDraw, OSIntf, ToolIntf, PackIntf,
- {$LOAD UMacApp.LOAD}
- UObject, UList, UMacApp,
- {$LOAD UBobLips.LOAD}
- PaletteMgr, UPrinting,
- {$LOAD}
- MacPrint,
- UFracApp300;
-
-
-
- VAR
- {The application object:}
- gFracAppApplication: TFracAppApplication;
- error: Integer;
-
-
- FUNCTION ForceEnvirons(minimumSystemVersion: INTEGER;
- minimumProcessor: INTEGER; needsFPU: BOOLEAN;
- needsColorQD: BOOLEAN;
- minimumATDrvrVersNum: INTEGER): BOOLEAN;
-
- VAR
- error: OSErr;
- theWorld: SysEnvRec;
-
- BEGIN
- error := SysEnvirons(1,theWorld);
- WITH theWorld DO
- ForceEnvirons := (systemVersion >= minimumSystemVersion) AND
- (processor >= minimumProcessor) AND (hasFPU >=
- needsFPU) AND (hasColorQD >= needsColorQD) AND
- (atDrvrVersNum >= minimumATDrvrVersNum);
- END;
-
-
- BEGIN
- {Initialize the Toolbox, making 8 calls to MoreMasters:}
- InitToolbox(8);
-
- { The first thing we have to do is ensure that we can run in this environment.
- We must do a ForceEnvirons to avoid crashing needlessly on machines where
- we have no color or 881. The minimum system is 4.2 since we need the more
- robust printing stuff. We dont use 020 code, but we require an FPU. We
- dont require colorQD. If we dont have the stuff we need, we will alert and
- leave. }
- IF NOT ForceEnvirons($0420, envDontCare, TRUE, TRUE, envDontCare) THEN
- Failure (kWrongMachine, 0);
-
- {Initialize the UPrinting unit:}
- InitPrinting;
-
- {Allocate a new TFracAppApplication object:}
- New(gFracAppApplication);
-
- {Initialize that new object:}
- gFracAppApplication.IFracAppApplication(kFileType);
-
- {Run the application. When it's done, exit.}
- gFracAppApplication.Run;
- END.
-