From: pinto@waldron.stanford.edu (John Pinto)
Subject: CLUT manipulation & multiple monitors
Keywords: CLUT, palette, XCMD, XFCN, picture
Organization: Psychology Dept, Stanford Univ.
Date: Wed, 8 Apr 92 06:06:56 GMT

I have a Mac IIfx with three 8*24gc video cards connected to three Apple 13"
Hi-Res RGB monitors.  I have written a HC 2.1 stack which uses the "picture"
command to present a series of paired 8-bit PICT images simultaneously on 
two of the monitors.  These PICT files are rather large (400x400 pixels or
larger).  Unfortunately, there is a slight delay between the appearance of 
the first and that of the second image when I tell the "picture" command to
"show" both images.

While I don't care so much when _precisely_ the images are drawn, it _is_
crucial that they both appear on screen at _exactly_ the same time.
I am interested in visual preferences in infants and young toddlers.
If one of the two images comes up noticeably before the other, I'm screwed.
A 3 or 4 screen refresh lag just won't do.  (Although a 1 or 2 lag might.)

One solution I tried was to create one very large PICT which would cover
both monitors.  I thought that both halves would come up on the two screens
simultaneously.  This was not the case.  There was still a perceivable lag
between the two monitors.

Another solution which I've been thinking about would be to manipulate the
CLUTs and palettes of the PICTs I'm presenting so that at first all the colors
map onto black.  When the black images are on the screen, I would then restore
the true CLUT and palette information for those images.  At that point, they
should appear to come up on both screens _very_ quickly.  I know that this
technique has been used successfully for quick presentation of images in the
past.  The BIG question is, can it be done from within HyperCard with PICT
files???  I see three possible branches to the CLUT manipulation technique as
I've described...

1) I use some simple XCMD or XFCN to suppress color information while I'm
   calling the PICTs up to the screen, and then restore color information
   afterwards.  Code would be something like...

   suppressColors  -- this is an XCMD
   show window "left.monitor.pict"
   show window "right.monitor.pict"
   restoreColors  -- this is an XCMD

2) I use some simple XCMD or XFCN to kill screen brightness when I call up
   the PICTs, then restore brightness afterwards.  Code would look something
   like...

   darkenScreen  -- this is an XCMD
   show window "left.monitor.pict"
   show window "right.monitor.pict"
   brightenScreen  -- this is an XCMD

If such commands don't exist (I doubt that they do) I might try:

3) To dink around with ResEdit to create a series of PICTs which will
   force CLUT and palette information to change as in # 1 above.
   Code would look something like...

   show window "pict.with.all.black.CLUT"
   show window "left.monitor.pict"        -- These PICTs would also need to
   show window "right.monitor.pict"       -- have all black CLUTs.
   show window "pict.with.correct.CLUT"

I hope this has made some sense.  I should point out that I feel very
comfortable scripting in HyperTalk.  I also feel comfortable messing
with ResEdit.  I have had some experience programming in Turbo pascal
and Turbo C on MS-DOS machines, but unfortunately I don't have much 
experience programming in Pascal or C on the Mac.

Thanks in advance for any helpful suggestions.

- John    (pinto@psych.stanford.edu)

Newsgroups: comp.sys.mac.hypercard