[comp.sys.mac.hypercard] Need XCMD to dim screen

hughes@ux.acs.umn.edu (Steve Hughes) (05/02/91)

"All I want out of life is a simple way to turn the screen off 
instantly, then bring it back on instantly and without flicker."

IUm using HyperCard 2.0 and the picture XCMD to present 256 level 
grey scale photographs as visual stimuli in a series of right-
hemisphere testing neuropsychology experiments, and brother, I got 
trouble. 

In the good ol' days of early April, the Ph.D. candidate whose 
dissertation is riding on this stuff was really happy with how 
things were looking--just loved to see those grey scale photos 
flash onto the computer screen (they appear in pairs, one after 
the other). 

Here is how I did it:

    put "PictureA" into pic1
    put "PictureB" into pic2
    picture pic2,file,rect,false
    picture pic1,file,rect,false
    set the visible of window pic1 to true
    wait for 30 ticks
    set the visible of window pic1 to false
    wait for 30 ticks
    set the visible of window pic2 to true
     wait for 30 ticks
    set the visible of window pic2 to false

My problem: One week before subjects are to be run, she decides 
that the pictures do not appear smoothly enough, too much flicker 
when we set visible to true. The Ph.D. candidate screams, "THE 
PRESENTATION OF STIMULI MUST BE INSTANTANIOUS! HOW COULD WE HAVE 
MISSED THIS? IT'S A DISASTER!" Hmmm...seems all the prior 
literature is based on instant presentation of stimuli (using a 
fast iris called a "tachistascope" mounted on the front of a slide 
projector lens--instant open, instant closed).

Here's what happens: when I set visible to true, the picture sort 
of "rolls" into visibility--presentation is not in sync with the 
vertical retrace of the monitor (or it can't do it fast enough to 
make it in one blanking period). The pictures sure appear fast on 
a IIci, but not without some noticeable flicker. Trouble. 

Facing total ruin, I consider a new career cleaning out public 
lavatories.

 Then: Inspiration! 
I don't need to make the picture XCMD faster--I can create exactly 
the effect I want if I can shut off the whole screen while I set 
the visible of the picture to true, then turn the screen back on 
after I've made the picture visible. I'd do it like this:

    screenOff  <--- XCMD to dim screen to black instantly
    set the visible of window pic1 to true
    screenOn  <--- XCMD to turn screen to white instantly
    wait for 30 ticks
    screenOff
    set the visible of window pic1 to false
    wait for 30 ticks
    set the visible of window pic2 to true
    screenOn 
    wait for 30 ticks
    screenOff
    (etc.)

Can this be done? I think so, screen savers do it all the time. 
I've got AfterDark set to the "Face Away" module with 0 second dim 
time and 0% intensity. "Blip!" screen off. "Blip!" screen on. 
Pictures (and, of course, everything else) appear and disappear 
INSTANTLY. just like I want them to. Different settings make it 
fade slower or to a less dark final brightness. So it looks like I 
CAN turn the screen off and on, instantly and with out flicker.

My other problem:
I have no idea how this is done! Looks like there must be some 
(God willing, fairly easy) way to adjust the screen brightness 
with software (note the Mac Classic's Brightness cdev).
 
Maybe a hardware location? 

Maybe a toolbox call? 

Well? 

Does anybody know anything about this?

-Steve

P.S. Changing the odd and confusing bit depth parameter of the 
picture XCMD does not speed it up (like it should?).


"I'm at the end of the road, my back's against the wall, I'm 
outta' ammo, sweet God Almighty, does _somebody_ know the answer?"

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	Steve Hughes							
	Pediatric Neuropsychology					
	University of Minnesota						
	hughes@ux.acs.umn.edu						
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

mxmora@unix.SRI.COM (Matt Mora) (05/03/91)

In article <3848@ux.acs.umn.edu> hughes@ux.acs.umn.edu (Steve Hughes) writes:


>Can this be done? I think so, screen savers do it all the time. 
>I've got AfterDark set to the "Face Away" module with 0 second dim 
>time and 0% intensity. "Blip!" screen off. "Blip!" screen on. 
>Pictures (and, of course, everything else) appear and disappear 
>INSTANTLY. just like I want them to. Different settings make it 
>fade slower or to a less dark final brightness. So it looks like I 
>CAN turn the screen off and on, instantly and with out flicker.

Hmmm. I think the dimming is done with gamma color tables
 (or whatever they are called) and will only work on
color machines. I guess that is not a problem for you 
since you are trying to display grayscale pictures. I seem to
recall someone mentioning that the gamma stuff is a bitch. I look it
up and let you know my findings.

matt





-- 
___________________________________________________________
Matthew Mora                |   my Mac  Matt_Mora@sri.com
SRI International           |  my unix  mxmora@unix.sri.com
___________________________________________________________

cad0410@ritvax.isc.rit.edu (DORN, CA) (05/04/91)

In article <3848@ux.acs.umn.edu>, hughes@ux.acs.umn.edu (Steve Hughes) writes...
> 
>"All I want out of life is a simple way to turn the screen off 
>instantly, then bring it back on instantly and without flicker."
> 
>IUm using HyperCard 2.0 and the picture XCMD to present 256 level 
>grey scale photographs as visual stimuli in a series of right-
>hemisphere testing neuropsychology experiments, and brother, I got 
>trouble. 
> 
>In the good ol' days of early April, the Ph.D. candidate whose 
>dissertation is riding on this stuff was really happy with how 
>things were looking--just loved to see those grey scale photos 
>flash onto the computer screen (they appear in pairs, one after 
>the other). 
> 
>Here is how I did it:
> 
>    put "PictureA" into pic1
>    put "PictureB" into pic2
>    picture pic2,file,rect,false
>    picture pic1,file,rect,false
>    set the visible of window pic1 to true
>    wait for 30 ticks
>    set the visible of window pic1 to false
>    wait for 30 ticks
>    set the visible of window pic2 to true
>     wait for 30 ticks
>    set the visible of window pic2 to false
> 
>My problem: One week before subjects are to be run, she decides 
>that the pictures do not appear smoothly enough, too much flicker 
>when we set visible to true. The Ph.D. candidate screams, "THE 
>PRESENTATION OF STIMULI MUST BE INSTANTANIOUS! HOW COULD WE HAVE 
>MISSED THIS? IT'S A DISASTER!" Hmmm...seems all the prior 
>literature is based on instant presentation of stimuli (using a 
>fast iris called a "tachistascope" mounted on the front of a slide 
>projector lens--instant open, instant closed).
> 
>Here's what happens: when I set visible to true, the picture sort 
>of "rolls" into visibility--presentation is not in sync with the 
>vertical retrace of the monitor (or it can't do it fast enough to 
>make it in one blanking period). The pictures sure appear fast on 
>a IIci, but not without some noticeable flicker. Trouble. 
> 
>Facing total ruin, I consider a new career cleaning out public 
>lavatories.
> 
> Then: Inspiration! 
>I don't need to make the picture XCMD faster--I can create exactly 
>the effect I want if I can shut off the whole screen while I set 
>the visible of the picture to true, then turn the screen back on 
>after I've made the picture visible. I'd do it like this:
> 
>    screenOff  <--- XCMD to dim screen to black instantly
>    set the visible of window pic1 to true
>    screenOn  <--- XCMD to turn screen to white instantly
>    wait for 30 ticks
>    screenOff
>    set the visible of window pic1 to false
>    wait for 30 ticks
>    set the visible of window pic2 to true
>    screenOn 
>    wait for 30 ticks
>    screenOff
>    (etc.)
> 
>Can this be done? I think so, screen savers do it all the time. 
>I've got AfterDark set to the "Face Away" module with 0 second dim 
>time and 0% intensity. "Blip!" screen off. "Blip!" screen on. 
>Pictures (and, of course, everything else) appear and disappear 
>INSTANTLY. just like I want them to. Different settings make it 
>fade slower or to a less dark final brightness. So it looks like I 
>CAN turn the screen off and on, instantly and with out flicker.
> 
>My other problem:
>I have no idea how this is done! Looks like there must be some 
>(God willing, fairly easy) way to adjust the screen brightness 
>with software (note the Mac Classic's Brightness cdev).
> 
>Maybe a hardware location? 
> 
>Maybe a toolbox call? 
> 
>Well? 
> 
>Does anybody know anything about this?
> 
>-Steve
> 
>P.S. Changing the odd and confusing bit depth parameter of the 
>picture XCMD does not speed it up (like it should?).
> 
> 
>"I'm at the end of the road, my back's against the wall, I'm 
>outta' ammo, sweet God Almighty, does _somebody_ know the answer?"
> 
>    put "PictureA" into pic1
>    put "PictureB" into pic2
>    picture pic2,file,rect,false
>    picture pic1,file,rect,false
>    set the visible of window pic1 to true
>    wait for 30 ticks
>    set the visible of window pic1 to false
>    wait for 30 ticks
>    set the visible of window pic2 to true
>     wait for 30 ticks
>    set the visible of window pic2 to false


Well if I understand your problem correctly how about creating a 
button large enough to cover the whole picture area in which you
want to display in.  Hide the button and set the hilite of the
button to true (this will make the screen look black when it
is un-hidden).  Use this button instead of your screenOff/screenOn
idea like so.

set the hilite of button "Cover" to true
show button "Cover"   <--- this will black out your screen
set the visible of window pic1 to true
hide button "Cover"   <--- this will instantly uncover your picture
wait for 30 ticks
show button "Cover"
set the visible of window pic1 to false
wait for 30 ticks
set the visible of window pic2 to true
hide button "Cover"
wait for 30 ticks
show button "Cover"
    (etc.)

Hope this helps, 
	Cea

cad0410@ritvax.isc.rit.edu (DORN, CA) (05/04/91)

In article <3848@ux.acs.umn.edu>, hughes@ux.acs.umn.edu (Steve Hughes) writes...
> 
>"All I want out of life is a simple way to turn the screen off 
>instantly, then bring it back on instantly and without flicker."
> 

Oops, I also forgot to mention when you create the button, make
it a rectangle (or opaque) and don't show its name.

--Cea

man@cs.brown.edu (Mark H. Nodine) (05/08/91)

In article <1991May3.172724.13806@isc.rit.edu>, cad0410@ritvax.isc.rit.edu (DORN, CA) writes:
|> In article <3848@ux.acs.umn.edu>, hughes@ux.acs.umn.edu (Steve Hughes) writes...
|> > 
|> >"All I want out of life is a simple way to turn the screen off 
|> >instantly, then bring it back on instantly and without flicker."
|> > 
|> >IUm using HyperCard 2.0 and the picture XCMD to present 256 level 
|> >grey scale photographs as visual stimuli in a series of right-
|> >hemisphere testing neuropsychology experiments, and brother, I got 
|> >trouble. 
|> 
|> Well if I understand your problem correctly how about creating a 
|> button large enough to cover the whole picture area in which you
|> want to display in.  Hide the button and set the hilite of the
|> button to true (this will make the screen look black when it
|> is un-hidden).  Use this button instead of your screenOff/screenOn
|> idea like so.

No dice on this one.  The picture XCMD creates a window in the palette
layer (it can be at the back of the palette layer if you use the right
window styles), but your button goes in on the document layer.  So it
will neatly show up _behind_ the pictures you're trying to hide with it.

If you're sure you're going to be running on a Classic or some other
machine with software brightness control, then it should be easy to
write an XCMD to set (and fetch for resetting) the brightness level.
I don't know how to do it, though.

	--Mark