Screen Saver
Volume Number: 5
Issue Number: 10
Column Tag: Kelly's Corner
After Dark™ and S.P.A.M.M.
By Dave Kelly, MacTutor Editorial Board
Note: Source code files accompanying article are located on MacTech CD-ROM or
source code disks.
A Versatile Screen Saver
Ever since the invention of the CDEV, I have been fascinated with all the ideas that
have surfaced which may be accessed from the control panel. Control panel DEVices
were introduced to us when System 4.1/Finder 5.5 was released. The control panel is
a way to extend user control over system functions. Among my favorite CDEVs is the
Pyro™ screen saver with displays fireworks or by clicking a button in the control
panel, Pyro™ displays a clock. This is a lot more interesting than simply blanking out
the screen. There are quite a few public domain screen saver programs around and a
few are commercially available.
A new CDEV has recently been released by Berkeley Systems. After Dark™ is not
just another screen save CDEV. After Dark™ picks up where Pyro™ left off. After
Dark™ is unique because it allows you (the user) to select which graphics display you
would like to see when the screen blanks out. Thirteen modules have been included
with After Dark™ which vary from Lissajous to messages to time warps. So what?
Well, the best thing about After Dark™ and the reason I’m recommending it here in
MacTutor is that you (the programmer) can program your own modules for use with
After Dark™.
Another feature of After Dark™ is that you may initiate “Anti-Snoop Sleep”
which means that you may assign a password to After Dark™ which will pr event
anyone from awakening the screen without first typing the password. This is
e specially good if you have children (or other co-workers some of whom may still be
children) nearby when you are working and want to take a break without your work
being disturbed. Like Pyro™, you can put the screen to sleep by moving the mouse to
the corner which you specify.
Is there life After Dark?
You can think of After Dark as the shell of the screen saver. It provides the
support to handle your unique graphics module. The graphics modules reside in a
folder in the system folder named ‘After Dark Files’. The module you have selected in
the control panel will be loaded into memory by After Dark when the user places the
pointer in a chosen corner of the screen, or after a specified delay. You can develop
your own graphics modules in any development system which allows generation of code
resources. The After Dark disk contains two example graphics modules written in C and
Pascal for the MPW and Lightspeed programming environments. One is a generic
graphics module which may be used as a skeleton for your own module and the other
shows some of the more advanced features available in After Dark.
The manual explains the programming process in detail. In fact, anyone with
only a fair amount of Macintosh programming experience can use the Generic Module
and turn it into an exciting graphics display. After Dark sends messages to the module
which ask the module to do certain tasks. In particular, first After Dark sends an
Initialize message which is the cue for the module to allocate a Handle to memory and
assign it to the storage parameter. This block of memory is locked down for use by the
module and unlocked when returning from the module to After Dark. When the Blank
message is sent, the module should blank the screen if desired. Then subsequent calls
to the module will send the DrawFrame message which will do the bulk of the graphics
routine. Finally, the Close message is sent so that the module will dispose of any
memory which has been allocated and free it up for use by other Macintosh programs.
In addition, another procedure is used to setup parameters which the module will use.
The parameters passed to each procedure in the module contain information
which can help you in determining what monitors are in use, if Color Quickdraw is
available and other important information. The manual explains the structure of the
parameters and how to use them. In addition, you may set up buttons, sliders, popup
menus, check boxes, and text strings. Any combination of up to four of these controls
may be defined in unique resource types which After Dark recognizes. When After
Dark sees these resources in the module, the resource is used to draw the controls in
the control panel window (when it is open). The id number of the control on the first
line is 1000, the second is 1001, and so on for up to 4 lines. The resource name is
displayed with the control to describe it; for example, the resource name of the check
box resource which is type ‘xVal’ is the name that is used with the check box. For
your convenience, After Dark includes a template file for ResEdit which supports the
After Dark resources to make it easier to create them. You can even include your own
‘clut’ resource for enhancing color graphics.
I’ve included a sample module which I wrote created based on the generic module
provided with After Dark. After Dark is fun! Programming After Dark is a good way to
experiment with graphics designs you may have or just write a quick routine to amaze
your friends. You do have to be programming aware as you acquire and dispose of
memory or you could have some unexplained crashes. Several hints are provided in
the manual which should help to make your module crash free.
By the way, the pricing of After Dark is reasonable too. The program lists for
$39.95. It was available at MacWorld Expo and is available now. Jack Eastman wrote
After Dark and many of the modules. Patrick Beard wrote much of the example code
and several modules. Bruce Burkhalter wrote example code, the technical manual, and
a couple of the modules.
After Dark™ is available from:
Berkeley Systems, Inc.
1700 Shattuck Avenue
Berkeley, California 94709
(415) 540-5535
Price: $39.95
NOT COPY PROTECTED!!
Introducing S.P.A.M.M.
Don’t you just love those acronyms? Ok, you ask, just what does S.P.A.M.M. stand
for? S.P.A.M.M. (System Program for Accelerated Macintosh Mathematics) is an INIT
that speeds up arithmetic operations on the Mac Plus and SE for most applications.
I’m not going to say much about this INIT, but if you are wishing that you could speed
up your Mac Plus or SE, this is a cheap way to get a little boost in performance. You
may not be able to tell any difference unless your application is math intensive.
Depending on the test being run, S.P.A.M.M. has shown a 20% to 60% increase in
speed. I personally only measured 20%, but I have to admit that I do most of my heavy
computing on the Macintosh II.
The only annoying thing is that in order to install S.P.A.M.M. the master disk
must be present for the user to enter name and organization information. Once the
user name/organization information is entered, the INIT is completely copyable. It
doesn’t bother me to have to type in my name etc., but I don’t like the idea of modifying
the master disk for any reason. If this bothers you then I recommend you make a
bit-copy of the master disk and use the backup.
Bravo Technologies, Inc.
P. O. Box 10078
Berkeley, CA. 94709-0078
(415) 841-8552
Price:
User ID Copy protection!
FOR MAC PLUS & SE ONLY!
Listing: BH Module.p
{Black Hole Module Module.p}
{A very simple graphics module for After Dark™}
{ Generic Shell by Patrick Beard and Bruce Burkhalter }
{ © 1989 Berkeley Systems Inc . }
{ module by Dave Kelly, © 1989 MacTutor}
unit BlackHole;
interface
uses
Quickdraw, GraphicsModuleTypes;
function DoInitialize (var storage: Handle; blankRgn: rgnHandle;
params: GMParamBlockPtr): OSErr;
function DoBlank (storage: Handle; blankRgn: rgnHandle; params:
GMParamBlockPtr): OSErr;
function DoDrawFrame (storage: Handle; blankRgn: rgnHandle; params:
GMParamBlockPtr): OSErr;
function DoClose (storage: Handle; blankRgn: RgnHandle; params:
GMParamBlockPtr): OSErr;
function DoSetup (blankRgn: rgnHandle; message: integer; params:
GMParamBlockPtr): OSErr;
implementation
BHStorage = record
CircleRect: Rect;
{this is the rectangle for the circle to be drawn}
CircleColor: integer;
BlankingColor: integer;
Center: Point;
Origin: Point;
ScreenRect: Rect;
end;
BHStoragePtr = ^BHStorage;
BHStorageHandle = ^BHStoragePtr;
function DoInitialize (var storage: Handle; blankRgn: rgnHandle;
params: GMParamBlockPtr): OSErr;
{Allocate memory and initialize variables here}
var
result: OSErr;
myStorage: BHStorageHandle;