[comp.sys.mac.programmer] color/gamma table animation

evensen@husc9.harvard.edu (Erik Evensen) (06/21/91)

In article <1991Jun20.172609.9795@ni.umd.edu> zben@ni.umd.edu (Ben Cranston) writes:

   In article <EVENSEN.91Jun20083252@husc9.harvard.edu>
   evensen@husc9.harvard.edu (Erik Evensen) writes:

   > Well, I hate to be a stick in the mud but to set the record straight,
   > it is my understanding, after reading the Palette Manager section of
   > Inside Mac VI that direct devices (i.e., those whiz-bang 24 bit
   > colorcards) do not have CLUT's either.  To quote: "Color table
   > animation doesn't work on a direct device -- it has no color table."
   > (p. 20-11)  Now maybe there's a trick to getting a direct device to
   > act like one which has a CLUT but I haven't seen anything about it;
   > correct me if I'm wrong.  

   OK!   :-)

   I understand all mainline Apple video cards have a Gamma correction table,
   and that it is at least theoretically possible to do color table animation
   of sorts by modifying this table on the fly.  I've never done so and hope
   to never *have* to do so.

   [explanation of what a gamma table is deleted...]

Thank you for the information...

I looked up gamma table in IM VI and it is listed in the Control Panel
as part of an example for writing a control panel.  The passage refers
to "Designing Cards and Drivers for the Macintosh Family".  I get the
feeling that this is not something us lowly programmers are supposed
to muck with and is probably less portable than doing CLUT animation.
Am I missing some great programming technique here?

--Erik (evensen@husc.harvard.edu)

eastman@csa2.lbl.gov (JACK EASTMAN) (06/22/91)

In article <EVENSEN.91Jun20145544@husc9.harvard.edu>, evensen@husc9.harvard.edu (Erik Evensen) writes...
> 
>   OK!   :-)
> 
>   I understand all mainline Apple video cards have a Gamma correction table,
>   and that it is at least theoretically possible to do color table animation
>   of sorts by modifying this table on the fly.  I've never done so and hope
>   to never *have* to do so.
> 
>   [explanation of what a gamma table is deleted...]
> 
>Thank you for the information...
> 
>I looked up gamma table in IM VI and it is listed in the Control Panel
>as part of an example for writing a control panel.  The passage refers
>to "Designing Cards and Drivers for the Macintosh Family".  I get the
>feeling that this is not something us lowly programmers are supposed
>to muck with and is probably less portable than doing CLUT animation.
>Am I missing some great programming technique here?
> 
>--Erik (evensen@husc.harvard.edu)

I've played with the gamma table and it ain't easy.  Erik hit the nail
on the head when he mentioned portability.  If you're going to mess with
the gamma table, you have to set it back to what it was, not just to some
default values, or the color prepress people who care about precise color
matching will march up your alley carrying torches.  There's a documented
video driver control call (GetGamma) for obtaining the gamma table the 
board is currently using, and another (SetGamma) for setting a new one.
Unfortunately, the GetGamma call is documented in "Designing Cards and
Drivers" second edition, but not in the first.  Therefore many video cards
do not support this call.  Worse, some third party video drivers in early
ROM versions (in about five cases that I know about, none of them no-name
vendors) go so far as to crash when called with the GetGamma selector. Bad
switch statements or something.  Therefore making a GetGamma call to a 
video driver without first checking the board's hardware ID and (if you're
really ambitious) ROM version is VERY VERY DANGEROUS in general and will
zap you if your product has a wide audience.

------------------------------------------------------------------------
Jack Eastman
Berkeley Systems, Inc.
eastman@lbl.gov