[comp.sys.mac.programmer] Switching Monitor Depth

jason@ux1.cso.uiuc.edu (Jason Watts) (10/05/90)

    I am writing a program which needs to change the depth of the main
monitor.  This does not seem to be documented in IM V, "Graphics Devices."
Does anyone know the procedure for doing this?
-- 
                       |  |    |====================|
                       |  |    | Jason Watts        |
                     \ |\ |\ \ | (jazzin@uiuc.edu)  |
                      \| \| \|\|====================|

francis@arthur.uchicago.edu (Francis Stracke) (10/05/90)

In article <1990Oct5.052135.1635@ux1.cso.uiuc.edu> jason@ux1.cso.uiuc.edu (Jason Watts) writes:
>    I am writing a program which needs to change the depth of the main
>monitor.  This does not seem to be documented in IM V, "Graphics Devices."
>Does anyone know the procedure for doing this?

You use the Control Panel.
No, seriously.  IM V says leave monitor depth alone.  That's the user's
province.  Never mind the Thought Police; you could get your users mad.
If it's not what you want it to be, ask the user to change it--if he
can't or won't, then give him your best shot in the depth he lets you
have.

| Francis Stracke		| My opinions are my own.  I don't steal them.|
| Department of Mathematics	|=============================================|
| University of Chicago		| A mathematician is a professional	      |
| francis@zaphod.uchicago.edu	|   schizophrenic.--Me.		       	      |

dorner@pequod.cso.uiuc.edu (Steve Dorner) (10/06/90)

In article <1990Oct5.154600.13120@midway.uchicago.edu> francis@arthur.uchicago.edu (Francis Stracke) writes:
>In article <1990Oct5.052135.1635@ux1.cso.uiuc.edu> jason@ux1.cso.uiuc.edu (Jason Watts) writes:
>>    I am writing a program which needs to change the depth of the main
>>monitor.  This does not seem to be documented in IM V, "Graphics Devices."
>>Does anyone know the procedure for doing this?
>
>You use the Control Panel.
>No, seriously.  IM V says leave monitor depth alone.  That's the user's
>province.

With all due respect, that's not a very helpful answer.  You don't know why
this guy wants to change the depth.  Perhaps he's writing a "depth change"
FKEY.  Perhaps he NEEDS to run at full depth, and would like to make things
convenient for the user.  Which would YOU rather see:

"I'm sorry, but this program requires at least 256 colors.  This is controlled
in software, and I COULD change it for you, but Apple Thought Police and
the Kindly Net won't let me do so.  Guess you'll have to use the Control
Panel."
				[[What a Stupid Restriction]]

or

"This program requires at least 256 colors.  Would you like me to change
your monitor?"
				[[Change It]]  [Leave It Alone]


Now, some things are best left undone, because they cause compatibility
problems; this may be one of them.  However, NOTHING that helps users
should be off limits purely because of ideological considerations.  (Yes,
ideological considerations are usually valid and helpful to users in the
long run; BUT NOT ALWAYS.)

Now that I'm off *my* soapbox, I have no idea how to change the depth, but
if anyone would like to send me a IIfx + color monitor, I'd be happy to
investigate it for the poster.
--
Steve Dorner, U of Illinois Computing Services Office
Internet: s-dorner@uiuc.edu  UUCP: uunet!uiucuxc!uiuc.edu!s-dorner

tj@kona.cs.ucla.edu (Tom Johnson) (10/06/90)

In article <1990Oct5.052135.1635@ux1.cso.uiuc.edu> jason@ux1.cso.uiuc.edu (Jason Watts) writes:
>
>    I am writing a program which needs to change the depth of the main
>monitor.  This does not seem to be documented in IM V, "Graphics Devices."
>Does anyone know the procedure for doing this?


The only somewhat supported way to do this is documented in Tech Note 276:
"Gimmie Depth Or Gimmie Death (So You Want to be a Monitors Impersonator?)"
which details a new call (SetDepth()) availiable in System 6.0.5.  This
tech note is probably up on Apple.com via anonymous ftp.

Of course this call will only work with 6.0.5 (or later).  Has anyone
else come up with some code which will work on earlier versions? Is the
author of Switcheroo out there?  Are you willing to share?

Thanks--

Tom

--
Tom Johnson      UCLA Computer Science Department 
			3413 Boelter Hall, Los Angeles CA 90024 (213)825-6952
			Internet:  tj@cs.ucla.edu

jason@ux1.cso.uiuc.edu (Jason Watts) (10/06/90)

francis@arthur.uchicago.edu (Francis Stracke) writes:

>In article <1990Oct5.052135.1635@ux1.cso.uiuc.edu> jason@ux1.cso.uiuc.edu (Jason Watts) writes:
>>    I am writing a program which needs to change the depth of the main
>>monitor.  This does not seem to be documented in IM V, "Graphics Devices."
>>Does anyone know the procedure for doing this?

>You use the Control Panel.
>No, seriously.  IM V says leave monitor depth alone.  That's the user's
>province.  Never mind the Thought Police; you could get your users mad.
>If it's not what you want it to be, ask the user to change it--if he
>can't or won't, then give him your best shot in the depth he lets you
>have.

>| Francis Stracke		| My opinions are my own.  I don't steal them.|
>| Department of Mathematics	|=============================================|
>| University of Chicago	| A mathematician is a professional	      |
>| francis@zaphod.uchicago.edu	|   schizophrenic.--Me.		       	      |

Allow me to clarify:

    I am writing a cdev which needs to let the user change the depth of the
main monitor.  This does not seem to be documented in IM V,
"Graphics Devices."  Does anyone know the procedure for doing this?

-- 
                       |  |    |====================|
                       |  |    | Jason Watts        |
                     \ |\ |\ \ | (jazzin@uiuc.edu)  |
                      \| \| \|\|====================|

marc@Apple.COM (Mark Dawson) (10/07/90)

In article <1990Oct5.235909.6502@ux1.cso.uiuc.edu> jason@ux1.cso.uiuc.edu (Jason Watts) writes:
>francis@arthur.uchicago.edu (Francis Stracke) writes:
>
>>In article <1990Oct5.052135.1635@ux1.cso.uiuc.edu> jason@ux1.cso.uiuc.edu (Jason Watts) writes:
>>>    I am writing a program which needs to change the depth of the main
>>>monitor.  This does not seem to be documented in IM V, "Graphics Devices."
>>>Does anyone know the procedure for doing this?
>
>>You use the Control Panel.
>>No, seriously.  IM V says leave monitor depth alone.  That's the user's
>>province.  Never mind the Thought Police; you could get your users mad.
>>If it's not what you want it to be, ask the user to change it--if he
>>can't or won't, then give him your best shot in the depth he lets you
>>have.
>
>>| Francis Stracke		| My opinions are my own.  I don't steal them.|
>>| Department of Mathematics	|=============================================|
>>| University of Chicago	| A mathematician is a professional	      |
>>| francis@zaphod.uchicago.edu	|   schizophrenic.--Me.		       	      |
>
>Allow me to clarify:
>
>    I am writing a cdev which needs to let the user change the depth of the
>main monitor.  This does not seem to be documented in IM V,
>"Graphics Devices."  Does anyone know the procedure for doing this?
>
Tech Note #276 (June 1990 release) gives information on doing just this,
including how to do this without being arrested by the "Thought Police".
There are two calls, SetDepth and GetDepth that do this (you must be running
on a system 6.0.5 or later to be able to use these traps, though).  So for the
"exciting" details, see Tech Note #276 (of the June 1990 release).

Mark

ps: And, no I don't know where the June release is available for ftping.

-- 
---------------------------------
Mark Dawson                Service Diagnostic Engineering
AppleLink: Dawson.M

Apple says what it says; I say what I say.  We're different
---------------------------------

b_murphy@fennel.cc.uwa.oz.au (10/08/90)

> Now that I'm off *my* soapbox, I have no idea how to change the depth, but
> if anyone would like to send me a IIfx + color monitor, I'd be happy to
> investigate it for the poster.

Me too, me too....

But seriously, if we don't start asking questions about the interface
it won't get better. So I must agree with the idea of giving the user
the option to let the program change the depth of the screen, *HOWEVER*
what happens if this very same user is painting in 24-bit mode and your
program works in 8-bit mode and the user says it's ok to change. The
user will switch back to their painting job and find that the whole world
has changed. It would start to look like an *** (censored) wouldn't it?

-- 
-o (short for On-no)

     ()/)/)()  can be  r e a c h e d  at  B_MURPHY@VAXA.UWA.OZ.AU
_____________________________________________________________________
        The net never sleeps, come to think of it, do I ever?
---->  Thinking is dangerous, subversive and leads you astray.  <----

lemke@radius.com (Steve Lemke) (10/16/90)

tj@kona.cs.ucla.edu (Tom Johnson) writes:

}In article <1990Oct5.052135.1635@ux1.cso.uiuc.edu> jason@ux1.cso.uiuc.edu (Jason Watts) writes:
}>
}>    I am writing a program which needs to change the depth of the main
}>monitor.  This does not seem to be documented in IM V, "Graphics Devices."
}>Does anyone know the procedure for doing this?
}
}The only somewhat supported way to do this is documented in Tech Note 276:
}"Gimmie Depth Or Gimmie Death (So You Want to be a Monitors Impersonator?)"
}which details a new call (SetDepth()) availiable in System 6.0.5.  This
}tech note is probably up on Apple.com via anonymous ftp.

Yep, that's the way to do it.  I just re-wrote the pop-up bit-depth changer
that is in RadiusWare (the init/cdev that ships with Radius display boards
for the Mac II and SE/30).  There's also a nifty call that you can do to
check and see if a certain video mode is available or not - it's called
"HasDepth()".

HOWEVER, BE AWARE THAT HASDEPTH HAS A BUG!!  I ran into this, and had to
write around it.  If you use HasDepth() on a IIci or IIfx (or any of the
new machines with 32-bit QuickDraw in ROM), HasDepth does NOT return the
Video Mode as TN276 claims it does.  It DOES still return 0 if the mode is
not available, but instead of returning 128, 129, 130, 131, etc. for the
mode, it just returns 256 (which, as I understand, is a Boolean "TRUE").
This bug has been acknowledged by DTS, though they weren't sure when it
would be fixed.  Anyway, don't count on the result being a proper video
mode number.  256 is not a valid mode, and bad things will happen if you
try to send 256 to SetDepth as a mode value.  (SetDepth will accept either
a video mode number or the bit level i.e. you can send "1" or "128" to
switch to one-bit mode.)

}Of course this call will only work with 6.0.5 (or later).  Has anyone
}else come up with some code which will work on earlier versions?

It is possible to change the bitdepth without using the new calls, but since
any machine on which you would need to change the bitdepth is bound to be
running some flavor of System 6.0.x, why put yourself through that hell?
I can't think of a reason anyone with a Mac II shouldn't be running at least
6.0.5, so use the call.  Of course, you'll want to use SysEnvirons to make
SURE that you're running under at least 6.0.5 before you use the call (or
else the mouse will lock - trust me!).  However, I replaced a few pages of
assembly language (our old code) with a fraction of that, using HasDepth
and SetDepth.

Anyway, if you have any problems understanding TN276 or making it work, feel
free to write me and I'll see if I can't help.  As others have mentioned, do
pay attention to the user interface implications of changing the bit depth.

--Steve
-- 
----- Steve Lemke, Engineering Quality Assurance, Radius Inc., San Jose -----
----- Reply to: lemke@radius.com     (Note: NEW domain-style address!!) -----